Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.
This is the Python snippet from your agent’s page in the dashboard, which fills in the agent’s URL for you. It uses httpx, and there is no Onecortex SDK to install.
Before you begin
A deployed agent and its ID, from its page in the dashboard.
httpx waits 5 seconds for data by default, and an agent can think for longer than that before its first token. For a long running agent pass timeout=None, or a timeout longer than 15 seconds: Onecortex keeps an idle stream alive with a comment line every 15 seconds.
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.
Get one JSON response
Leave out "stream": True to wait for the whole run and get one body:
invoke_json.py
import os, httpxresponse = httpx.post( "https://api.onecortex.io/v1/agents/agt_.../invoke", headers={"Authorization": f"Bearer {os.environ['ONECORTEX_API_KEY']}"}, json={"prompt": "hello"}, timeout=None,)body = response.json()if response.is_error: # A failed run and a refused request both carry `error`. raise RuntimeError(body["error"]["message"])print(body["result"])
Send the same sessionId on each call to reach the same running instance of your agent:
json={"prompt": "When will it arrive?", "sessionId": "user-42", "stream": True}
See Sessions for what a session keeps, and what it does not.
Last modified on September 28, 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":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"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":"call/python","slug":"/call/python","pageMetadata":{"title":"Call from Python","description":"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.","keywords":["python client","httpx","requests","python sdk","stream python","sse python"],"href":"/call/python"},"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: \"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.\"\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`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`This is the Python snippet from your agent’s page in the dashboard, which fills in the agent’s URL for you. It uses `,_jsx(_components.a,{href:`https://www.python-httpx.org`,children:`httpx`}),`, and there is no Onecortex SDK to install.`]}),`\n`,_jsx(Heading,{level:`2`,id:`before-you-begin`,children:`Before you begin`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A deployed agent and its ID, from its page in the dashboard.`}),`\n`,_jsxs(_components.li,{children:[`An `,_jsx(_components.a,{href:`/call/api-keys`,children:`API key`}),` in `,_jsx(_components.code,{children:`ONECORTEX_API_KEY`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`pip install httpx`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`stream-the-reply`,children:`Stream the reply`}),`\n`,_jsxs(_components.p,{children:[`Replace `,_jsx(_components.code,{children:`agt_...`}),` with your agent’s ID:`]}),`\n`,_jsx(CodeBlock,{filename:`invoke.py`,numberOfLines:`22`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` json`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` os`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` httpx`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`with`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` httpx`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`stream`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`POST`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`https://api.onecortex.io/v1/agents/agt_.../invoke`}),_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:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` headers`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`Authorization`}),_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:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`os`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`environ`}),_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:`ONECORTEX_API_KEY`}),_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\":`#EBCB8B`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` json`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`prompt`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`stream`}),_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\":`#81A1C1`},children:` True`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`)`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` as`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` response`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` event `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#81A1C1`},children:` None`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` for`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` line `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`in`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` response`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`iter_lines`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` if`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` line`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`startswith`}),_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:`event: `}),_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:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` event `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` line`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`[`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:`7`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` elif`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` line`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`startswith`}),_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:`data: `}),_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:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` data `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` json`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`loads`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`line`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`[`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#B48EAD`},children:`6`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` if`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` event `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#88C0D0`},children:` print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`data`}),_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:`delta`}),_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:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` end`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_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:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` flush`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#81A1C1`},children:`True`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` elif`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` event `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#88C0D0`},children:` print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`\"[calling `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`data`}),_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:`name`}),_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\":`#EBCB8B`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`]\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` elif`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` event `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#88C0D0`},children:` print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` elif`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` event `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#616E88`},children:` # Handle this, or a failure looks like an empty success.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` raise`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:` RuntimeError`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`data`}),_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:`message`}),_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:[`For the `,_jsx(_components.a,{href:`/quickstart`,children:`quickstart’s`}),` `,_jsx(_components.code,{children:`echo`}),` agent:`]}),`\n`,_jsx(CodeBlock,{filename:`Output`,numberOfLines:`3`,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:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`[calling word_count]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`You said: hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`httpx waits 5 seconds for data by default, and an agent can think for longer than that before its first token. For a long running agent pass `,_jsx(_components.code,{children:`timeout=None`}),`, or a timeout longer than 15 seconds: Onecortex keeps an idle stream alive with a comment line every 15 seconds.`]}),`\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:`get-one-json-response`,children:`Get one JSON response`}),`\n`,_jsxs(_components.p,{children:[`Leave out `,_jsx(_components.code,{children:`\"stream\": True`}),` to wait for the whole run and get one body:`]}),`\n`,_jsx(CodeBlock,{filename:`invoke_json.py`,numberOfLines:`13`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` os`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`,`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` httpx`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`response `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` httpx`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`post`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`https://api.onecortex.io/v1/agents/agt_.../invoke`}),_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:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` headers`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`Authorization`}),_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:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#EBCB8B`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`os`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`environ`}),_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:`ONECORTEX_API_KEY`}),_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\":`#EBCB8B`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` json`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`prompt`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`hello`}),_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:`#E36209`,\"--shiki-dark\":`#D8DEE9`},children:` timeout`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#81A1C1`},children:`None`}),_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:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`body `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` response`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#88C0D0`},children:`json`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:`if`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:` response`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`is_error`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#616E88`},children:\" # A failed run and a refused request both carry `error`.\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},children:` raise`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#8FBCBB`},children:` RuntimeError`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`body`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`message`}),_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\":`#88C0D0`},children:`print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`(`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`body`}),_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:`result`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`])`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:`Output`,numberOfLines:`2`,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:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`You said: hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Every field of the body is on `,_jsx(_components.a,{href:`/call/invoke`,children:`the invoke API`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`continue-a-conversation`,children:`Continue a conversation`}),`\n`,_jsxs(_components.p,{children:[`Send the same `,_jsx(_components.code,{children:`sessionId`}),` on each call to reach the same running instance of your agent:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light nord`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#2e3440ff`,color:`#24292e`,\"--shiki-dark\":`#d8dee9ff`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#D8DEE9FF`},children:`json`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#81A1C1`},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:`prompt`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`When will it arrive?`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`sessionId`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`user-42`}),_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:`#032F62`,\"--shiki-dark\":`#ECEFF4`},children:` \"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#A3BE8C`},children:`stream`}),_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\":`#81A1C1`},children:` True`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#ECEFF4`},children:`}`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/build/sessions`,children:`Sessions`}),` for what a session keeps, and what it does not.`]})]})}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":"Call from Python","description":"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.","keywords":["python client","httpx","requests","python sdk","stream python","sse python"],"href":"/call/python"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Before you begin","slug":"before-you-begin","depth":2,"children":[]},{"title":"Stream the reply","slug":"stream-the-reply","depth":2,"children":[]},{"title":"Get one JSON response","slug":"get-one-json-response","depth":2,"children":[]},{"title":"Continue a conversation","slug":"continue-a-conversation","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"onecortex","siteName":"Onecortex","title":"Call from Python - Onecortex","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-29T05:42:46.430Z","gitLastModified":"2026-09-28T15:44:37.000Z","originalFileLocation":"call/python.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=\"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.\">\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=\"Call from Python - Onecortex\">\u003cmeta data-mint-head property=\"og:description\" content=\"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Onecortex\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.onecortex.io/call/python\">\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=Call+your+agent\u0026amp;title=Call+from+Python\u0026amp;description=Call+a+deployed+agent+from+Python+with+httpx%3A+stream+its+reply%2C+show+its+tool+calls%2C+and+handle+a+failure+mid+stream.\u0026amp;theme=2cf023350455ba94e79b4b09\u0026amp;signature=59707b22a975c785ce58da4f609d049af623a78be48588183297ff24f71ce426\">\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=\"Call from Python - Onecortex\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://onecortex.mintlify.site/_mintlify/api/og/v2?division=Call+your+agent\u0026amp;title=Call+from+Python\u0026amp;description=Call+a+deployed+agent+from+Python+with+httpx%3A+stream+its+reply%2C+show+its+tool+calls%2C+and+handle+a+failure+mid+stream.\u0026amp;theme=2cf023350455ba94e79b4b09\u0026amp;signature=59707b22a975c785ce58da4f609d049af623a78be48588183297ff24f71ce426\">\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/call/python\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/call/python.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/call/python#webpage\",\"url\":\"https://docs.onecortex.io/call/python\",\"name\":\"Call from Python\",\"description\":\"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.\",\"dateModified\":\"2026-09-28T15:44:37.000Z\",\"isPartOf\":{\"@id\":\"https://docs.onecortex.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.onecortex.io/call/python#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.onecortex.io/call/python#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Call your agent\",\"item\":\"https://docs.onecortex.io/call/openai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Call from Python\",\"item\":\"https://docs.onecortex.io/call/python\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.onecortex.io/call/python#article\",\"headline\":\"Call from Python\",\"name\":\"Call from Python\",\"description\":\"Call a deployed agent from Python with httpx: stream its reply, show its tool calls, and handle a failure mid stream.\",\"url\":\"https://docs.onecortex.io/call/python\",\"mainEntityOfPage\":{\"@id\":\"https://docs.onecortex.io/call/python#webpage\"},\"dateModified\":\"2026-09-28T15:44:37.000Z\",\"keywords\":\"python client, httpx, requests, python sdk, stream python, sse python\",\"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":"/call/python.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","href":"/build/configuration"},{"title":"Streaming and events","href":"/build/streaming"},{"title":"Sessions and state","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","description":"Create an API key to call your agents, scope it to one agent, give it an expiry, and revoke it. Disconnect apps that people connected by signing in.","href":"/call/api-keys"},{"title":"Call from Python","href":"/call/python"},{"title":"Call from TypeScript","description":"Call a deployed agent from TypeScript or JavaScript with fetch: read the event stream, show its tool calls, and handle a failure mid stream.","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":"Call from Python - 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"]}