{ "id": "c91d2a7e84f04b6f9a3d5e1c0b87f4a2", "session_id": "7f3e0b6c52a949d2b1c4a8e9d0f31726", "status": "completed", "output_text": "The spreadsheet lists your leads."}
POST /v1/responses runs a turn on templates that include the Agent API. You make it against your instance, not against api.agent37.com: agent templates serve their chat API at https://{instanceId}.agent37.app, the url of the default port in the create response. This page uses https://ab12cd34ef.agent37.app. Authenticate with the same sk_live_ key you use on the Sandbox API, sent as the X-Agent37-Key header.The call is agentic by default: the agent can browse, run code, use a terminal, read and write files, call connected tools, and reason across many steps before answering.
The example shows all request fields for Hermes. Upload leads.csv first, use a session id from a previous response to continue a conversation, and choose model and provider from Models. Omit optional fields you do not need.Request bodies are capped at 2 MB; anything larger returns 413 payload_too_large.
The message or task, a plain string. There is no image field; to attach files, upload them first and list their paths in files. See Sessions for how history carries across turns.
Paths of files on the instance to attach to this turn, typically the path returned by PUT /v1/files/content. Each must name an existing file on the instance, or the call returns 400 validation_error. The paths are appended to the input, and the agent reads them from disk.
Continue an existing conversation. Omit it to start a new one; the response returns the new session’s id. The harness owns sessions and creates one on first use, so an id it has not seen simply starts a fresh thread under that id rather than erroring. The exception is a harness that issues its own session ids: codex, grok, opencode and pi reject a first turn on an id they did not issue with 400 validation_error (param: session_id), so on those four always start a thread by omitting session_id and reuse the id the response returns.
The LLM to run this turn on, an id from GET /v1/models (on OpenClaw the ids are provider/model). On Hermes it applies to this turn only: omit it and the turn runs on the instance’s default model, whatever earlier turns chose. On OpenClaw a named model is written to the session and sticks for the turns that follow; a turn that omits it leaves the session’s model as is. A model OpenClaw does not allow (an id outside GET /v1/models) never starts the turn: the response settles with status: "failed" and error.codeagent_error, with OpenClaw’s reason in message, and the session keeps its previous model. See Models.
The model’s provider, for example anthropic. Hermes only, and per turn like model: it tells Hermes which configured provider to run the named model on. OpenClaw ignores it (the response still echoes it); there the provider is the prefix of the provider/model id you pass as model.
How hard the model thinks: none, minimal, low, medium, high, xhigh, max, or ultra. max is the strongest plain thinking level; ultra is the harness’s own Ultra mode, top thinking plus its agentic orchestration (on OpenClaw it also turns on proactive subagent orchestration). It applies to this turn only on both harnesses. Omit it and Hermes uses the instance’s configured effort, while OpenClaw uses the session’s own thinking level. On OpenClaw the values map one to one onto its thinking levels, with none sent as off. max and ultra need gateway 0.10.0: older instances reject them with validation_error until updated.Codex and OpenCode advertise their levels per model, and a level a model does not accept is run at the nearest level below it rather than failing the turn. The response’s reasoning_effort reports the level applied, so read that rather than assuming the request was honoured.
Which agent harness runs the turn, hermes, openclaw, claude-code, codex, grok, opencode, or pi. Omit it to use the instance’s configured default (hermes on agent37-hermes, openclaw on agent37-openclaw, claude-code on agent37-claude-code, codex on agent37-codex, grok on agent37-grok, opencode on agent37-opencode, pi on agent37-pi). Routing is per request: the gateway keeps no session-to-agent binding, so if a session runs on a non-default harness, send agent on every turn of it. Targeting a harness the instance was not provisioned with does not reject the call: the turn settles with status: "failed" and error.codeagent_unavailable.
A named setup inside the agent, with its own instructions, skills, memory, config, and sessions, so one instance can host several distinct agents (a support agent and a sales agent, say). Omit it, or send default, for the agent’s own setup. Like agent, it is per request: send it on every turn of the session, and as ?profile= on the session reads. Supported on hermes today; profile with any other agent is 400 validation_error. A name that is not lowercase letters, digits, - or _ is 400 validation_error, and a profile that does not exist on the instance is 404 profile_not_found.
The example shows selected fields. The complete response fields are listed below.The response object. Ids are 32-character hex strings; timestamps from the gateway are epoch milliseconds.
The model you sent on this request, echoed back. null when you omitted it: the turn still ran on the harness’s default or session model, but the gateway does not report which model the harness resolved.
The reasoning level applied to this turn, which is not always the one you asked for. Every harness takes the same eight levels and maps them onto its own: Hermes and OpenClaw run all eight, Claude Code runs minimal as low, grok and pi run ultra as max, and Codex and OpenCode go further and advertise which levels each individual model supports. Rather than reject a turn for a level a model cannot run, the gateway runs it at the nearest level below. Ask OpenCode for ultra and you get max or lower back. null when you sent no level and the harness used its own default: the turn still ran at some effort, but the gateway reports only what it applied.This is the level sent to the harness, not a reading taken from the model. A harness that lowers it again on its own is not visible here: Pi clamps to the model’s limits itself, and a non-reasoning Grok model ignores the setting outright. Read it as the ceiling the turn ran under. It also rides the terminal response.completed event when you stream. Needs gateway 0.18.0; older instances omit the field.
The session’s context window as of this turn: { used_tokens, window_tokens }, the tokens occupying the model’s window against the window’s size. null when the harness didn’t report a measurement; a cancelled turn reports none on either harness. Hermes reports it on every completed turn. OpenClaw reports none, so the gateway derives it from the turn: used_tokens is the turn’s token total (input, output, and cache tokens) and window_tokens is the model’s context window from OpenClaw’s model catalog, or 128000 (OpenClaw’s own default budget) when the catalog lists no window for the model. On OpenClaw it is null when the turn reported no usage, no model, a zero token total, or a model that is not in the catalog.
A failed turn does not reject the HTTP call. The POST still returns 200 with status: "failed" and error set. Branch on status, not on the HTTP code.
On a non-streaming call the gateway sends the 200 and headers as soon as the turn starts, then keeps the connection alive with a whitespace tick every 25 seconds while the agent works. There is no time limit on a turn; the connection stays open until the agent is done. The JSON body arrives when the turn finishes, prefixed by that whitespace. Leading whitespace is valid JSON, so standard parsers handle it unchanged. Don’t treat the early headers as the response being ready. On a sleeping instance no headers arrive at all until the wake completes, so give the request a first-byte timeout of at least three minutes; past the edge’s three-minute wake budget the request gets 503 wake_timeout instead.
Set stream: true to receive Server-Sent Events as the agent reasons, calls tools, and writes its answer. The terminal event carries the final output_text, usage, and context. See Streaming.
The first message omits session_id and starts a session. The reply returns a session_id; pass it on the next message to continue the same thread. The session holds the full history, so you never resend a transcript: you send only the new input.
# 1. start a session: omit session_idcurl https://ab12cd34ef.agent37.app/v1/responses \ -H "X-Agent37-Key: sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "input": "Research the top 3 EV makers, write a memo." }'# -> { "id": "c91d2a7e84f04b6f9a3d5e1c0b87f4a2",# "session_id": "7f3e0b6c52a949d2b1c4a8e9d0f31726",# "status": "completed", ... }# 2. continue it: reuse the session_id, send only the new inputcurl https://ab12cd34ef.agent37.app/v1/responses \ -H "X-Agent37-Key: sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "session_id": "7f3e0b6c52a949d2b1c4a8e9d0f31726", "input": "Make it shorter, add a quote." }'
import requestsBASE = "https://ab12cd34ef.agent37.app"H = {"X-Agent37-Key": "sk_live_...", "Content-Type": "application/json"}# 1. start a session: omit session_idfirst = requests.post( f"{BASE}/v1/responses", headers=H, json={"input": "Research the top 3 EV makers, write a memo."},).json()# 2. continue it: reuse the session_id, send only the new inputrequests.post( f"{BASE}/v1/responses", headers=H, json={ "session_id": first["session_id"], "input": "Make it shorter, add a quote.", },)
const BASE = "https://ab12cd34ef.agent37.app";const H = { "X-Agent37-Key": "sk_live_...", "Content-Type": "application/json",};// 1. start a session: omit session_idconst first = await (await fetch(`${BASE}/v1/responses`, { method: "POST", headers: H, body: JSON.stringify({ input: "Research the top 3 EV makers, write a memo.", }),})).json();// 2. continue it: reuse the session_id, send only the new inputawait fetch(`${BASE}/v1/responses`, { method: "POST", headers: H, body: JSON.stringify({ session_id: first.session_id, input: "Make it shorter, add a quote.", }),});
One active turn per session. A session runs one response at a time. Sending new input while one is in flight returns 409 session_busy, normally with the running response’s id in error.response_id. Use another session, reattach to the running turn, or cancel it first.
To list a user’s threads, read a thread’s history, or delete one, see Sessions. To pick a model per turn, see Models.
The agent asks by ending its turn: the response comes back completed with the question (and the options, if any) as output_text, and the turn is over. Answer by sending the reply as the next input on the same session_id. There is no in-turn prompt to answer while a response is in_progress, so a chat client needs nothing special: render the question like any other reply, and send the user’s answer like any other message.
On Hermes, subagents run inside the turn: the response stays in_progress until they finish, and the agent’s final answer, their results included, arrives in that same response. A delegation can run for minutes with nothing on the stream but :keepalive comments between the delegate_task tool call’s started and completed events, so keep the connection open or reattach. Cancelling the turn stops the subagents too. This needs gateway 0.15.1: older instances end the turn as soon as the subagents are dispatched and hand their results to the agent at the start of your next message, until updated.
Every response has an id you can use after the call returns.
Method
Path
Returns
GET
/v1/responses/{id}/stream
200 an SSE stream: replays all events, then attaches live
POST
/v1/responses/{id}/cancel
200 the current response object
GET /v1/responses/{id}/stream replays every event so far in order, then stays attached live, so a dropped connection never loses the answer, including after the turn has finished, while the response is still retained. See Streaming for the replay window. Lost the id (page reload, new device)? GET /v1/sessions/{id} returns the running response as active_response_id.POST /v1/responses/{id}/cancel takes no body and stops a running turn (on OpenClaw it aborts the run inside OpenClaw). It returns 200 with the current response object as soon as the stop is requested, not once the agent has actually stopped, so the body normally still reads status: "in_progress"; the response settles to cancelled when the turn unwinds. To see it end, read GET /v1/responses/{id}/stream: a cancelled turn still closes with response.completed, carrying the output_text accumulated so far. Cancelling a finished response is a no-op that returns its terminal state, still 200.
curl -X POST \ https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel \ -H "X-Agent37-Key: sk_live_..."
Cancel does not rewind. Whatever the agent has already done (files written, emails sent, tools called) is not undone. The response ends with status: "cancelled".
A response moves from in_progress to exactly one terminal status.
Status
Meaning
in_progress
The turn is running.
completed
The turn finished and output_text holds the answer.
failed
The turn ended on an error; error says why.
cancelled
You stopped the turn with cancel, or (OpenClaw only) the input was one of OpenClaw’s own stop commands such as stop or exit, so no run started.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Agent 37","colors":{"primary":"#171717","light":"#8d8d8d","dark":"#000000"},"logo":{"light":"https://mintcdn.com/agent37/KgMOKLhsUcC5DWl-/logo/light.svg?fit=max\u0026auto=format\u0026n=KgMOKLhsUcC5DWl-\u0026q=85\u0026s=40315674dd037e65c13574dd79aeb421","dark":"https://mintcdn.com/agent37/KgMOKLhsUcC5DWl-/logo/dark.svg?fit=max\u0026auto=format\u0026n=KgMOKLhsUcC5DWl-\u0026q=85\u0026s=42fd73209236d3ef7ffbe6abe39325d5"},"favicon":"https://mintcdn.com/agent37/xVN49YI9cBBSacux/favicon.svg?fit=max\u0026auto=format\u0026n=xVN49YI9cBBSacux\u0026q=85\u0026s=8260c34b3c5d9f74963125175b313758","api":{"playground":{"display":"simple"},"mdx":{"auth":{"method":"key","name":"X-Agent37-Key"}}},"navbar":{"links":[{"href":"https://www.agent37.com","label":"Website"}],"primary":{"type":"button","label":"Open dashboard","href":"https://www.agent37.com/dashboard/cloud"}},"footer":{"socials":{"website":"https://www.agent37.com"}},"seo":{"indexing":"all"},"icons":{"library":"tabler"},"integrations":{"posthog":{"apiKey":"phc_Caat4HHPrchwIsAA5I0P2HZHJY002wpuVF862YEaJsI","sessionRecording":false}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"agent37","hasAudioNarration":false,"actualSubdomain":"agent37","customDomains":["www.agent37.com"],"gitSource":{"type":"github","owner":"agent37-platform","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adc288afc061c4c5d95f0df","collectionId":"0c5a0fd3-a460-4f0e-9c43-028eec664037","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adc288afc061c4c5d95f0df"},"entitlements":{},"buildId":"6adc288afc061c4c5d95f0df","clientVersion":"0.0.3964","searchFilterCounts":[{"language":"default","tag":"Guides","count":39},{"language":"default","tag":"API reference","count":39},{"language":"default","tag":"Sandbox API","count":27},{"language":"default","tag":"Build with Agent37","count":18},{"language":"default","tag":"Instances","count":16},{"language":"default","tag":"Sandboxes","count":11},{"language":"default","tag":"Agents and tools","count":7},{"language":"default","tag":"Apps and interfaces","count":7},{"language":"default","tag":"Agent templates","count":6},{"language":"default","tag":"Agent API","count":6}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":":is(#content-side-layout, #api-playground-2-operation-page) [data-component-part=code-group-tab-content],:is(#content-side-layout, #api-playground-2-operation-page) pre,:is(#content-side-layout, #api-playground-2-operation-page) pre code{white-space:pre-wrap;overflow-wrap:anywhere}:is(#content-side-layout, #api-playground-2-operation-page) pre code{width:100%;min-width:0}#content-container:has(.docs-home){max-width:90rem}#content-area:has(.docs-home) #page-title{font-size:clamp(1.875rem,3vw,2.5rem);line-height:1.15;letter-spacing:-.035em}.docs-home [data-component-part=card-image]{aspect-ratio:3/2}.docs-home .card:has([data-component-part=card-cta]),.docs-home .card:has([data-component-part=card-cta]) [data-component-part=card-content-container],.docs-home .card:has([data-component-part=card-cta]) [data-component-part=card-content-container]>a>.w-full{display:flex;flex-direction:column;flex-grow:1}.docs-home [data-component-part=card-cta]{margin-top:auto;padding-top:1.5rem}.docs-home .card:focus-visible{outline:2px solid #ba664b;outline-offset:4px}.docs-home-previous{font-size:.875rem}@container columns-container (min-width: 30rem) and (max-width: 59.99rem){@layer base{.docs-home .docs-home-start .columns{grid-template-columns:repeat(2,minmax(0,1fr))!important}}}@container columns-container (min-width: 30rem) and (max-width: 49.99rem){@layer base{.docs-home .columns{grid-template-columns:repeat(2,minmax(0,1fr))!important}.docs-home>.columns:has([data-component-part=card-image]){grid-template-columns:minmax(0,1fr)!important}}.docs-home>.columns .card:has([data-component-part=card-image]){flex-direction:row}.docs-home>.columns [data-component-part=card-image]{width:42%;flex-shrink:0}}"}],"page":{"pagePath":"agents-api/chat","slug":"/agents-api/chat","pageMetadata":{"title":"Send a message","description":"Run a turn through an agent template, stream or return its result, and continue the conversation.","api":"POST https://{instanceId}.agent37.app/v1/responses","playground":"simple","authMethod":"key","href":"/agents-api/chat"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Run a turn through an agent template, stream or return its result, and continue the conversation.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,ParamField,ResponseField,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Send a message or task to the agent on your instance. Omit `,_jsx(_components.code,{children:`session_id`}),` to start a conversation.`]}),`\n`,_jsx(`span`,{id:`example`}),`\n`,`\n`,`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`POST /v1/responses`}),` runs a turn on templates that include the Agent API. You make it against your instance, not against `,_jsx(_components.code,{children:`api.agent37.com`}),`: agent templates serve their chat API at `,_jsx(_components.code,{children:`https://{instanceId}.agent37.app`}),`, the `,_jsx(_components.code,{children:`url`}),` of the default port in the create response. This page uses `,_jsx(_components.code,{children:`https://ab12cd34ef.agent37.app`}),`. Authenticate with the same `,_jsx(_components.code,{children:`sk_live_`}),` key you use on the Sandbox API, sent as the `,_jsx(_components.code,{children:`X-Agent37-Key`}),` header.`]}),`\n`,_jsx(_components.p,{children:`The call is agentic by default: the agent can browse, run code, use a terminal, read and write files, call connected tools, and reason across many steps before answering.`}),`\n`,_jsx(Heading,{level:`2`,id:`request-body`,children:`Request body`}),`\n`,_jsxs(_components.p,{children:[`The example shows all request fields for Hermes. `,_jsxs(_components.a,{href:`/agents-api/files#write-a-file`,children:[`Upload `,_jsx(_components.code,{children:`leads.csv`})]}),` first, use a session id from a previous response to continue a conversation, and choose `,_jsx(_components.code,{children:`model`}),` and `,_jsx(_components.code,{children:`provider`}),` from `,_jsx(_components.a,{href:`/agents-api/models`,children:`Models`}),`. Omit optional fields you do not need.`]}),`\n`,_jsxs(_components.p,{children:[`Request bodies are capped at 2 MB; anything larger returns `,_jsx(_components.code,{children:`413 payload_too_large`}),`.`]}),`\n`,_jsx(ParamField,{body:`input`,type:`string`,required:true,id:`param-input`,children:_jsxs(_components.p,{children:[`The message or task, a plain string. There is no image field; to attach files, upload them first and list their paths in `,_jsx(_components.code,{children:`files`}),`. See `,_jsx(_components.a,{href:`/agents-api/sessions`,children:`Sessions`}),` for how history carries across turns.`]})}),`\n`,_jsx(ParamField,{body:`files`,type:`string[]`,post:[`optional`],id:`param-files`,children:_jsxs(_components.p,{children:[`Paths of files on the instance to attach to this turn, typically the `,_jsx(_components.code,{children:`path`}),` returned by `,_jsx(_components.a,{href:`/agents-api/files`,children:_jsx(_components.code,{children:`PUT /v1/files/content`})}),`. Each must name an existing file on the instance, or the call returns `,_jsx(_components.code,{children:`400 validation_error`}),`. The paths are appended to the input, and the agent reads them from disk.`]})}),`\n`,_jsx(ParamField,{body:`session_id`,type:`string`,post:[`optional`],id:`param-session-id`,children:_jsxs(_components.p,{children:[`Continue an existing conversation. Omit it to start a new one; the response returns the new session’s id. The harness owns sessions and creates one on first use, so an id it has not seen simply starts a fresh thread under that id rather than erroring. The exception is a harness that issues its own session ids: `,_jsx(_components.code,{children:`codex`}),`, `,_jsx(_components.code,{children:`grok`}),`, `,_jsx(_components.code,{children:`opencode`}),` and `,_jsx(_components.code,{children:`pi`}),` reject a first turn on an id they did not issue with `,_jsx(_components.code,{children:`400 validation_error`}),` (`,_jsx(_components.code,{children:`param: session_id`}),`), so on those four always start a thread by omitting `,_jsx(_components.code,{children:`session_id`}),` and reuse the id the response returns.`]})}),`\n`,_jsx(ParamField,{body:`stream`,type:`boolean`,default:`false`,post:[`optional`],id:`param-stream`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`true`}),` returns a Server-Sent Events stream; `,_jsx(_components.code,{children:`false`}),` returns the finished response as one JSON body. See `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`Streaming`}),`.`]})}),`\n`,_jsx(ParamField,{body:`model`,type:`string`,post:[`optional`],id:`param-model`,children:_jsxs(_components.p,{children:[`The LLM to run this turn on, an id from `,_jsx(_components.code,{children:`GET /v1/models`}),` (on OpenClaw the ids are `,_jsx(_components.code,{children:`provider/model`}),`). On Hermes it applies to this turn only: omit it and the turn runs on the instance’s default model, whatever earlier turns chose. On OpenClaw a named model is written to the session and sticks for the turns that follow; a turn that omits it leaves the session’s model as is. A `,_jsx(_components.code,{children:`model`}),` OpenClaw does not allow (an id outside `,_jsx(_components.code,{children:`GET /v1/models`}),`) never starts the turn: the response settles with `,_jsx(_components.code,{children:`status: \"failed\"`}),` and `,_jsx(_components.code,{children:`error.code`}),` `,_jsx(_components.code,{children:`agent_error`}),`, with OpenClaw’s reason in `,_jsx(_components.code,{children:`message`}),`, and the session keeps its previous model. See `,_jsx(_components.a,{href:`/agents-api/models`,children:`Models`}),`.`]})}),`\n`,_jsx(ParamField,{body:`provider`,type:`string`,post:[`optional`],id:`param-provider`,children:_jsxs(_components.p,{children:[`The model’s provider, for example `,_jsx(_components.code,{children:`anthropic`}),`. Hermes only, and per turn like `,_jsx(_components.code,{children:`model`}),`: it tells Hermes which configured provider to run the named model on. OpenClaw ignores it (the response still echoes it); there the provider is the prefix of the `,_jsx(_components.code,{children:`provider/model`}),` id you pass as `,_jsx(_components.code,{children:`model`}),`.`]})}),`\n`,_jsxs(ParamField,{body:`reasoning_effort`,type:`string`,post:[`optional`],id:`param-reasoning-effort`,children:[_jsxs(_components.p,{children:[`How hard the model thinks: `,_jsx(_components.code,{children:`none`}),`, `,_jsx(_components.code,{children:`minimal`}),`, `,_jsx(_components.code,{children:`low`}),`, `,_jsx(_components.code,{children:`medium`}),`, `,_jsx(_components.code,{children:`high`}),`, `,_jsx(_components.code,{children:`xhigh`}),`, `,_jsx(_components.code,{children:`max`}),`, or `,_jsx(_components.code,{children:`ultra`}),`. `,_jsx(_components.code,{children:`max`}),` is the strongest plain thinking level; `,_jsx(_components.code,{children:`ultra`}),` is the harness’s own Ultra mode, top thinking plus its agentic orchestration (on OpenClaw it also turns on proactive subagent orchestration). It applies to this turn only on both harnesses. Omit it and Hermes uses the instance’s configured effort, while OpenClaw uses the session’s own thinking level. On OpenClaw the values map one to one onto its thinking levels, with `,_jsx(_components.code,{children:`none`}),` sent as `,_jsx(_components.code,{children:`off`}),`. `,_jsx(_components.code,{children:`max`}),` and `,_jsx(_components.code,{children:`ultra`}),` need gateway `,_jsx(_components.code,{children:`0.10.0`}),`: older instances reject them with `,_jsx(_components.code,{children:`validation_error`}),` until `,_jsx(_components.a,{href:`/agents-api/instances/update`,children:`updated`}),`.`]}),_jsxs(_components.p,{children:[`Codex and OpenCode advertise their levels per model, and a level a model does not accept is run at the nearest level below it rather than failing the turn. The response’s `,_jsx(_components.code,{children:`reasoning_effort`}),` reports the level applied, so read that rather than assuming the request was honoured.`]})]}),`\n`,_jsx(ParamField,{body:`metadata`,type:`object`,post:[`optional`],id:`param-metadata`,children:_jsx(_components.p,{children:`Up to 16 key/value pairs, at most 64 KB serialized. Echoed back on the response object, never interpreted.`})}),`\n`,_jsx(ParamField,{body:`agent`,type:`string`,post:[`optional`],id:`param-agent`,children:_jsxs(_components.p,{children:[`Which agent harness runs the turn, `,_jsx(_components.code,{children:`hermes`}),`, `,_jsx(_components.code,{children:`openclaw`}),`, `,_jsx(_components.code,{children:`claude-code`}),`, `,_jsx(_components.code,{children:`codex`}),`, `,_jsx(_components.code,{children:`grok`}),`, `,_jsx(_components.code,{children:`opencode`}),`, or `,_jsx(_components.code,{children:`pi`}),`. Omit it to use the instance’s configured default (`,_jsx(_components.code,{children:`hermes`}),` on `,_jsx(_components.code,{children:`agent37-hermes`}),`, `,_jsx(_components.code,{children:`openclaw`}),` on `,_jsx(_components.code,{children:`agent37-openclaw`}),`, `,_jsx(_components.code,{children:`claude-code`}),` on `,_jsx(_components.code,{children:`agent37-claude-code`}),`, `,_jsx(_components.code,{children:`codex`}),` on `,_jsx(_components.code,{children:`agent37-codex`}),`, `,_jsx(_components.code,{children:`grok`}),` on `,_jsx(_components.code,{children:`agent37-grok`}),`, `,_jsx(_components.code,{children:`opencode`}),` on `,_jsx(_components.code,{children:`agent37-opencode`}),`, `,_jsx(_components.code,{children:`pi`}),` on `,_jsx(_components.code,{children:`agent37-pi`}),`). Routing is per request: the gateway keeps no session-to-agent binding, so if a session runs on a non-default harness, send `,_jsx(_components.code,{children:`agent`}),` on every turn of it. Targeting a harness the instance was not provisioned with does not reject the call: the turn settles with `,_jsx(_components.code,{children:`status: \"failed\"`}),` and `,_jsx(_components.code,{children:`error.code`}),` `,_jsx(_components.code,{children:`agent_unavailable`}),`.`]})}),`\n`,_jsx(ParamField,{body:`profile`,type:`string`,post:[`optional`],id:`param-profile`,children:_jsxs(_components.p,{children:[`A named setup inside the agent, with its own instructions, skills, memory, config, and sessions, so one instance can host several distinct agents (a support agent and a sales agent, say). Omit it, or send `,_jsx(_components.code,{children:`default`}),`, for the agent’s own setup. Like `,_jsx(_components.code,{children:`agent`}),`, it is per request: send it on every turn of the session, and as `,_jsx(_components.code,{children:`?profile=`}),` on the `,_jsx(_components.a,{href:`/agents-api/sessions#profiles`,children:`session reads`}),`. Supported on `,_jsx(_components.code,{children:`hermes`}),` today; `,_jsx(_components.code,{children:`profile`}),` with any other `,_jsx(_components.code,{children:`agent`}),` is `,_jsx(_components.code,{children:`400 validation_error`}),`. A name that is not lowercase letters, digits, `,_jsx(_components.code,{children:`-`}),` or `,_jsx(_components.code,{children:`_`}),` is `,_jsx(_components.code,{children:`400 validation_error`}),`, and a profile that does not exist on the instance is `,_jsx(_components.code,{children:`404 profile_not_found`}),`.`]})}),`\n`,_jsx(ParamField,{body:`mode`,type:`string`,default:`chat`,post:[`optional`],id:`param-mode`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`chat`}),` runs one turn and replies. `,_jsx(_components.code,{children:`goal`}),` is reserved: sending it returns `,_jsx(_components.code,{children:`400 validation_error`}),` today.`]})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`instance_id`}),` in the body is accepted and ignored. The URL names the instance: one gateway per instance, so there is nothing to route.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsx(_components.p,{children:`The example shows selected fields. The complete response fields are listed below.`}),`\n`,_jsx(_components.p,{children:`The response object. Ids are 32-character hex strings; timestamps from the gateway are epoch milliseconds.`}),`\n`,_jsx(ResponseField,{name:`id`,type:`string`,id:`param-id`,children:_jsx(_components.p,{children:`The response id. Use it to reconnect or cancel the turn.`})}),`\n`,_jsx(ResponseField,{name:`session_id`,type:`string`,id:`param-session-id-1`,children:_jsx(_components.p,{children:`The conversation this turn belongs to. Reuse it on the next call to continue the thread.`})}),`\n`,_jsx(ResponseField,{name:`status`,type:`string`,id:`param-status`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`in_progress`}),`, then a terminal `,_jsx(_components.code,{children:`completed`}),`, `,_jsx(_components.code,{children:`failed`}),`, or `,_jsx(_components.code,{children:`cancelled`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`agent`,type:`string`,id:`param-agent-1`,children:_jsxs(_components.p,{children:[`The agent that ran the turn, `,_jsx(_components.code,{children:`hermes`}),`, `,_jsx(_components.code,{children:`openclaw`}),`, `,_jsx(_components.code,{children:`claude-code`}),`, `,_jsx(_components.code,{children:`codex`}),`, `,_jsx(_components.code,{children:`grok`}),`, `,_jsx(_components.code,{children:`opencode`}),`, or `,_jsx(_components.code,{children:`pi`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`profile`,type:`string | null`,id:`param-profile-1`,children:_jsxs(_components.p,{children:[`The profile the turn ran in, or `,_jsx(_components.code,{children:`null`}),` for the agent’s own setup.`]})}),`\n`,_jsx(ResponseField,{name:`model`,type:`string | null`,id:`param-model-1`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`model`}),` you sent on this request, echoed back. `,_jsx(_components.code,{children:`null`}),` when you omitted it: the turn still ran on the harness’s default or session model, but the gateway does not report which model the harness resolved.`]})}),`\n`,_jsx(ResponseField,{name:`provider`,type:`string | null`,id:`param-provider-1`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`provider`}),` you sent on this request, echoed back; `,_jsx(_components.code,{children:`null`}),` when you omitted it.`]})}),`\n`,_jsxs(ResponseField,{name:`reasoning_effort`,type:`string | null`,id:`param-reasoning-effort-1`,children:[_jsxs(_components.p,{children:[`The reasoning level applied to this turn, which is not always the one you asked for. Every harness takes the same eight levels and maps them onto its own: Hermes and OpenClaw run all eight, Claude Code runs `,_jsx(_components.code,{children:`minimal`}),` as `,_jsx(_components.code,{children:`low`}),`, grok and pi run `,_jsx(_components.code,{children:`ultra`}),` as `,_jsx(_components.code,{children:`max`}),`, and Codex and OpenCode go further and advertise which levels each individual model supports. Rather than reject a turn for a level a model cannot run, the gateway runs it at the nearest level below. Ask OpenCode for `,_jsx(_components.code,{children:`ultra`}),` and you get `,_jsx(_components.code,{children:`max`}),` or lower back. `,_jsx(_components.code,{children:`null`}),` when you sent no level and the harness used its own default: the turn still ran at some effort, but the gateway reports only what it applied.`]}),_jsxs(_components.p,{children:[`This is the level sent to the harness, not a reading taken from the model. A harness that lowers it again on its own is not visible here: Pi clamps to the model’s limits itself, and a non-reasoning Grok model ignores the setting outright. Read it as the ceiling the turn ran under. It also rides the terminal `,_jsx(_components.code,{children:`response.completed`}),` event when you `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`stream`}),`. Needs gateway `,_jsx(_components.code,{children:`0.18.0`}),`; older instances omit the field.`]})]}),`\n`,_jsx(ResponseField,{name:`output_text`,type:`string`,id:`param-output-text`,children:_jsx(_components.p,{children:`The agent’s final answer. Always a string, empty if the turn produced none.`})}),`\n`,_jsx(ResponseField,{name:`usage`,type:`object | null`,id:`param-usage`,children:_jsxs(_components.p,{children:[`Token counts and cost for the turn: `,_jsx(_components.code,{children:`{ input_tokens, output_tokens, cost_usd }`}),`. `,_jsx(_components.code,{children:`cost_usd`}),` is absent or `,_jsx(_components.code,{children:`null`}),` when the provider did not report a cost.`]})}),`\n`,_jsx(ResponseField,{name:`context`,type:`object | null`,id:`param-context`,children:_jsxs(_components.p,{children:[`The session’s context window as of this turn: `,_jsx(_components.code,{children:`{ used_tokens, window_tokens }`}),`, the tokens occupying the model’s window against the window’s size. `,_jsx(_components.code,{children:`null`}),` when the harness didn’t report a measurement; a cancelled turn reports none on either harness. Hermes reports it on every completed turn. OpenClaw reports none, so the gateway derives it from the turn: `,_jsx(_components.code,{children:`used_tokens`}),` is the turn’s token total (input, output, and cache tokens) and `,_jsx(_components.code,{children:`window_tokens`}),` is the model’s context window from OpenClaw’s model catalog, or `,_jsx(_components.code,{children:`128000`}),` (OpenClaw’s own default budget) when the catalog lists no window for the model. On OpenClaw it is `,_jsx(_components.code,{children:`null`}),` when the turn reported no usage, no model, a zero token total, or a model that is not in the catalog.`]})}),`\n`,_jsx(ResponseField,{name:`error`,type:`object | null`,id:`param-error`,children:_jsxs(_components.p,{children:[`Set when the turn failed: `,_jsx(_components.code,{children:`{ code, message, param?, hint? }`}),`. See `,_jsx(_components.a,{href:`/agents-api/errors`,children:`Errors`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`metadata`,type:`object | null`,id:`param-metadata-1`,children:_jsx(_components.p,{children:`Your request metadata, echoed back verbatim.`})}),`\n`,_jsx(ResponseField,{name:`created`,type:`number`,id:`param-created`,children:_jsx(_components.p,{children:`When the turn started, epoch milliseconds.`})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`A failed turn does not reject the HTTP call. The POST still returns 200 with `,_jsx(_components.code,{children:`status: \"failed\"`}),` and `,_jsx(_components.code,{children:`error`}),` set. Branch on `,_jsx(_components.code,{children:`status`}),`, not on the HTTP code.`]})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`On a non-streaming call the gateway sends the `,_jsx(_components.code,{children:`200`}),` and headers as soon as the turn starts, then keeps the connection alive with a whitespace tick every 25 seconds while the agent works. There is no time limit on a turn; the connection stays open until the agent is done. The JSON body arrives when the turn finishes, prefixed by that whitespace. Leading whitespace is valid JSON, so standard parsers handle it unchanged. Don’t treat the early headers as the response being ready. On a sleeping instance no headers arrive at all until the wake completes, so give the request a first-byte timeout of at least three minutes; past the edge’s three-minute wake budget the request gets `,_jsx(_components.code,{children:`503 wake_timeout`}),` instead.`]})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Set `,_jsx(_components.code,{children:`stream: true`}),` to receive Server-Sent Events as the agent reasons, calls tools, and writes its answer. The terminal event carries the final `,_jsx(_components.code,{children:`output_text`}),`, `,_jsx(_components.code,{children:`usage`}),`, and `,_jsx(_components.code,{children:`context`}),`. See `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`Streaming`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`complete-response-example`,children:`Complete response example`}),`\n`,_jsx(CodeBlock,{filename:``,wrap:`true`,numberOfLines:`15`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"c91d2a7e84f04b6f9a3d5e1c0b87f4a2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7f3e0b6c52a949d2b1c4a8e9d0f31726\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"completed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hermes\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"reasoning_effort\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"high\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"output_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"usage\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"input_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1840`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"output_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`920`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"cost_usd\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.0137`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"context\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"used_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`22600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"window_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`256000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"created\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1781136000000`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`continue-a-conversation`,children:`Continue a conversation`}),`\n`,_jsxs(_components.p,{children:[`The first message omits `,_jsx(_components.code,{children:`session_id`}),` and starts a session. The reply returns a `,_jsx(_components.code,{children:`session_id`}),`; pass it on the next message to continue the same thread. The session holds the full history, so you never resend a transcript: you send only the new input.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`curl`,wrap:`true`,numberOfLines:`19`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1. start a session: omit session_id`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\": \"Research the top 3 EV makers, write a memo.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# -> { \"id\": \"c91d2a7e84f04b6f9a3d5e1c0b87f4a2\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# \"session_id\": \"7f3e0b6c52a949d2b1c4a8e9d0f31726\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# \"status\": \"completed\", ... }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 2. continue it: reuse the session_id, send only the new input`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\": \"7f3e0b6c52a949d2b1c4a8e9d0f31726\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\": \"Make it shorter, add a quote.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`python`,wrap:`true`,numberOfLines:`21`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`H `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1. start a session: omit session_id`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`first `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`H,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Research the top 3 EV makers, write a memo.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).json()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 2. continue it: reuse the session_id, send only the new input`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`requests.post(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`H,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: first[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Make it shorter, add a quote.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`node`,wrap:`true`,numberOfLines:`24`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`24`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` H`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"sk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 1. start a session: omit session_id`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` first`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`BASE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/responses`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` H`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Research the top 3 EV makers, write a memo.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 2. continue it: reuse the session_id, send only the new input`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`BASE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/responses`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` H`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` session_id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` first`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Make it shorter, add a quote.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`One active turn per session.`}),` A session runs one response at a time. Sending new input while one is in flight returns `,_jsx(_components.code,{children:`409 session_busy`}),`, normally with the running response’s id in `,_jsx(_components.code,{children:`error.response_id`}),`. Use another session, reattach to the running turn, or cancel it first.`]})}),`\n`,_jsxs(_components.p,{children:[`To list a user’s threads, read a thread’s history, or delete one, see `,_jsx(_components.a,{href:`/agents-api/sessions`,children:`Sessions`}),`. To pick a model per turn, see `,_jsx(_components.a,{href:`/agents-api/models`,children:`Models`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`when-the-agent-needs-a-decision-from-you`,children:`When the agent needs a decision from you`}),`\n`,_jsxs(_components.p,{children:[`The agent asks by ending its turn: the response comes back `,_jsx(_components.code,{children:`completed`}),` with the question (and the options, if any) as `,_jsx(_components.code,{children:`output_text`}),`, and the turn is over. Answer by sending the reply as the next `,_jsx(_components.code,{children:`input`}),` on the same `,_jsx(_components.code,{children:`session_id`}),`. There is no in-turn prompt to answer while a response is `,_jsx(_components.code,{children:`in_progress`}),`, so a chat client needs nothing special: render the question like any other reply, and send the user’s answer like any other message.`]}),`\n`,_jsx(Heading,{level:`3`,id:`when-the-agent-delegates-to-subagents`,children:`When the agent delegates to subagents`}),`\n`,_jsxs(_components.p,{children:[`On Hermes, subagents run inside the turn: the response stays `,_jsx(_components.code,{children:`in_progress`}),` until they finish, and the agent’s final answer, their results included, arrives in that same response. A delegation can run for minutes with nothing on the stream but `,_jsx(_components.code,{children:`:keepalive`}),` comments between the `,_jsx(_components.code,{children:`delegate_task`}),` tool call’s `,_jsx(_components.code,{children:`started`}),` and `,_jsx(_components.code,{children:`completed`}),` events, so keep the connection open or `,_jsx(_components.a,{href:`#follow-up-on-a-response`,children:`reattach`}),`. Cancelling the turn stops the subagents too. This needs gateway `,_jsx(_components.code,{children:`0.15.1`}),`: older instances end the turn as soon as the subagents are dispatched and hand their results to the agent at the start of your next message, until `,_jsx(_components.a,{href:`/agents-api/instances/update`,children:`updated`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`follow-up-on-a-response`,children:`Follow up on a response`}),`\n`,_jsx(_components.p,{children:`Every response has an id you can use after the call returns.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Method`}),_jsx(_components.th,{children:`Path`}),_jsx(_components.th,{children:`Returns`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`GET`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`/v1/responses/{id}/stream`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`200`}),` an SSE stream: replays all events, then attaches live`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`POST`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`/v1/responses/{id}/cancel`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`200`}),` the current response object`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`GET /v1/responses/{id}/stream`}),` replays every event so far in order, then stays attached live, so a dropped connection never loses the answer, including after the turn has finished, while the response is still retained. See `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`Streaming`}),` for the replay window. Lost the id (page reload, new device)? `,_jsx(_components.a,{href:`/agents-api/sessions#retrieve-a-session-with-history`,children:_jsx(_components.code,{children:`GET /v1/sessions/{id}`})}),` returns the running response as `,_jsx(_components.code,{children:`active_response_id`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`POST /v1/responses/{id}/cancel`}),` takes no body and stops a running turn (on OpenClaw it aborts the run inside OpenClaw). It returns 200 with the current response object as soon as the stop is requested, not once the agent has actually stopped, so the body normally still reads `,_jsx(_components.code,{children:`status: \"in_progress\"`}),`; the response settles to `,_jsx(_components.code,{children:`cancelled`}),` when the turn unwinds. To see it end, read `,_jsx(_components.code,{children:`GET /v1/responses/{id}/stream`}),`: a cancelled turn still closes with `,_jsx(_components.code,{children:`response.completed`}),`, carrying the `,_jsx(_components.code,{children:`output_text`}),` accumulated so far. Cancelling a finished response is a no-op that returns its terminal state, still 200.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`curl`,wrap:`true`,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,wrap:`true`,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk_live_...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node`,wrap:`true`,numberOfLines:`13`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"sk_live_...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`text`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`]})})})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Cancel does not rewind. Whatever the agent has already done (files written, emails sent, tools called) is not undone. The response ends with `,_jsx(_components.code,{children:`status: \"cancelled\"`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`status-values`,children:`Status values`}),`\n`,_jsxs(_components.p,{children:[`A response moves from `,_jsx(_components.code,{children:`in_progress`}),` to exactly one terminal status.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:`Meaning`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`in_progress`})}),_jsx(_components.td,{children:`The turn is running.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`completed`})}),_jsxs(_components.td,{children:[`The turn finished and `,_jsx(_components.code,{children:`output_text`}),` holds the answer.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`failed`})}),_jsxs(_components.td,{children:[`The turn ended on an error; `,_jsx(_components.code,{children:`error`}),` says why.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cancelled`})}),_jsxs(_components.td,{children:[`You stopped the turn with `,_jsx(_components.code,{children:`cancel`}),`, or (OpenClaw only) the input was one of OpenClaw’s own stop commands such as `,_jsx(_components.code,{children:`stop`}),` or `,_jsx(_components.code,{children:`exit`}),`, so no run started.`]})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Send a message","description":"Run a turn through an agent template, stream or return its result, and continue the conversation.","api":"POST https://{instanceId}.agent37.app/v1/responses","playground":"simple","authMethod":"key","href":"/agents-api/chat"}}},"mdxSourceWithNoJs":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,ParamField,RequestExample,ResponseExample,ResponseField,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!RequestExample)_missingMdxReference(`RequestExample`,true);if(!ResponseExample)_missingMdxReference(`ResponseExample`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Send a message or task to the agent on your instance. Omit `,_jsx(_components.code,{children:`session_id`}),` to start a conversation.`]}),`\n`,_jsx(`span`,{id:`example`}),`\n`,_jsxs(RequestExample,{children:[_jsx(CodeBlock,{filename:`curl`,wrap:`true`,numberOfLines:`21`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\": \"Summarize the attached spreadsheet.\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"files\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"/home/node/leads.csv\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\": \"7f3e0b6c52a949d2b1c4a8e9d0f31726\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"stream\": false,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\": \"default\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"provider\": \"custom:Agent37\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"reasoning_effort\": \"medium\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"metadata\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\": \"u_882\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"agent\": \"hermes\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"profile\": \"default\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"mode\": \"chat\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,wrap:`true`,numberOfLines:`28`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`28`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app/v1/responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Summarize the attached spreadsheet.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"files\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"/home/node/leads.csv\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7f3e0b6c52a949d2b1c4a8e9d0f31726\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"stream\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"custom:Agent37\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"reasoning_effort\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"medium\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"u_882\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hermes\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"profile\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"mode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"chat\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node`,wrap:`true`,numberOfLines:`31`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`31`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app/v1/responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"sk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"application/json\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Summarize the attached spreadsheet.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"files\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"/home/node/leads.csv\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"7f3e0b6c52a949d2b1c4a8e9d0f31726\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"stream\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"custom:Agent37\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"reasoning_effort\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"medium\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"u_882\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"hermes\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"profile\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"mode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"chat\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`text`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`]})})})]}),`\n`,_jsx(ResponseExample,{children:_jsx(CodeBlock,{filename:`200 (excerpt)`,wrap:`true`,numberOfLines:`6`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"c91d2a7e84f04b6f9a3d5e1c0b87f4a2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7f3e0b6c52a949d2b1c4a8e9d0f31726\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"completed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"output_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The spreadsheet lists your leads.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`POST /v1/responses`}),` runs a turn on templates that include the Agent API. You make it against your instance, not against `,_jsx(_components.code,{children:`api.agent37.com`}),`: agent templates serve their chat API at `,_jsx(_components.code,{children:`https://{instanceId}.agent37.app`}),`, the `,_jsx(_components.code,{children:`url`}),` of the default port in the create response. This page uses `,_jsx(_components.code,{children:`https://ab12cd34ef.agent37.app`}),`. Authenticate with the same `,_jsx(_components.code,{children:`sk_live_`}),` key you use on the Sandbox API, sent as the `,_jsx(_components.code,{children:`X-Agent37-Key`}),` header.`]}),`\n`,_jsx(_components.p,{children:`The call is agentic by default: the agent can browse, run code, use a terminal, read and write files, call connected tools, and reason across many steps before answering.`}),`\n`,_jsx(Heading,{level:`2`,id:`request-body`,children:`Request body`}),`\n`,_jsxs(_components.p,{children:[`The example shows all request fields for Hermes. `,_jsxs(_components.a,{href:`/agents-api/files#write-a-file`,children:[`Upload `,_jsx(_components.code,{children:`leads.csv`})]}),` first, use a session id from a previous response to continue a conversation, and choose `,_jsx(_components.code,{children:`model`}),` and `,_jsx(_components.code,{children:`provider`}),` from `,_jsx(_components.a,{href:`/agents-api/models`,children:`Models`}),`. Omit optional fields you do not need.`]}),`\n`,_jsxs(_components.p,{children:[`Request bodies are capped at 2 MB; anything larger returns `,_jsx(_components.code,{children:`413 payload_too_large`}),`.`]}),`\n`,_jsx(ParamField,{body:`input`,type:`string`,required:true,id:`param-input`,children:_jsxs(_components.p,{children:[`The message or task, a plain string. There is no image field; to attach files, upload them first and list their paths in `,_jsx(_components.code,{children:`files`}),`. See `,_jsx(_components.a,{href:`/agents-api/sessions`,children:`Sessions`}),` for how history carries across turns.`]})}),`\n`,_jsx(ParamField,{body:`files`,type:`string[]`,post:[`optional`],id:`param-files`,children:_jsxs(_components.p,{children:[`Paths of files on the instance to attach to this turn, typically the `,_jsx(_components.code,{children:`path`}),` returned by `,_jsx(_components.a,{href:`/agents-api/files`,children:_jsx(_components.code,{children:`PUT /v1/files/content`})}),`. Each must name an existing file on the instance, or the call returns `,_jsx(_components.code,{children:`400 validation_error`}),`. The paths are appended to the input, and the agent reads them from disk.`]})}),`\n`,_jsx(ParamField,{body:`session_id`,type:`string`,post:[`optional`],id:`param-session-id`,children:_jsxs(_components.p,{children:[`Continue an existing conversation. Omit it to start a new one; the response returns the new session’s id. The harness owns sessions and creates one on first use, so an id it has not seen simply starts a fresh thread under that id rather than erroring. The exception is a harness that issues its own session ids: `,_jsx(_components.code,{children:`codex`}),`, `,_jsx(_components.code,{children:`grok`}),`, `,_jsx(_components.code,{children:`opencode`}),` and `,_jsx(_components.code,{children:`pi`}),` reject a first turn on an id they did not issue with `,_jsx(_components.code,{children:`400 validation_error`}),` (`,_jsx(_components.code,{children:`param: session_id`}),`), so on those four always start a thread by omitting `,_jsx(_components.code,{children:`session_id`}),` and reuse the id the response returns.`]})}),`\n`,_jsx(ParamField,{body:`stream`,type:`boolean`,default:`false`,post:[`optional`],id:`param-stream`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`true`}),` returns a Server-Sent Events stream; `,_jsx(_components.code,{children:`false`}),` returns the finished response as one JSON body. See `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`Streaming`}),`.`]})}),`\n`,_jsx(ParamField,{body:`model`,type:`string`,post:[`optional`],id:`param-model`,children:_jsxs(_components.p,{children:[`The LLM to run this turn on, an id from `,_jsx(_components.code,{children:`GET /v1/models`}),` (on OpenClaw the ids are `,_jsx(_components.code,{children:`provider/model`}),`). On Hermes it applies to this turn only: omit it and the turn runs on the instance’s default model, whatever earlier turns chose. On OpenClaw a named model is written to the session and sticks for the turns that follow; a turn that omits it leaves the session’s model as is. A `,_jsx(_components.code,{children:`model`}),` OpenClaw does not allow (an id outside `,_jsx(_components.code,{children:`GET /v1/models`}),`) never starts the turn: the response settles with `,_jsx(_components.code,{children:`status: \"failed\"`}),` and `,_jsx(_components.code,{children:`error.code`}),` `,_jsx(_components.code,{children:`agent_error`}),`, with OpenClaw’s reason in `,_jsx(_components.code,{children:`message`}),`, and the session keeps its previous model. See `,_jsx(_components.a,{href:`/agents-api/models`,children:`Models`}),`.`]})}),`\n`,_jsx(ParamField,{body:`provider`,type:`string`,post:[`optional`],id:`param-provider`,children:_jsxs(_components.p,{children:[`The model’s provider, for example `,_jsx(_components.code,{children:`anthropic`}),`. Hermes only, and per turn like `,_jsx(_components.code,{children:`model`}),`: it tells Hermes which configured provider to run the named model on. OpenClaw ignores it (the response still echoes it); there the provider is the prefix of the `,_jsx(_components.code,{children:`provider/model`}),` id you pass as `,_jsx(_components.code,{children:`model`}),`.`]})}),`\n`,_jsxs(ParamField,{body:`reasoning_effort`,type:`string`,post:[`optional`],id:`param-reasoning-effort`,children:[_jsxs(_components.p,{children:[`How hard the model thinks: `,_jsx(_components.code,{children:`none`}),`, `,_jsx(_components.code,{children:`minimal`}),`, `,_jsx(_components.code,{children:`low`}),`, `,_jsx(_components.code,{children:`medium`}),`, `,_jsx(_components.code,{children:`high`}),`, `,_jsx(_components.code,{children:`xhigh`}),`, `,_jsx(_components.code,{children:`max`}),`, or `,_jsx(_components.code,{children:`ultra`}),`. `,_jsx(_components.code,{children:`max`}),` is the strongest plain thinking level; `,_jsx(_components.code,{children:`ultra`}),` is the harness’s own Ultra mode, top thinking plus its agentic orchestration (on OpenClaw it also turns on proactive subagent orchestration). It applies to this turn only on both harnesses. Omit it and Hermes uses the instance’s configured effort, while OpenClaw uses the session’s own thinking level. On OpenClaw the values map one to one onto its thinking levels, with `,_jsx(_components.code,{children:`none`}),` sent as `,_jsx(_components.code,{children:`off`}),`. `,_jsx(_components.code,{children:`max`}),` and `,_jsx(_components.code,{children:`ultra`}),` need gateway `,_jsx(_components.code,{children:`0.10.0`}),`: older instances reject them with `,_jsx(_components.code,{children:`validation_error`}),` until `,_jsx(_components.a,{href:`/agents-api/instances/update`,children:`updated`}),`.`]}),_jsxs(_components.p,{children:[`Codex and OpenCode advertise their levels per model, and a level a model does not accept is run at the nearest level below it rather than failing the turn. The response’s `,_jsx(_components.code,{children:`reasoning_effort`}),` reports the level applied, so read that rather than assuming the request was honoured.`]})]}),`\n`,_jsx(ParamField,{body:`metadata`,type:`object`,post:[`optional`],id:`param-metadata`,children:_jsx(_components.p,{children:`Up to 16 key/value pairs, at most 64 KB serialized. Echoed back on the response object, never interpreted.`})}),`\n`,_jsx(ParamField,{body:`agent`,type:`string`,post:[`optional`],id:`param-agent`,children:_jsxs(_components.p,{children:[`Which agent harness runs the turn, `,_jsx(_components.code,{children:`hermes`}),`, `,_jsx(_components.code,{children:`openclaw`}),`, `,_jsx(_components.code,{children:`claude-code`}),`, `,_jsx(_components.code,{children:`codex`}),`, `,_jsx(_components.code,{children:`grok`}),`, `,_jsx(_components.code,{children:`opencode`}),`, or `,_jsx(_components.code,{children:`pi`}),`. Omit it to use the instance’s configured default (`,_jsx(_components.code,{children:`hermes`}),` on `,_jsx(_components.code,{children:`agent37-hermes`}),`, `,_jsx(_components.code,{children:`openclaw`}),` on `,_jsx(_components.code,{children:`agent37-openclaw`}),`, `,_jsx(_components.code,{children:`claude-code`}),` on `,_jsx(_components.code,{children:`agent37-claude-code`}),`, `,_jsx(_components.code,{children:`codex`}),` on `,_jsx(_components.code,{children:`agent37-codex`}),`, `,_jsx(_components.code,{children:`grok`}),` on `,_jsx(_components.code,{children:`agent37-grok`}),`, `,_jsx(_components.code,{children:`opencode`}),` on `,_jsx(_components.code,{children:`agent37-opencode`}),`, `,_jsx(_components.code,{children:`pi`}),` on `,_jsx(_components.code,{children:`agent37-pi`}),`). Routing is per request: the gateway keeps no session-to-agent binding, so if a session runs on a non-default harness, send `,_jsx(_components.code,{children:`agent`}),` on every turn of it. Targeting a harness the instance was not provisioned with does not reject the call: the turn settles with `,_jsx(_components.code,{children:`status: \"failed\"`}),` and `,_jsx(_components.code,{children:`error.code`}),` `,_jsx(_components.code,{children:`agent_unavailable`}),`.`]})}),`\n`,_jsx(ParamField,{body:`profile`,type:`string`,post:[`optional`],id:`param-profile`,children:_jsxs(_components.p,{children:[`A named setup inside the agent, with its own instructions, skills, memory, config, and sessions, so one instance can host several distinct agents (a support agent and a sales agent, say). Omit it, or send `,_jsx(_components.code,{children:`default`}),`, for the agent’s own setup. Like `,_jsx(_components.code,{children:`agent`}),`, it is per request: send it on every turn of the session, and as `,_jsx(_components.code,{children:`?profile=`}),` on the `,_jsx(_components.a,{href:`/agents-api/sessions#profiles`,children:`session reads`}),`. Supported on `,_jsx(_components.code,{children:`hermes`}),` today; `,_jsx(_components.code,{children:`profile`}),` with any other `,_jsx(_components.code,{children:`agent`}),` is `,_jsx(_components.code,{children:`400 validation_error`}),`. A name that is not lowercase letters, digits, `,_jsx(_components.code,{children:`-`}),` or `,_jsx(_components.code,{children:`_`}),` is `,_jsx(_components.code,{children:`400 validation_error`}),`, and a profile that does not exist on the instance is `,_jsx(_components.code,{children:`404 profile_not_found`}),`.`]})}),`\n`,_jsx(ParamField,{body:`mode`,type:`string`,default:`chat`,post:[`optional`],id:`param-mode`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`chat`}),` runs one turn and replies. `,_jsx(_components.code,{children:`goal`}),` is reserved: sending it returns `,_jsx(_components.code,{children:`400 validation_error`}),` today.`]})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`instance_id`}),` in the body is accepted and ignored. The URL names the instance: one gateway per instance, so there is nothing to route.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsx(_components.p,{children:`The example shows selected fields. The complete response fields are listed below.`}),`\n`,_jsx(_components.p,{children:`The response object. Ids are 32-character hex strings; timestamps from the gateway are epoch milliseconds.`}),`\n`,_jsx(ResponseField,{name:`id`,type:`string`,id:`param-id`,children:_jsx(_components.p,{children:`The response id. Use it to reconnect or cancel the turn.`})}),`\n`,_jsx(ResponseField,{name:`session_id`,type:`string`,id:`param-session-id-1`,children:_jsx(_components.p,{children:`The conversation this turn belongs to. Reuse it on the next call to continue the thread.`})}),`\n`,_jsx(ResponseField,{name:`status`,type:`string`,id:`param-status`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`in_progress`}),`, then a terminal `,_jsx(_components.code,{children:`completed`}),`, `,_jsx(_components.code,{children:`failed`}),`, or `,_jsx(_components.code,{children:`cancelled`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`agent`,type:`string`,id:`param-agent-1`,children:_jsxs(_components.p,{children:[`The agent that ran the turn, `,_jsx(_components.code,{children:`hermes`}),`, `,_jsx(_components.code,{children:`openclaw`}),`, `,_jsx(_components.code,{children:`claude-code`}),`, `,_jsx(_components.code,{children:`codex`}),`, `,_jsx(_components.code,{children:`grok`}),`, `,_jsx(_components.code,{children:`opencode`}),`, or `,_jsx(_components.code,{children:`pi`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`profile`,type:`string | null`,id:`param-profile-1`,children:_jsxs(_components.p,{children:[`The profile the turn ran in, or `,_jsx(_components.code,{children:`null`}),` for the agent’s own setup.`]})}),`\n`,_jsx(ResponseField,{name:`model`,type:`string | null`,id:`param-model-1`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`model`}),` you sent on this request, echoed back. `,_jsx(_components.code,{children:`null`}),` when you omitted it: the turn still ran on the harness’s default or session model, but the gateway does not report which model the harness resolved.`]})}),`\n`,_jsx(ResponseField,{name:`provider`,type:`string | null`,id:`param-provider-1`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`provider`}),` you sent on this request, echoed back; `,_jsx(_components.code,{children:`null`}),` when you omitted it.`]})}),`\n`,_jsxs(ResponseField,{name:`reasoning_effort`,type:`string | null`,id:`param-reasoning-effort-1`,children:[_jsxs(_components.p,{children:[`The reasoning level applied to this turn, which is not always the one you asked for. Every harness takes the same eight levels and maps them onto its own: Hermes and OpenClaw run all eight, Claude Code runs `,_jsx(_components.code,{children:`minimal`}),` as `,_jsx(_components.code,{children:`low`}),`, grok and pi run `,_jsx(_components.code,{children:`ultra`}),` as `,_jsx(_components.code,{children:`max`}),`, and Codex and OpenCode go further and advertise which levels each individual model supports. Rather than reject a turn for a level a model cannot run, the gateway runs it at the nearest level below. Ask OpenCode for `,_jsx(_components.code,{children:`ultra`}),` and you get `,_jsx(_components.code,{children:`max`}),` or lower back. `,_jsx(_components.code,{children:`null`}),` when you sent no level and the harness used its own default: the turn still ran at some effort, but the gateway reports only what it applied.`]}),_jsxs(_components.p,{children:[`This is the level sent to the harness, not a reading taken from the model. A harness that lowers it again on its own is not visible here: Pi clamps to the model’s limits itself, and a non-reasoning Grok model ignores the setting outright. Read it as the ceiling the turn ran under. It also rides the terminal `,_jsx(_components.code,{children:`response.completed`}),` event when you `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`stream`}),`. Needs gateway `,_jsx(_components.code,{children:`0.18.0`}),`; older instances omit the field.`]})]}),`\n`,_jsx(ResponseField,{name:`output_text`,type:`string`,id:`param-output-text`,children:_jsx(_components.p,{children:`The agent’s final answer. Always a string, empty if the turn produced none.`})}),`\n`,_jsx(ResponseField,{name:`usage`,type:`object | null`,id:`param-usage`,children:_jsxs(_components.p,{children:[`Token counts and cost for the turn: `,_jsx(_components.code,{children:`{ input_tokens, output_tokens, cost_usd }`}),`. `,_jsx(_components.code,{children:`cost_usd`}),` is absent or `,_jsx(_components.code,{children:`null`}),` when the provider did not report a cost.`]})}),`\n`,_jsx(ResponseField,{name:`context`,type:`object | null`,id:`param-context`,children:_jsxs(_components.p,{children:[`The session’s context window as of this turn: `,_jsx(_components.code,{children:`{ used_tokens, window_tokens }`}),`, the tokens occupying the model’s window against the window’s size. `,_jsx(_components.code,{children:`null`}),` when the harness didn’t report a measurement; a cancelled turn reports none on either harness. Hermes reports it on every completed turn. OpenClaw reports none, so the gateway derives it from the turn: `,_jsx(_components.code,{children:`used_tokens`}),` is the turn’s token total (input, output, and cache tokens) and `,_jsx(_components.code,{children:`window_tokens`}),` is the model’s context window from OpenClaw’s model catalog, or `,_jsx(_components.code,{children:`128000`}),` (OpenClaw’s own default budget) when the catalog lists no window for the model. On OpenClaw it is `,_jsx(_components.code,{children:`null`}),` when the turn reported no usage, no model, a zero token total, or a model that is not in the catalog.`]})}),`\n`,_jsx(ResponseField,{name:`error`,type:`object | null`,id:`param-error`,children:_jsxs(_components.p,{children:[`Set when the turn failed: `,_jsx(_components.code,{children:`{ code, message, param?, hint? }`}),`. See `,_jsx(_components.a,{href:`/agents-api/errors`,children:`Errors`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`metadata`,type:`object | null`,id:`param-metadata-1`,children:_jsx(_components.p,{children:`Your request metadata, echoed back verbatim.`})}),`\n`,_jsx(ResponseField,{name:`created`,type:`number`,id:`param-created`,children:_jsx(_components.p,{children:`When the turn started, epoch milliseconds.`})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`A failed turn does not reject the HTTP call. The POST still returns 200 with `,_jsx(_components.code,{children:`status: \"failed\"`}),` and `,_jsx(_components.code,{children:`error`}),` set. Branch on `,_jsx(_components.code,{children:`status`}),`, not on the HTTP code.`]})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`On a non-streaming call the gateway sends the `,_jsx(_components.code,{children:`200`}),` and headers as soon as the turn starts, then keeps the connection alive with a whitespace tick every 25 seconds while the agent works. There is no time limit on a turn; the connection stays open until the agent is done. The JSON body arrives when the turn finishes, prefixed by that whitespace. Leading whitespace is valid JSON, so standard parsers handle it unchanged. Don’t treat the early headers as the response being ready. On a sleeping instance no headers arrive at all until the wake completes, so give the request a first-byte timeout of at least three minutes; past the edge’s three-minute wake budget the request gets `,_jsx(_components.code,{children:`503 wake_timeout`}),` instead.`]})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Set `,_jsx(_components.code,{children:`stream: true`}),` to receive Server-Sent Events as the agent reasons, calls tools, and writes its answer. The terminal event carries the final `,_jsx(_components.code,{children:`output_text`}),`, `,_jsx(_components.code,{children:`usage`}),`, and `,_jsx(_components.code,{children:`context`}),`. See `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`Streaming`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`complete-response-example`,children:`Complete response example`}),`\n`,_jsx(CodeBlock,{filename:``,wrap:`true`,numberOfLines:`15`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"c91d2a7e84f04b6f9a3d5e1c0b87f4a2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7f3e0b6c52a949d2b1c4a8e9d0f31726\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"completed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hermes\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"reasoning_effort\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"high\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"output_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"usage\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"input_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1840`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"output_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`920`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"cost_usd\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.0137`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"context\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"used_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`22600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"window_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`256000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"created\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1781136000000`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`continue-a-conversation`,children:`Continue a conversation`}),`\n`,_jsxs(_components.p,{children:[`The first message omits `,_jsx(_components.code,{children:`session_id`}),` and starts a session. The reply returns a `,_jsx(_components.code,{children:`session_id`}),`; pass it on the next message to continue the same thread. The session holds the full history, so you never resend a transcript: you send only the new input.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`curl`,wrap:`true`,numberOfLines:`19`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1. start a session: omit session_id`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\": \"Research the top 3 EV makers, write a memo.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# -> { \"id\": \"c91d2a7e84f04b6f9a3d5e1c0b87f4a2\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# \"session_id\": \"7f3e0b6c52a949d2b1c4a8e9d0f31726\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# \"status\": \"completed\", ... }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 2. continue it: reuse the session_id, send only the new input`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\": \"7f3e0b6c52a949d2b1c4a8e9d0f31726\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\": \"Make it shorter, add a quote.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`python`,wrap:`true`,numberOfLines:`21`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`H `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1. start a session: omit session_id`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`first `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`H,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Research the top 3 EV makers, write a memo.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).json()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 2. continue it: reuse the session_id, send only the new input`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`requests.post(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`H,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: first[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Make it shorter, add a quote.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`node`,wrap:`true`,numberOfLines:`24`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`24`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` H`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"sk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 1. start a session: omit session_id`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` first`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`BASE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/responses`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` H`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Research the top 3 EV makers, write a memo.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 2. continue it: reuse the session_id, send only the new input`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`BASE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/responses`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` H`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` session_id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` first`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Make it shorter, add a quote.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`One active turn per session.`}),` A session runs one response at a time. Sending new input while one is in flight returns `,_jsx(_components.code,{children:`409 session_busy`}),`, normally with the running response’s id in `,_jsx(_components.code,{children:`error.response_id`}),`. Use another session, reattach to the running turn, or cancel it first.`]})}),`\n`,_jsxs(_components.p,{children:[`To list a user’s threads, read a thread’s history, or delete one, see `,_jsx(_components.a,{href:`/agents-api/sessions`,children:`Sessions`}),`. To pick a model per turn, see `,_jsx(_components.a,{href:`/agents-api/models`,children:`Models`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`when-the-agent-needs-a-decision-from-you`,children:`When the agent needs a decision from you`}),`\n`,_jsxs(_components.p,{children:[`The agent asks by ending its turn: the response comes back `,_jsx(_components.code,{children:`completed`}),` with the question (and the options, if any) as `,_jsx(_components.code,{children:`output_text`}),`, and the turn is over. Answer by sending the reply as the next `,_jsx(_components.code,{children:`input`}),` on the same `,_jsx(_components.code,{children:`session_id`}),`. There is no in-turn prompt to answer while a response is `,_jsx(_components.code,{children:`in_progress`}),`, so a chat client needs nothing special: render the question like any other reply, and send the user’s answer like any other message.`]}),`\n`,_jsx(Heading,{level:`3`,id:`when-the-agent-delegates-to-subagents`,children:`When the agent delegates to subagents`}),`\n`,_jsxs(_components.p,{children:[`On Hermes, subagents run inside the turn: the response stays `,_jsx(_components.code,{children:`in_progress`}),` until they finish, and the agent’s final answer, their results included, arrives in that same response. A delegation can run for minutes with nothing on the stream but `,_jsx(_components.code,{children:`:keepalive`}),` comments between the `,_jsx(_components.code,{children:`delegate_task`}),` tool call’s `,_jsx(_components.code,{children:`started`}),` and `,_jsx(_components.code,{children:`completed`}),` events, so keep the connection open or `,_jsx(_components.a,{href:`#follow-up-on-a-response`,children:`reattach`}),`. Cancelling the turn stops the subagents too. This needs gateway `,_jsx(_components.code,{children:`0.15.1`}),`: older instances end the turn as soon as the subagents are dispatched and hand their results to the agent at the start of your next message, until `,_jsx(_components.a,{href:`/agents-api/instances/update`,children:`updated`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`follow-up-on-a-response`,children:`Follow up on a response`}),`\n`,_jsx(_components.p,{children:`Every response has an id you can use after the call returns.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Method`}),_jsx(_components.th,{children:`Path`}),_jsx(_components.th,{children:`Returns`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`GET`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`/v1/responses/{id}/stream`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`200`}),` an SSE stream: replays all events, then attaches live`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`POST`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`/v1/responses/{id}/cancel`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`200`}),` the current response object`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`GET /v1/responses/{id}/stream`}),` replays every event so far in order, then stays attached live, so a dropped connection never loses the answer, including after the turn has finished, while the response is still retained. See `,_jsx(_components.a,{href:`/agents-api/streaming`,children:`Streaming`}),` for the replay window. Lost the id (page reload, new device)? `,_jsx(_components.a,{href:`/agents-api/sessions#retrieve-a-session-with-history`,children:_jsx(_components.code,{children:`GET /v1/sessions/{id}`})}),` returns the running response as `,_jsx(_components.code,{children:`active_response_id`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`POST /v1/responses/{id}/cancel`}),` takes no body and stops a running turn (on OpenClaw it aborts the run inside OpenClaw). It returns 200 with the current response object as soon as the stop is requested, not once the agent has actually stopped, so the body normally still reads `,_jsx(_components.code,{children:`status: \"in_progress\"`}),`; the response settles to `,_jsx(_components.code,{children:`cancelled`}),` when the turn unwinds. To see it end, read `,_jsx(_components.code,{children:`GET /v1/responses/{id}/stream`}),`: a cancelled turn still closes with `,_jsx(_components.code,{children:`response.completed`}),`, carrying the `,_jsx(_components.code,{children:`output_text`}),` accumulated so far. Cancelling a finished response is a no-op that returns its terminal state, still 200.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`curl`,wrap:`true`,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key: sk_live_...\"`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,wrap:`true`,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk_live_...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node`,wrap:`true`,numberOfLines:`13`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://ab12cd34ef.agent37.app/v1/responses/c91d2a7e84f04b6f9a3d5e1c0b87f4a2/cancel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Agent37-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"sk_live_...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`text`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`]})})})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Cancel does not rewind. Whatever the agent has already done (files written, emails sent, tools called) is not undone. The response ends with `,_jsx(_components.code,{children:`status: \"cancelled\"`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`status-values`,children:`Status values`}),`\n`,_jsxs(_components.p,{children:[`A response moves from `,_jsx(_components.code,{children:`in_progress`}),` to exactly one terminal status.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:`Meaning`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`in_progress`})}),_jsx(_components.td,{children:`The turn is running.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`completed`})}),_jsxs(_components.td,{children:[`The turn finished and `,_jsx(_components.code,{children:`output_text`}),` holds the answer.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`failed`})}),_jsxs(_components.td,{children:[`The turn ended on an error; `,_jsx(_components.code,{children:`error`}),` says why.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cancelled`})}),_jsxs(_components.td,{children:[`You stopped the turn with `,_jsx(_components.code,{children:`cancel`}),`, or (OpenClaw only) the input was one of OpenClaw’s own stop commands such as `,_jsx(_components.code,{children:`stop`}),` or `,_jsx(_components.code,{children:`exit`}),`, so no run started.`]})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Send a message","description":"Run a turn through an agent template, stream or return its result, and continue the conversation.","api":"POST https://{instanceId}.agent37.app/v1/responses","playground":"simple","authMethod":"key","href":"/agents-api/chat"}}}},"mdxExtracts":{"tableOfContents":[{"title":"Request body","slug":"request-body","depth":2,"children":[]},{"title":"Response","slug":"response","depth":2,"children":[]},{"title":"Complete response example","slug":"complete-response-example","depth":2,"children":[]},{"title":"Continue a conversation","slug":"continue-a-conversation","depth":2,"children":[{"title":"When the agent needs a decision from you","slug":"when-the-agent-needs-a-decision-from-you","depth":3,"children":[]},{"title":"When the agent delegates to subagents","slug":"when-the-agent-delegates-to-subagents","depth":3,"children":[]}]},{"title":"Follow up on a response","slug":"follow-up-on-a-response","depth":2,"children":[]},{"title":"Status values","slug":"status-values","depth":2,"children":[]}],"codeExamples":{"request":{"type":"RequestExample","children":[{"filename":"curl","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"shellscript\">\u003ccode language=\"shellscript\" numberOfLines=\"21\">\u003cspan class=\"line\">\u003cspan style=\"color:#953800;--shiki-dark:#DCDCAA\">curl\u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\"> -X\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> POST\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> https://ab12cd34ef.agent37.app/v1/responses\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\"> -H\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"X-Agent37-Key: sk_live_...\"\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\"> -H\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"Content-Type: application/json\"\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D7BA7D\"> \\\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\"> -d\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> '{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"input\": \"Summarize the attached spreadsheet.\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"files\": [\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"/home/node/leads.csv\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> ],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"session_id\": \"7f3e0b6c52a949d2b1c4a8e9d0f31726\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"stream\": false,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"model\": \"default\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"provider\": \"custom:Agent37\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"reasoning_effort\": \"medium\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"metadata\": {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"user\": \"u_882\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"agent\": \"hermes\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"profile\": \"default\",\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"mode\": \"chat\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> }'\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"},{"filename":"Python","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"python\">\u003ccode language=\"python\" numberOfLines=\"28\">\u003cspan class=\"line\">\u003cspan style=\"color:#CF222E;--shiki-dark:#C586C0\">import\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> requests\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">response \u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> requests.post(\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"https://ab12cd34ef.agent37.app/v1/responses\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#953800;--shiki-dark:#9CDCFE\"> headers\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"X-Agent37-Key\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"sk_live_...\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"Content-Type\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"application/json\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#953800;--shiki-dark:#9CDCFE\"> json\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D4D4D4\">=\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"input\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"Summarize the attached spreadsheet.\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"files\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: [\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"/home/node/leads.csv\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> ],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"session_id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"7f3e0b6c52a949d2b1c4a8e9d0f31726\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"stream\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\">False\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"model\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"default\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"provider\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"custom:Agent37\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"reasoning_effort\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"medium\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"metadata\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"user\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"u_882\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"agent\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"hermes\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"profile\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"default\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"mode\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"chat\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">)\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">response.raise_for_status()\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0550AE;--shiki-dark:#DCDCAA\">print\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">(response.json())\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"},{"filename":"Node","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"javascript\">\u003ccode language=\"javascript\" numberOfLines=\"31\">\u003cspan class=\"line\">\u003cspan style=\"color:#CF222E;--shiki-dark:#569CD6\">const\u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#4FC1FF\"> response\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D4D4D4\"> =\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#C586C0\"> await\u003c/span>\u003cspan style=\"color:#8250DF;--shiki-dark:#DCDCAA\"> fetch\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">(\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"https://ab12cd34ef.agent37.app/v1/responses\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\"> method:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"POST\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\"> headers:\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"X-Agent37-Key\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"sk_live_...\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"Content-Type\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"application/json\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\"> body:\u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#4FC1FF\"> JSON\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#8250DF;--shiki-dark:#DCDCAA\">stringify\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">({\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"input\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"Summarize the attached spreadsheet.\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"files\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> [\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"/home/node/leads.csv\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> ],\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"session_id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"7f3e0b6c52a949d2b1c4a8e9d0f31726\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"stream\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\"> false\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"model\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"default\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"provider\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"custom:Agent37\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"reasoning_effort\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"medium\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"metadata\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"user\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"u_882\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"agent\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"hermes\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"profile\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"default\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"mode\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">:\u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\"> \"chat\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> }),\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">);\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CF222E;--shiki-dark:#C586C0\">if\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> (\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#D4D4D4\">!\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">response\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">ok\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">) {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#CF222E;--shiki-dark:#C586C0\"> throw\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#569CD6\"> new\u003c/span>\u003cspan style=\"color:#8250DF;--shiki-dark:#DCDCAA\"> Error\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">(\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#C586C0\">await\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\"> response\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#8250DF;--shiki-dark:#DCDCAA\">text\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">());\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\">console\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#8250DF;--shiki-dark:#DCDCAA\">log\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">(\u003c/span>\u003cspan style=\"color:#CF222E;--shiki-dark:#C586C0\">await\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#9CDCFE\"> response\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">.\u003c/span>\u003cspan style=\"color:#8250DF;--shiki-dark:#DCDCAA\">json\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">());\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]},"response":{"type":"ResponseExample","children":[{"filename":"200 (excerpt)","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"json\">\u003ccode language=\"json\" numberOfLines=\"6\">\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"c91d2a7e84f04b6f9a3d5e1c0b87f4a2\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"session_id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"7f3e0b6c52a949d2b1c4a8e9d0f31726\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"status\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"completed\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"output_text\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"The spreadsheet lists your leads.\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]}},"endpoint":{"title":"Send a message","path":"/v1/responses","servers":[{"url":"https://{instanceid}.agent37.app"}],"method":"post","request":{"security":[{"title":"API Key Auth","parameters":{"header":{"X-Agent37-Key":{"type":"apiKey"}},"query":{},"cookie":{}}}],"parameters":{"query":{},"header":{},"cookie":{},"path":{}},"body":{"application/json":{"schemaArray":[{"type":"object","properties":{"input":[{"type":"string","description":"The message or task, a plain string. There is no image field; to attach files, upload them first and list their paths in `files` . See Sessions for how history carries across turns.","required":true}],"files":[{"type":"array","items":[{"type":"string"}],"description":"Paths of files on the instance to attach to this turn, typically the `path` returned by `PUT /v1/files/content` . Each must name an existing file on the instance, or the call returns `400 validation_error` . The paths are appended to the input, and the agent reads them from disk."}],"session_id":[{"type":"string","description":"Continue an existing conversation. Omit it to start a new one; the response returns the new session’s id. The harness owns sessions and creates one on first use, so an id it has not seen simply starts a fresh thread under that id rather than erroring. The exception is a harness that issues its own session ids: `codex` , `grok` , `opencode` and `pi` reject a first turn on an id they did not issue with `400 validation_error` ( `param: session_id` ), so on those four always start a thread by omitting `session_id` and reuse the id the response returns."}],"stream":[{"type":"boolean","description":"`true` returns a Server-Sent Events stream; `false` returns the finished response as one JSON body. See Streaming ."}],"model":[{"type":"string","description":"The LLM to run this turn on, an id from `GET /v1/models` (on OpenClaw the ids are `provider/model` ). On Hermes it applies to this turn only: omit it and the turn runs on the instance’s default model, whatever earlier turns chose. On OpenClaw a named model is written to the session and sticks for the turns that follow; a turn that omits it leaves the session’s model as is. A `model` OpenClaw does not allow (an id outside `GET /v1/models` ) never starts the turn: the response settles with `status: \"failed\"` and `error.code` `agent_error` , with OpenClaw’s reason in `message` , and the session keeps its previous model. See Models ."}],"provider":[{"type":"string","description":"The model’s provider, for example `anthropic` . Hermes only, and per turn like `model` : it tells Hermes which configured provider to run the named model on. OpenClaw ignores it (the response still echoes it); there the provider is the prefix of the `provider/model` id you pass as `model` ."}],"reasoning_effort":[{"type":"string","description":"How hard the model thinks: `none` , `minimal` , `low` , `medium` , `high` , `xhigh` , `max` , or `ultra` . `max` is the strongest plain thinking level; `ultra` is the harness’s own Ultra mode, top thinking plus its agentic orchestration (on OpenClaw it also turns on proactive subagent orchestration). It applies to this turn only on both harnesses. Omit it and Hermes uses the instance’s configured effort, while OpenClaw uses the session’s own thinking level. On OpenClaw the values map one to one onto its thinking levels, with `none` sent as `off` . `max` and `ultra` need gateway `0.10.0` : older instances reject them with `validation_error` until updated . Codex and OpenCode advertise their levels per model, and a level a model does not accept is run at the nearest level below it rather than failing the turn. The response’s `reasoning_effort` reports the level applied, so read that rather than assuming the request was honoured."}],"metadata":[{"type":"object","properties":{},"description":"Up to 16 key/value pairs, at most 64 KB serialized. Echoed back on the response object, never interpreted."}],"agent":[{"type":"string","description":"Which agent harness runs the turn, `hermes` , `openclaw` , `claude-code` , `codex` , `grok` , `opencode` , or `pi` . Omit it to use the instance’s configured default ( `hermes` on `agent37-hermes` , `openclaw` on `agent37-openclaw` , `claude-code` on `agent37-claude-code` , `codex` on `agent37-codex` , `grok` on `agent37-grok` , `opencode` on `agent37-opencode` , `pi` on `agent37-pi` ). Routing is per request: the gateway keeps no session-to-agent binding, so if a session runs on a non-default harness, send `agent` on every turn of it. Targeting a harness the instance was not provisioned with does not reject the call: the turn settles with `status: \"failed\"` and `error.code` `agent_unavailable` ."}],"profile":[{"type":"string","description":"A named setup inside the agent, with its own instructions, skills, memory, config, and sessions, so one instance can host several distinct agents (a support agent and a sales agent, say). Omit it, or send `default` , for the agent’s own setup. Like `agent` , it is per request: send it on every turn of the session, and as `?profile=` on the session reads . Supported on `hermes` today; `profile` with any other `agent` is `400 validation_error` . A name that is not lowercase letters, digits, `-` or `_` is `400 validation_error` , and a profile that does not exist on the instance is `404 profile_not_found` ."}],"mode":[{"type":"string","description":"`chat` runs one turn and replies. `goal` is reserved: sending it returns `400 validation_error` today."}]}}],"examples":{"example":{"value":{"input":"\u003cstring>","files":["\u003cstring>"],"session_id":"\u003cstring>","stream":true,"model":"\u003cstring>","provider":"\u003cstring>","reasoning_effort":"\u003cstring>","metadata":{},"agent":"\u003cstring>","profile":"\u003cstring>","mode":"\u003cstring>"}}}}}},"response":{"200":{"application/json":{"schemaArray":[{"type":"object","properties":{"id":[{"type":"string","description":"The response id. Use it to reconnect or cancel the turn."}],"session_id":[{"type":"string","description":"The conversation this turn belongs to. Reuse it on the next call to continue the thread."}],"status":[{"type":"string","description":"`in_progress` , then a terminal `completed` , `failed` , or `cancelled` ."}],"agent":[{"type":"string","description":"The agent that ran the turn, `hermes` , `openclaw` , `claude-code` , `codex` , `grok` , `opencode` , or `pi` ."}],"profile":[{"type":"object","properties":{},"description":"The profile the turn ran in, or `null` for the agent’s own setup."}],"model":[{"type":"object","properties":{},"description":"The `model` you sent on this request, echoed back. `null` when you omitted it: the turn still ran on the harness’s default or session model, but the gateway does not report which model the harness resolved."}],"provider":[{"type":"object","properties":{},"description":"The `provider` you sent on this request, echoed back; `null` when you omitted it."}],"reasoning_effort":[{"type":"object","properties":{},"description":"The reasoning level applied to this turn, which is not always the one you asked for. Every harness takes the same eight levels and maps them onto its own: Hermes and OpenClaw run all eight, Claude Code runs `minimal` as `low` , grok and pi run `ultra` as `max` , and Codex and OpenCode go further and advertise which levels each individual model supports. Rather than reject a turn for a level a model cannot run, the gateway runs it at the nearest level below. Ask OpenCode for `ultra` and you get `max` or lower back. `null` when you sent no level and the harness used its own default: the turn still ran at some effort, but the gateway reports only what it applied. This is the level sent to the harness, not a reading taken from the model. A harness that lowers it again on its own is not visible here: Pi clamps to the model’s limits itself, and a non-reasoning Grok model ignores the setting outright. Read it as the ceiling the turn ran under. It also rides the terminal `response.completed` event when you stream . Needs gateway `0.18.0` ; older instances omit the field."}],"output_text":[{"type":"string","description":"The agent’s final answer. Always a string, empty if the turn produced none."}],"usage":[{"type":"object","properties":{},"description":"Token counts and cost for the turn: `{ input_tokens, output_tokens, cost_usd }` . `cost_usd` is absent or `null` when the provider did not report a cost."}],"context":[{"type":"object","properties":{},"description":"The session’s context window as of this turn: `{ used_tokens, window_tokens }` , the tokens occupying the model’s window against the window’s size. `null` when the harness didn’t report a measurement; a cancelled turn reports none on either harness. Hermes reports it on every completed turn. OpenClaw reports none, so the gateway derives it from the turn: `used_tokens` is the turn’s token total (input, output, and cache tokens) and `window_tokens` is the model’s context window from OpenClaw’s model catalog, or `128000` (OpenClaw’s own default budget) when the catalog lists no window for the model. On OpenClaw it is `null` when the turn reported no usage, no model, a zero token total, or a model that is not in the catalog."}],"error":[{"type":"object","properties":{},"description":"Set when the turn failed: `{ code, message, param?, hint? }` . See Errors ."}],"metadata":[{"type":"object","properties":{},"description":"Your request metadata, echoed back verbatim."}],"created":[{"type":"number","description":"When the turn started, epoch milliseconds."}]}}],"examples":{"example":{"value":{"id":"\u003cstring>","session_id":"\u003cstring>","status":"\u003cstring>","agent":"\u003cstring>","profile":{},"model":{},"provider":{},"reasoning_effort":{},"output_text":"\u003cstring>","usage":{},"context":{},"error":{},"metadata":{},"created":123}}}}}},"deprecated":false}},"jsLinks":[],"subdomain":"agent37","siteName":"Agent 37","title":"Send a message - Agent 37","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-10T18:27:08.116Z","originalFileLocation":"agents-api/chat.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Run a turn through an agent template, stream or return its result, and continue the conversation.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Agent 37\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Send a message - Agent 37\">\u003cmeta data-mint-head property=\"og:description\" content=\"Run a turn through an agent template, stream or return its result, and continue the conversation.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Agent 37\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.agent37.com/docs/agents-api/chat\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://agent37.mintlify.app/_mintlify/api/og/v2?division=Agent+API\u0026amp;title=Send+a+message\u0026amp;description=Run+a+turn+through+an+agent+template%2C+stream+or+return+its+result%2C+and+continue+the+conversation.\u0026amp;theme=8468b77f391647ed405b2fb0\u0026amp;signature=e5750ad05e4c5565bf873ece3d1105c2a8cc62cfc856da18e7c7829c67a4e336\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Send a message - Agent 37\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Run a turn through an agent template, stream or return its result, and continue the conversation.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://agent37.mintlify.app/_mintlify/api/og/v2?division=Agent+API\u0026amp;title=Send+a+message\u0026amp;description=Run+a+turn+through+an+agent+template%2C+stream+or+return+its+result%2C+and+continue+the+conversation.\u0026amp;theme=8468b77f391647ed405b2fb0\u0026amp;signature=e5750ad05e4c5565bf873ece3d1105c2a8cc62cfc856da18e7c7829c67a4e336\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/agent37/--vcFLcEbIFM_e_r/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Agent 37\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#171717\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.agent37.com/docs/agents-api/chat\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/agents-api/chat.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.agent37.com/#organization\",\"name\":\"Agent 37\",\"url\":\"https://www.agent37.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/agent37/KgMOKLhsUcC5DWl-/logo/light.svg?fit=max\u0026auto=format\u0026n=KgMOKLhsUcC5DWl-\u0026q=85\u0026s=40315674dd037e65c13574dd79aeb421\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.agent37.com/docs#website\",\"name\":\"Agent 37\",\"url\":\"https://www.agent37.com/docs\",\"publisher\":{\"@id\":\"https://www.agent37.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.agent37.com/docs/agents-api/chat#webpage\",\"url\":\"https://www.agent37.com/docs/agents-api/chat\",\"name\":\"Send a message\",\"description\":\"Run a turn through an agent template, stream or return its result, and continue the conversation.\",\"dateModified\":\"2026-10-10T18:27:08.116Z\",\"isPartOf\":{\"@id\":\"https://www.agent37.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.agent37.com/docs/agents-api/chat#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.agent37.com/docs/agents-api/chat#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Agent 37\",\"item\":\"https://www.agent37.com/docs\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Send a message\",\"item\":\"https://www.agent37.com/docs/agents-api/chat\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://www.agent37.com/docs/agents-api/chat#apireference\",\"headline\":\"Send a message\",\"name\":\"Send a message\",\"description\":\"Run a turn through an agent template, stream or return its result, and continue the conversation.\",\"url\":\"https://www.agent37.com/docs/agents-api/chat\",\"mainEntityOfPage\":{\"@id\":\"https://www.agent37.com/docs/agents-api/chat#webpage\"},\"dateModified\":\"2026-10-10T18:27:08.116Z\",\"publisher\":{\"@id\":\"https://www.agent37.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.agent37.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Agent 37\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Agent 37","nav":{"global":null,"tabs":[{"tab":"Guides","pages":[{"title":"Guides","href":""}]},{"tab":"API reference","groups":[{"group":"Reference","pages":[{"title":"REST API reference","sidebarTitle":"Overview","href":"/agents-api/overview"}]},{"group":"Sandbox API","pages":[{"group":"Instances","expanded":true,"pages":[{"title":"Instances","sidebarTitle":"Overview","href":"/agents-api/instances"},{"title":"Create an instance","api":"POST https://api.agent37.com/v1/instances","playground":"simple","href":"/agents-api/instances/create"},{"title":"List instances","api":"GET https://api.agent37.com/v1/instances","playground":"simple","href":"/agents-api/instances/list"},{"title":"Get an instance","api":"GET https://api.agent37.com/v1/instances/{id}","playground":"simple","href":"/agents-api/instances/get"},{"title":"Edit an instance","api":"PATCH https://api.agent37.com/v1/instances/{id}","playground":"simple","href":"/agents-api/instances/edit"},{"title":"Delete an instance","api":"DELETE https://api.agent37.com/v1/instances/{id}","playground":"simple","href":"/agents-api/instances/delete"},{"group":"Lifecycle","pages":[{"title":"Stop an instance","api":"POST https://api.agent37.com/v1/instances/{id}/stop","playground":"simple","href":"/agents-api/instances/stop"},{"title":"Start an instance","api":"POST https://api.agent37.com/v1/instances/{id}/start","playground":"simple","href":"/agents-api/instances/start"},{"title":"Restart an instance","api":"POST https://api.agent37.com/v1/instances/{id}/restart","playground":"simple","href":"/agents-api/instances/restart"},{"title":"Update an instance","api":"POST https://api.agent37.com/v1/instances/{id}/update","playground":"simple","href":"/agents-api/instances/update"},{"title":"Resize an instance","api":"POST https://api.agent37.com/v1/instances/{id}/resize","playground":"simple","href":"/agents-api/instances/resize"},{"title":"Fork an instance","api":"POST https://api.agent37.com/v1/instances/{id}/fork","playground":"simple","href":"/agents-api/instances/fork"}]},{"group":"Backups","pages":[{"title":"List backups","api":"GET https://api.agent37.com/v1/instances/{id}/backups","playground":"simple","href":"/agents-api/instances/list-backups"},{"title":"Create a backup","api":"POST https://api.agent37.com/v1/instances/{id}/backups","playground":"simple","href":"/agents-api/instances/create-backup"},{"title":"Restore a backup","api":"POST https://api.agent37.com/v1/instances/{id}/restore","playground":"simple","href":"/agents-api/instances/restore"}]},{"title":"The instance object","href":"/agents-api/instances/object"}]},{"title":"Templates","href":"/agents-api/templates"},{"title":"Instance and preview URLs","href":"/agents-api/urls"},{"title":"Public ports","href":"/agents-api/public-ports"},{"title":"Custom domains","href":"/agents-api/domains"},{"title":"Run commands","api":"POST https://api.agent37.com/v1/instances/{id}/exec","playground":"simple","href":"/agents-api/exec"},{"title":"Crons","href":"/agents-api/crons"},{"title":"SSH","href":"/agents-api/ssh"},{"title":"Read logs","href":"/agents-api/logs"},{"title":"Read metrics","href":"/agents-api/metrics"},{"title":"Managed services \u0026 budgets","href":"/agents-api/budgets"},{"title":"App integrations","description":"Connect Gmail, Slack, Notion, and 250+ other apps to an instance over the Sandbox API: managed Composio, one entity per instance, OAuth handled for you.","href":"/agents-api/integrations"}]},{"group":"Agent API","pages":[{"title":"Send a message","api":"POST https://{instanceId}.agent37.app/v1/responses","playground":"simple","href":"/agents-api/chat"},{"title":"Streaming","description":"Stream a reply as named Server-Sent Events from your instance URL, and reconnect without losing the answer.","href":"/agents-api/streaming"},{"title":"Sessions","href":"/agents-api/sessions"},{"title":"Models","href":"/agents-api/models"},{"title":"Files","href":"/agents-api/files"},{"title":"Health \u0026 version","href":"/agents-api/health"}]},{"group":"Shared reference","pages":[{"title":"Sign up","href":"/agents-api/signup"},{"title":"Billing","href":"/agents-api/billing"},{"title":"Members","href":"/agents-api/members"},{"title":"Errors","href":"/agents-api/errors"},{"title":"Connect Hermes Desktop","sidebarTitle":"Hermes Desktop","href":"/agents-api/hermes-desktop"}]}]}]},"title":"Send a message - Agent 37","buildId":"dpl_BtCp1ySSRiZuC61kdwjLNfcZF9iT","deploymentId":"dpl_BtCp1ySSRiZuC61kdwjLNfcZF9iT","dynamics":["c2aa737661","2b790eda92","b0f84f53ff"],"chunks":["OpenApiReferenceProvider-BwGMKaJA.js","utils-DlantaNs.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-bU1lWMyL.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-atrzX1N-.js","snippetPresets-Dm5t-KF3.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Cz42QzGy.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-CLWnFKQE.js","shallow-DjOyfhxF.js","getApiPlaygroundDisplay-J2CVUWQR.js","CodeSnippet-emM-BzLU.js","CodeSnippets-DbUDosch.js","Page-DHr1JptQ.js","getPastedJson-D8Zg6YHf.js","icon-BDdk7KSm.js","MethodPill-C61Dtple.js","DuplicateIcon-42opbpVe.js","createIcon-BciRFb7M.js","DynamicMarkdown-CSxQrJZZ.js","SectionHeading-EqAWqlH3.js","axios-vUo_bRtp.js"]}