Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.
Every run of your agent is a sequence of events: the text it writes, each tool call it makes and the tool’s result, the steps it passes through, and one event that ends it. Onecortex produces them from your framework, so callers see the same events whichever framework you use.A streaming caller gets each event as it happens, as server sent events. A JSON caller gets the tool calls, results and steps in events, and the text whole in result. See the invoke API.
The events
Every event is a JSON object with v, the event format version, which is 1, and type.
text
A piece of the reply.
{ "v": 1, "type": "text", "delta": "You said" }
Join the delta values in order for the whole reply. done.result also carries it whole.
result is always present, and is the whole reply. On the stream, done also carries sessionId, versionNumber and durationMs.
interrupt
The run paused to ask a person something, and ends here. Send the answer as a resume with the same sessionId, and the run continues from where it stopped. See Human in the loop.
{ "v": 1, "type": "interrupt", "interrupts": [ { "id": "003ca33765a0ac7e65916e3f4a1351a2", "reason": "approval", "message": "Refund 40.00 EUR for order 1042 (a desk lamp) to the original payment method?", "responseSchema": { "type": "object", "properties": { "approve": { "type": "boolean" } }, "required": ["approve"] } } ], "sessionId": "01K...", "versionNumber": 1, "durationMs": 1203}
Each interrupt has an id, which the resume names. reason, message, responseSchema (the JSON Schema the answer must match) and expiresAt (an ISO 8601 time after which the answer is refused) are there when your agent set them. On the stream, interrupt also carries sessionId, versionNumber and durationMs.
error
The run failed.
{ "v": 1, "type": "error", "code": "agent_error", "message": "ValueError: the agent was asked to raise" }
code is one of the invoke error codes, most often agent_error, when your code raised. Your traceback is in your logs, never in the event.
A stream that has started has already sent 200 OK, and cannot change it. If the run fails after that, the failure arrives in the stream as event: error. Handle it: a client that reads only text and done shows a failed run as an empty success.
The rules
Exactly one terminal event, last. Every run ends in done, interrupt or error, and nothing follows it. A run that stops without one is reported as an error with upstream_error, The agent stopped before finishing its reply.
A tool call starts before anything else about it.tool_call_args, tool_call_end and tool_result for an id always follow its tool_call_start.
A failed run may leave a call or a step open. Do not wait for an end after an error.
Every framework sends at least text and done. What more it sends depends on what the framework reports: see its page.
On the wire
Each event is one server sent events frame, named by its type, with the event as single line JSON:
While your agent is silent, Onecortex sends : ping every 15 seconds. It is a comment, which server sent events clients ignore, and it keeps proxies from closing the connection.
Send your own events
A plain function agent can report its own tool calls and steps by yielding event objects alongside its text. See A Python function and A TypeScript function.
Last modified on September 29, 2026
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Onecortex","description":"Deploy an AI agent from a GitHub repository to an authenticated HTTPS endpoint with streaming, logs and rollback.","colors":{"primary":"#0070cf","light":"#4ea9ff","dark":"#0070cf"},"logo":{"light":"https://mintcdn.com/onecortex/p6wov8iuplp6B7w5/logo/light.svg?fit=max\u0026auto=format\u0026n=p6wov8iuplp6B7w5\u0026q=85\u0026s=cd0bd9dfc42a1210868826e818b42016","dark":"https://mintcdn.com/onecortex/p6wov8iuplp6B7w5/logo/dark.svg?fit=max\u0026auto=format\u0026n=p6wov8iuplp6B7w5\u0026q=85\u0026s=85826e5c5862ad00e3f94a7e4aacfcb6","href":"https://docs.onecortex.io"},"favicon":"https://mintcdn.com/onecortex/p6wov8iuplp6B7w5/favicon.svg?fit=max\u0026auto=format\u0026n=p6wov8iuplp6B7w5\u0026q=85\u0026s=76e2f02de05427b53daf3a26bf20d0ed","api":{"openapi":"openapi.yaml","playground":{"display":"interactive"},"examples":{"languages":["python","typescript","curl"]}},"appearance":{"default":"system","strict":false},"background":{"color":{"light":"#ffffff","dark":"#080a0d"}},"navbar":{"links":[{"href":"mailto:[email protected]","label":"Support"},{"href":"https://app.onecortex.io/login","label":"Sign in"}],"primary":{"type":"button","label":"Get access","href":"https://app.onecortex.io/signup"}},"footer":{"socials":{"github":"https://github.com/onecortex-io","linkedin":"https://www.linkedin.com/in/bharat-mehan"},"links":[{"header":"Product","items":[{"label":"Dashboard","href":"https://app.onecortex.io"},{"label":"Changelog","href":"/changelog"}]},{"header":"Help","items":[{"label":"Support","href":"mailto:[email protected]"},{"label":"Troubleshooting","href":"/production/troubleshooting"}]}]},"search":{"prompt":"Search the docs, or paste an error message"},"seo":{"metatags":{"og:site_name":"Onecortex"},"indexing":"navigable"},"fonts":{"heading":{"family":"Geist","weight":600,"source":"fonts/geist-latin-wght-normal.woff2","format":"woff2"},"body":{"family":"Geist","weight":400,"source":"fonts/geist-latin-wght-normal.woff2","format":"woff2"}},"icons":{"library":"lucide"},"styling":{"eyebrows":"section","codeblocks":{"theme":{"light":"github-light","dark":"nord"}},"latex":false},"banner":{"content":"Onecortex is in private beta. Access is by invitation: [request access](mailto:[email protected]).","dismissible":true,"color":{"light":"#131518","dark":"#131518"}},"errors":{"404":{"redirect":false,"title":"No page here","description":"Search the docs, or start from the [quickstart](/quickstart)."}},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode","mcp"],"display":"header"},"thumbnails":{"appearance":"dark","background":"https://mintcdn.com/onecortex/p6wov8iuplp6B7w5/images/og-background.png?fit=max\u0026auto=format\u0026n=p6wov8iuplp6B7w5\u0026q=85\u0026s=fad975440f46ffd83e319e43b1727061"},"metadata":{"timestamp":true},"variables":{"app":"https://app.onecortex.io","api":"https://api.onecortex.io"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"onecortex","hasAudioNarration":false,"actualSubdomain":"onecortex","customDomains":["docs.onecortex.io"],"gitSource":{"type":"github","owner":"onecortex-io","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6abeae2b248051030457049e","clientVersion":"0.0.4340","searchFilterCounts":[{"language":"default","tag":"Docs","count":57},{"language":"default","tag":"Frameworks","count":11},{"language":"default","tag":"Call your agent","count":10},{"language":"default","tag":"Build your agent","count":9},{"language":"default","tag":"API reference","count":7},{"language":"default","tag":"Endpoints","count":7},{"language":"default","tag":"Python","count":7},{"language":"default","tag":"Deploy","count":6},{"language":"default","tag":"Production","count":6},{"language":"default","tag":"Resources","count":5}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","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":"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":"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":"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":"site-roles","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":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","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":"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":"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},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@font-face{font-family:\"Geist Mono\";src:url(\"/fonts/geist-mono-latin-wght-normal.woff2\") format(\"woff2\");font-weight:100 900;font-display:swap}:root{--oc-background: #ffffff;--oc-foreground: #131518;--oc-card: #f7f7f5;--oc-muted: #f0f0ee;--oc-muted-foreground: #656b70;--oc-border: #e1e3e5;--oc-brand: #0070cf;--oc-ring: rgb(19 21 24 / 5%);--oc-radius-card: min(1.65rem, 24px);--oc-radius-control: 0.75rem}.dark{--oc-background: #080a0d;--oc-foreground: #f4f3f1;--oc-card: #131518;--oc-muted: #1e2124;--oc-muted-foreground: #9fa4a8;--oc-border: rgb(255 255 255 / 9%);--oc-brand: #4ea9ff;--oc-ring: rgb(244 243 241 / 10%)}code,pre,kbd{font-family:\"Geist Mono\", ui-monospace, monospace}#page-title,.mdx-content h1,.mdx-content h2{letter-spacing:-0.02em}.card{background:var(--oc-card);border-radius:var(--oc-radius-card);box-shadow:0 1px 2px rgb(0 0 0 / 5%), 0 0 0 1px var(--oc-ring)}.card:hover{box-shadow:0 1px 2px rgb(0 0 0 / 5%), 0 0 0 1px color-mix(in oklab, var(--oc-brand) 30%, transparent)}.callout,.code-block,.code-group,.frame{border-radius:var(--oc-radius-card)}.code-block,.code-group{background:var(--oc-card)}html:root .code-block .shiki,html:root .code-block .code-block-background,html:root [data-component-part=\"code-block-root\"]{background:var(--oc-card)!important}.code-block-fade-overlay{--fade-color-light: var(--oc-card) !important;--fade-color-dark: var(--oc-card) !important}#topbar-cta-button a>span:first-child{background:var(--oc-foreground);border-radius:9999px}#topbar-cta-button a .text-white,#topbar-cta-button a svg{color:var(--oc-background)}.mdx-content table thead{background:var(--oc-card)}.mdx-content table th{padding-top:0.75rem;padding-bottom:0.75rem;vertical-align:middle}.mdx-content table th:first-child,.mdx-content table td:first-child{padding-left:1.25rem}.mdx-content table th:last-child,.mdx-content table td:last-child{padding-right:1.25rem}.mdx-content a:focus-visible,#navbar a:focus-visible,#sidebar a:focus-visible,button:focus-visible{outline:3px solid color-mix(in oklab, var(--oc-brand) 30%, transparent);outline-offset:2px;border-radius:var(--oc-radius-control)}img[src*=\"/icons/\"]{background-color:currentColor!important;object-position:-9999px 0;mask-position:center;mask-size:contain;mask-repeat:no-repeat}.card img[src*=\"/icons/\"]{background-color:var(--oc-brand)!important}img[src*=\"/icons/crewai.svg\"]{mask-image:url(\"/icons/crewai.svg\")}img[src*=\"/icons/curl.svg\"]{mask-image:url(\"/icons/curl.svg\")}img[src*=\"/icons/langchain.svg\"]{mask-image:url(\"/icons/langchain.svg\")}img[src*=\"/icons/langgraph.svg\"]{mask-image:url(\"/icons/langgraph.svg\")}img[src*=\"/icons/llamaindex.svg\"]{mask-image:url(\"/icons/llamaindex.svg\")}img[src*=\"/icons/mastra.svg\"]{mask-image:url(\"/icons/mastra.svg\")}img[src*=\"/icons/openai.svg\"]{mask-image:url(\"/icons/openai.svg\")}img[src*=\"/icons/python.svg\"]{mask-image:url(\"/icons/python.svg\")}img[src*=\"/icons/strands.svg\"]{mask-image:url(\"/icons/strands.svg\")}img[src*=\"/icons/typescript.svg\"]{mask-image:url(\"/icons/typescript.svg\")}img[src*=\"/icons/vercel.svg\"]{mask-image:url(\"/icons/vercel.svg\")}"}]}
{"page":{"pagePath":"build/streaming","slug":"/build/streaming","pageMetadata":{"title":"Streaming and events","description":"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.","keywords":["streaming","events","sse","server sent events","tokens","tool calls","event types","stream format","chunks","deltas"],"href":"/build/streaming"},"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: \"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.\"\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`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Every run of your agent is a sequence of events: the text it writes, each tool call it makes and the tool’s result, the steps it passes through, and one event that ends it. Onecortex produces them from your framework, so callers see the same events whichever framework you use.`}),`\n`,_jsx(Mermaid,{chart:`sequenceDiagram\n participant App as Your app\n participant OC as Onecortex\n participant Agent as Your agent\n App->>OC: POST /invoke {\"prompt\": \"...\", \"stream\": true}\n OC->>Agent: the prompt\n Agent-->>App: step_start\n Agent-->>App: tool_call_start, tool_call_args, tool_call_end\n Agent-->>App: tool_result\n Agent-->>App: text, text, text\n Agent-->>App: step_end\n Agent-->>App: done (or interrupt, or error)`}),`\n`,_jsxs(_components.p,{children:[`A streaming caller gets each event as it happens, as server sent events. A JSON caller gets the tool calls, results and steps in `,_jsx(_components.code,{children:`events`}),`, and the text whole in `,_jsx(_components.code,{children:`result`}),`. See `,_jsx(_components.a,{href:`/call/invoke`,children:`the invoke API`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-events`,children:`The events`}),`\n`,_jsxs(_components.p,{children:[`Every event is a JSON object with `,_jsx(_components.code,{children:`v`}),`, the event format version, which is `,_jsx(_components.code,{children:`1`}),`, and `,_jsx(_components.code,{children:`type`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`text`,children:`text`}),`\n`,_jsx(_components.p,{children:`A piece of the reply.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`text`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`delta`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`You said`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Join the `,_jsx(_components.code,{children:`delta`}),` values in order for the whole reply. `,_jsx(_components.code,{children:`done.result`}),` also carries it whole.`]}),`\n`,_jsx(Heading,{level:`3`,id:`tool_call_start`,children:`tool_call_start`}),`\n`,_jsx(_components.p,{children:`A tool call begins.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`tool_call_start`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`id`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`call_1`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`name`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`word_count`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`id`}),` is unique within the run, and ties the call’s other events together.`]}),`\n`,_jsx(Heading,{level:`3`,id:`tool_call_args`,children:`tool_call_args`}),`\n`,_jsx(_components.p,{children:`A piece of the call’s arguments, as JSON text.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`tool_call_args`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`id`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`call_1`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`delta`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`text`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`: `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`hello`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Join the `,_jsx(_components.code,{children:`delta`}),` values for one `,_jsx(_components.code,{children:`id`}),` to get its arguments. A framework that does not stream arguments sends them whole in one event.`]}),`\n`,_jsx(Heading,{level:`3`,id:`tool_call_end`,children:`tool_call_end`}),`\n`,_jsx(_components.p,{children:`The call’s arguments are complete.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`tool_call_end`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`id`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`call_1`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`tool_result`,children:`tool_result`}),`\n`,_jsx(_components.p,{children:`The tool’s output.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`tool_result`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`id`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`call_1`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`output`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`1`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`output`}),` is a string: JSON text when the tool returned structured data. `,_jsx(_components.code,{children:`isError`}),` is `,_jsx(_components.code,{children:`true`}),` when the tool failed. Output longer than 64 KB is cut to 64 KB.`]}),`\n`,_jsx(Heading,{level:`3`,id:`step_start-and-step_end`,children:`step_start and step_end`}),`\n`,_jsx(_components.p,{children:`A named stage of the run begins or ends: a LangGraph node, an OpenAI Agents SDK agent after a handoff, a CrewAI task.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`step_start`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`name`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`classify`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Steps can nest. Each `,_jsx(_components.a,{href:`/frameworks/langgraph`,children:`framework page`}),` says what its steps are.`]}),`\n`,_jsx(Heading,{level:`3`,id:`done`,children:`done`}),`\n`,_jsx(_components.p,{children:`The run finished.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`done`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`result`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`You said: hello`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`sessionId`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`01K...`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`versionNumber`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`durationMs`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 212`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`result`}),` is always present, and is the whole reply. On the stream, `,_jsx(_components.code,{children:`done`}),` also carries `,_jsx(_components.code,{children:`sessionId`}),`, `,_jsx(_components.code,{children:`versionNumber`}),` and `,_jsx(_components.code,{children:`durationMs`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`interrupt`,children:`interrupt`}),`\n`,_jsxs(_components.p,{children:[`The run paused to ask a person something, and ends here. Send the answer as a `,_jsx(_components.code,{children:`resume`}),` with the same `,_jsx(_components.code,{children:`sessionId`}),`, and the run continues from where it stopped. See `,_jsx(_components.a,{href:`/build/human-in-the-loop`,children:`Human in the loop`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`interrupt`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`interrupts`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`id`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`003ca33765a0ac7e65916e3f4a1351a2`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`reason`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`approval`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`message`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`Refund 40.00 EUR for order 1042 (a desk lamp) to the original payment method?`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`responseSchema`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` {`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`object`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`properties`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` {`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`approve`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` {`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`boolean`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` },`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`required`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` [`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`approve`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`]`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`sessionId`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`01K...`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`versionNumber`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`durationMs`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1203`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Each interrupt has an `,_jsx(_components.code,{children:`id`}),`, which the resume names. `,_jsx(_components.code,{children:`reason`}),`, `,_jsx(_components.code,{children:`message`}),`, `,_jsx(_components.code,{children:`responseSchema`}),` (the JSON Schema the answer must match) and `,_jsx(_components.code,{children:`expiresAt`}),` (an ISO 8601 time after which the answer is refused) are there when your agent set them. On the stream, `,_jsx(_components.code,{children:`interrupt`}),` also carries `,_jsx(_components.code,{children:`sessionId`}),`, `,_jsx(_components.code,{children:`versionNumber`}),` and `,_jsx(_components.code,{children:`durationMs`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`error`,children:`error`}),`\n`,_jsx(_components.p,{children:`The run failed.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`{`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`v`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:` 1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`type`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`error`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`code`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`agent_error`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:`message`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`ValueError: the agent was asked to raise`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`code`}),` is one of the `,_jsx(_components.a,{href:`/production/errors#invoke-errors`,children:`invoke error codes`}),`, most often `,_jsx(_components.code,{children:`agent_error`}),`, when your code raised. Your traceback is in your `,_jsx(_components.a,{href:`/observe/logs`,children:`logs`}),`, never in the event.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`A stream that has started has already sent `,_jsx(_components.code,{children:`200 OK`}),`, and cannot change it. If the run fails after that, the failure arrives in the stream as `,_jsx(_components.code,{children:`event: error`}),`. Handle it: a client that reads only `,_jsx(_components.code,{children:`text`}),` and `,_jsx(_components.code,{children:`done`}),` shows a failed run as an empty success.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`the-rules`,children:`The rules`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Exactly one terminal event, last.`}),` Every run ends in `,_jsx(_components.code,{children:`done`}),`, `,_jsx(_components.code,{children:`interrupt`}),` or `,_jsx(_components.code,{children:`error`}),`, and nothing follows it. A run that stops without one is reported as an `,_jsx(_components.code,{children:`error`}),` with `,_jsx(_components.code,{children:`upstream_error`}),`, `,_jsx(_components.code,{children:`The agent stopped before finishing its reply.`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`A tool call starts before anything else about it.`}),` `,_jsx(_components.code,{children:`tool_call_args`}),`, `,_jsx(_components.code,{children:`tool_call_end`}),` and `,_jsx(_components.code,{children:`tool_result`}),` for an `,_jsx(_components.code,{children:`id`}),` always follow its `,_jsx(_components.code,{children:`tool_call_start`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`A failed run may leave a call or a step open.`}),` Do not wait for an `,_jsx(_components.code,{children:`end`}),` after an `,_jsx(_components.code,{children:`error`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Every framework sends at least `,_jsx(_components.code,{children:`text`}),` and `,_jsx(_components.code,{children:`done`}),`.`]}),` What more it sends depends on what the framework reports: see its page.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`on-the-wire`,children:`On the wire`}),`\n`,_jsx(_components.p,{children:`Each event is one server sent events frame, named by its type, with the event as single line JSON:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`event: tool_call_start`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"v\":1,\"type\":\"tool_call_start\",\"id\":\"call_1\",\"name\":\"word_count\"}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`While your agent is silent, Onecortex sends `,_jsx(_components.code,{children:`: ping`}),` every 15 seconds. It is a comment, which server sent events clients ignore, and it keeps proxies from closing the connection.`]}),`\n`,_jsx(Heading,{level:`2`,id:`send-your-own-events`,children:`Send your own events`}),`\n`,_jsxs(_components.p,{children:[`A plain function agent can report its own tool calls and steps by yielding event objects alongside its text. See `,_jsx(_components.a,{href:`/frameworks/python-function#report-tool-calls-and-steps`,children:`A Python function`}),` and `,_jsx(_components.a,{href:`/frameworks/typescript-function#report-tool-calls`,children:`A TypeScript function`}),`.`]})]})}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":{"codeStyling":{"theme":{"light":"github-light","dark":"nord"}},"config":{},"pageMetadata":{"title":"Streaming and events","description":"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.","keywords":["streaming","events","sse","server sent events","tokens","tool calls","event types","stream format","chunks","deltas"],"href":"/build/streaming"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The events","slug":"the-events","depth":2,"children":[{"title":"text","slug":"text","depth":3,"children":[]},{"title":"tool_call_start","slug":"tool_call_start","depth":3,"children":[]},{"title":"tool_call_args","slug":"tool_call_args","depth":3,"children":[]},{"title":"tool_call_end","slug":"tool_call_end","depth":3,"children":[]},{"title":"tool_result","slug":"tool_result","depth":3,"children":[]},{"title":"step_start and step_end","slug":"step_start-and-step_end","depth":3,"children":[]},{"title":"done","slug":"done","depth":3,"children":[]},{"title":"interrupt","slug":"interrupt","depth":3,"children":[]},{"title":"error","slug":"error","depth":3,"children":[]}]},{"title":"The rules","slug":"the-rules","depth":2,"children":[]},{"title":"On the wire","slug":"on-the-wire","depth":2,"children":[]},{"title":"Send your own events","slug":"send-your-own-events","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"onecortex","siteName":"Onecortex","title":"Streaming and events - Onecortex","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-29T10:10:44.169Z","gitLastModified":"2026-09-29T09:34:58.000Z","originalFileLocation":"build/streaming.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=\"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Onecortex\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_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=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Streaming and events - Onecortex\">\u003cmeta data-mint-head property=\"og:description\" content=\"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Onecortex\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.onecortex.io/build/streaming\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://onecortex.mintlify.site/_mintlify/api/og/v2?division=Build+your+agent\u0026amp;title=Streaming+and+events\u0026amp;description=Every+event+an+agent+run+can+send%3A+text%2C+tool+calls%2C+tool+results%2C+steps%2C+and+the+terminal+events+done%2C+interrupt+and+error%2C+with+their+fields+and+the+rules+for\u0026amp;theme=2cf023350455ba94e79b4b09\u0026amp;signature=388bbcfe2b138e926f208b473388f1cf7da47daf48e8eec4d4a0ee64e29caba0\">\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=\"Streaming and events - Onecortex\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://onecortex.mintlify.site/_mintlify/api/og/v2?division=Build+your+agent\u0026amp;title=Streaming+and+events\u0026amp;description=Every+event+an+agent+run+can+send%3A+text%2C+tool+calls%2C+tool+results%2C+steps%2C+and+the+terminal+events+done%2C+interrupt+and+error%2C+with+their+fields+and+the+rules+for\u0026amp;theme=2cf023350455ba94e79b4b09\u0026amp;signature=388bbcfe2b138e926f208b473388f1cf7da47daf48e8eec4d4a0ee64e29caba0\">\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=\"/mintlify-assets/_mintlify/favicons/onecortex/f-7vKDYQHOuctbvg/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Onecortex\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0070cf\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.onecortex.io/build/streaming\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/build/streaming.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.onecortex.io/#organization\",\"name\":\"Onecortex\",\"url\":\"https://docs.onecortex.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/onecortex/p6wov8iuplp6B7w5/logo/light.svg?fit=max\u0026auto=format\u0026n=p6wov8iuplp6B7w5\u0026q=85\u0026s=cd0bd9dfc42a1210868826e818b42016\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.onecortex.io#website\",\"name\":\"Onecortex\",\"url\":\"https://docs.onecortex.io\",\"publisher\":{\"@id\":\"https://docs.onecortex.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.onecortex.io/build/streaming#webpage\",\"url\":\"https://docs.onecortex.io/build/streaming\",\"name\":\"Streaming and events\",\"description\":\"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.\",\"dateModified\":\"2026-09-29T09:34:58.000Z\",\"isPartOf\":{\"@id\":\"https://docs.onecortex.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.onecortex.io/build/streaming#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.onecortex.io/build/streaming#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Build your agent\",\"item\":\"https://docs.onecortex.io/agent-yml\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Streaming and events\",\"item\":\"https://docs.onecortex.io/build/streaming\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.onecortex.io/build/streaming#article\",\"headline\":\"Streaming and events\",\"name\":\"Streaming and events\",\"description\":\"Every event an agent run can send: text, tool calls, tool results, steps, and the terminal events done, interrupt and error, with their fields and the rules for their order.\",\"url\":\"https://docs.onecortex.io/build/streaming\",\"mainEntityOfPage\":{\"@id\":\"https://docs.onecortex.io/build/streaming#webpage\"},\"dateModified\":\"2026-09-29T09:34:58.000Z\",\"keywords\":\"streaming, events, sse, server sent events, tokens, tool calls, event types, stream format, chunks, deltas\",\"publisher\":{\"@id\":\"https://docs.onecortex.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.onecortex.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Onecortex\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Onecortex\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/build/streaming.md","siteName":"Onecortex","nav":{"global":null,"tabs":[{"tab":"Docs","groups":[{"group":"Get started","icon":"rocket","pages":[{"title":"Introduction","href":""},{"title":"Quickstart","href":"/quickstart"},{"title":"How Onecortex works","href":"/how-it-works"}]},{"group":"Build your agent","icon":"hammer","pages":[{"title":"agent.yml reference","icon":"brain-circuit","sidebarTitle":"agent.yml","href":"/agent-yml"},{"title":"Entrypoints: how your agent is found","sidebarTitle":"Entrypoints","href":"/build/entrypoints"},{"title":"Python agents","href":"/build/python"},{"title":"TypeScript agents","href":"/build/typescript"},{"title":"Dependencies","href":"/build/dependencies"},{"title":"Configuration and secrets","description":"Give your agent API keys and settings without putting them in the repository: secrets and variables, bulk paste from .env, and when a change takes effect.","href":"/build/configuration"},{"title":"Streaming and events","href":"/build/streaming"},{"title":"Sessions and state","description":"What a session ID does: it reaches the same running instance of your agent, so in process state survives between calls. What it does not do, and where to keep memory that lasts.","href":"/build/sessions"},{"title":"Human in the loop","href":"/build/human-in-the-loop"}]},{"group":"Frameworks","icon":"blocks","pages":[{"group":"Python","pages":[{"title":"LangGraph","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/langgraph.svg","href":"/frameworks/langgraph"},{"title":"OpenAI Agents SDK","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/openai.svg","href":"/frameworks/openai-agents"},{"title":"Strands Agents","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/strands.svg","href":"/frameworks/strands"},{"title":"CrewAI","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/crewai.svg","href":"/frameworks/crewai"},{"title":"LangChain","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/langchain.svg","href":"/frameworks/langchain"},{"title":"LlamaIndex","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/llamaindex.svg","href":"/frameworks/llamaindex"},{"title":"A Python function","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/python.svg","href":"/frameworks/python-function"}]},{"group":"TypeScript","pages":[{"title":"Mastra","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/mastra.svg","href":"/frameworks/mastra"},{"title":"Vercel AI SDK","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/vercel.svg","href":"/frameworks/vercel-ai"},{"title":"LangChain.js","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/langchain.svg","href":"/frameworks/langchain-js"},{"title":"A TypeScript function","icon":"https://mintlify.s3.us-west-1.amazonaws.com/onecortex/icons/typescript.svg","href":"/frameworks/typescript-function"}]}]},{"group":"Deploy","icon":"upload","pages":[{"title":"Connect GitHub","href":"/deploy/github"},{"title":"Builds","href":"/deploy/builds"},{"title":"Versions and rollback","href":"/deploy/versions-and-rollback"},{"title":"Automatic deploys","href":"/deploy/auto-deploy"},{"title":"Regions","href":"/deploy/regions"},{"title":"Delete an agent","href":"/deploy/delete"}]},{"group":"Call your agent","icon":"plug","pages":[{"title":"OpenAI SDK compatible","href":"/call/openai"},{"title":"The invoke API","href":"/call/invoke"},{"title":"API keys","href":"/call/api-keys"},{"title":"Call from Python","href":"/call/python"},{"title":"Call from TypeScript","href":"/call/typescript"},{"title":"Call with curl","href":"/call/curl"},{"title":"AG-UI","href":"/call/ag-ui"},{"title":"A2A","href":"/call/a2a"},{"title":"MCP, Claude and other AI clients","href":"/call/mcp"},{"title":"The Connect tab","tag":"Soon","href":"/call/connect"}]},{"group":"Observe","icon":"activity","pages":[{"title":"Logs","href":"/observe/logs"},{"title":"Alerts","href":"/observe/alerts"},{"title":"The chat console","href":"/observe/chat"}]},{"group":"Production","icon":"shield-check","pages":[{"title":"Limits","href":"/production/limits"},{"title":"Errors","href":"/production/errors"},{"title":"Timeouts and retries","href":"/production/timeouts-and-retries"},{"title":"Security and tenancy","href":"/production/security"},{"title":"Data and retention","href":"/production/data-retention"},{"title":"Troubleshooting","href":"/production/troubleshooting"}]},{"group":"Organizations","icon":"users","pages":[{"title":"Organizations","href":"/organizations/overview"},{"title":"Members and invitations","href":"/organizations/members"},{"title":"Sign in and accounts","href":"/organizations/github-sign-in"},{"title":"The private beta","href":"/organizations/private-beta"}]},{"group":"Resources","icon":"book-open","pages":[{"title":"Examples","href":"/resources/examples"},{"title":"Glossary","href":"/resources/glossary"},{"title":"FAQ","href":"/resources/faq"},{"title":"Support","href":"/resources/support"},{"title":"Status","tag":"Soon","href":"/resources/status"}]}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/overview"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Streaming and events - Onecortex","deploymentId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","buildId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","dynamics":["10e4515597"],"chunks":["BannerMarkdown-BWCD8Ylf.js","dist-DXTH2WLA.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}