Sign up

Connect a remote agent (HTTP)

Connect a response-mode HTTPS route or a Grok Bot routine that calls back.

A remote agent answers through a company-owned HTTPS route. Creating an agent and saving its route send nothing. Test the route sends a real sample and may spend the remote account’s usage.

Choose a reply mode

Answers in the response: POST returns HTTP 200 with the reply JSON. The default timeout is 60 seconds; the maximum is 300 seconds.

Calls back: POST returns HTTP 200 to accept the turn. The route then posts the reply JSON to reply_url, sending Authorization: Bearer <reply_token>. The default for the Grok bot preset is 600 seconds. The callback expires at the configured timeout and can be used once.

Set up a Grok Bot routine

What applies to a remote agent

Remote is always shown. Speaks as controls the identity used for channel replies. Memory stays available for Studio memory. Instructions, Skills, Knowledge searches and Tools are shown for a Grok Bot or an active publication receiver, with a note saying where publication goes. Model pickers are hidden. Questions use workflow Ask and People nodes. Hidden page addresses return to Remote.

Publish to a Grok Bot

When Publish to Grok Bot is switched on, Remote offers five steps: copy the generated studio-remote-agent skill to the bot owner chat and ask it to save the skill; copy the routine request; paste POST to and key into Studio; Test the route; then publish a Studio version and paste its setup message in the bot owner chat. Install the shared skill only once across your bots. Each bot creates its own routine. A routine cannot change the bot.

The separate remote build stores a versioned bundle with the published version: profile, literal root instructions and bound skills, authored standing facts, knowledge search names and tool input schemas, plus a digest. The setup message maps profile to UpdateProfile, instructions and skills to prefixed UpdateSkill writes, standing facts to profile memory, and knowledge and tools to the agent's Studio MCP connection. It contains no keys. Changes-only compares published bundles with the version marked as applied; the full message is also available.

Gateway access for this Grok Bot issues a key once, rotates it or revokes it, and shows last use. Store the key as STUDIO_AGENT_KEY through Grok's secret request. This connection acts as the remote agent and passes turn_id for speaker permissions and approvals. Without a current turn, only tools allowed with no person present can run. Never use owner credentials or AWS keys. If the bot supports only OAuth, it needs an agent-bound OAuth client; owner sign-in is not a substitute.

Mark as applied records your assertion. Test the route asks for the saved setup marker. A supported response shows the bot's version or Out of date: paste the update. If unsupported, Studio says Version unknown.

Open the routine on desktop, open Webhook, and copy “POST to” and “key” into Route URL and Bearer token.

Press Test the route. Studio sends a sample and waits for the callback.

The webhook’s 200 means accepted and started. It does not contain a finished answer. Other statuses mean no run started. The Bot must perform the callback described above for Studio to receive its answer.

Each call, including Test, spends the Bot account’s usage. Limits are 300 runs per hour per account and 200 per routine. Failed runs are not automatically retried. See Grok Bot routines. This integration specifies the route’s behavior; it does not promise that a Bot can provision any particular server or service.

Request

Studio sends a POST with Content-Type: application/json, Authorization: Bearer <your saved token>, and Idempotency-Key: <turn_id>. Optional X- headers are also sent. The bearer and header values are sealed in the company vault and are never returned by settings reads. Replace or remove them in the setup screen.

{
  "conversation_id": "conversation_one",
  "turn_id": "turn_one",
  "agent": {"id": "agent_one", "name": "Helper"},
  "company": {"id": "company_one", "name": "Example"},
  "speaker": {"kind": "person", "id": "person_one", "name": "Pat", "verified": false},
  "message": {"text": "Hello", "attachments": []},
  "history": [{"role": "user", "text": "Earlier message", "at": "2026-11-02T12:00:00.000Z"}],
  "context": {"workflow_id": null, "run_id": "run_one", "step": null},
  "tools_available": []
}

Speaker kind is person, contact or agent. Only host-proved verification may set verified to true. Attachments, when supported by the calling channel, have name, media_type and a short-lived signed url. History contains at most the last 20 turns. Tool requests in reply JSON are unavailable in this protocol version. A Grok Bot can use the agent-scoped Studio MCP connection when configured.

Callback mode adds reply_url and reply_token. Treat reply_token as a secret for this turn only. It is not the routine key, and must not appear in the answer, logs or chat.

Reply

{
  "reply": {"text": "Hello, how can I help?"},
  "handoff": {"to": "person", "reason": "A person should review this"},
  "usage": {"input_tokens": 100, "output_tokens": 12, "cost_usd": 0.001}
}

Only reply is required. Reply text must be nonempty and the entire JSON reply must fit 64 KiB. Usage is optional, nonnegative and reported by the remote agent. It is not a provider-verified charge or permission to spend beyond Studio’s own limits. Callback ingress answers 202 when accepted, 410 when already used or no longer current, and 404 for unknown, expired or invalid callbacks. A rate limit answers 429.

Human handoff

Errors, timeouts and idempotency

There are no automatic outbound retries. Non-200 acceptance, a request timeout, invalid JSON or a bad reply fails the turn plainly. A callback that does not arrive before expiry fails the turn. A person may start a new turn to retry. Replayed delivery of an existing turn reads its stored result and never sends it again. Your route should also retain Idempotency-Key receipts to avoid doing work twice.

Security

Serve HTTPS on port 443 and verify the bearer before doing work. Studio refuses local/private addresses, IP literals, credentials in URLs, query parameters and redirects. DNS is resolved and pinned for each call. Authenticate the callback with its one-use bearer; the URL alone grants nothing. Treat message, history and remote reply text as untrusted data. Do not use these fields to grant tools or expand access.

Minimal response-mode server

Run this behind a public HTTPS reverse proxy. Set a long random ROUTE_TOKEN using your host’s secret manager. The example compares the bearer before parsing the request and caps the body.

import http from "node:http";
import { timingSafeEqual } from "node:crypto";
const token = process.env.ROUTE_TOKEN;
if (!token) throw new Error("Configure ROUTE_TOKEN");
http.createServer(async (req, res) => {
  const expected = Buffer.from("Bearer " + token);
  const actual = Buffer.from(req.headers.authorization ?? "");
  if (req.method !== "POST" || actual.length !== expected.length ||
      !timingSafeEqual(actual, expected)) { res.writeHead(401).end(); return; }
  let text = "";
  for await (const chunk of req) {
    text += chunk;
    if (Buffer.byteLength(text) > 1048576) { res.writeHead(413).end(); return; }
  }
  try {
    const body = JSON.parse(text);
    // Persist/check req.headers["idempotency-key"] before any side effect.
    const reply = { reply: { text: "Received: " + body.message.text } };
    res.writeHead(200, { "Content-Type": "application/json" });
    res.end(JSON.stringify(reply));
  } catch { res.writeHead(400).end(); }
}).listen(8080);