Install, run, and secure the OpenHands Agent Server for remote agent execution.
The Agent Server package (openhands-agent-server) runs the OpenHands Software Agent SDK behind an HTTP and WebSocket API. Use it when another service, such as an Agent Canvas backend, needs to start conversations, stream events, and run file or command operations in a workspace without embedding the SDK directly in the same process.
A backend process that clients can reach over HTTP/WebSocket.
A long-running service for conversations and workspace files.
A server API that can be protected with a session API key.
A clean boundary between your application backend and the agent runtime.
For a single local script, the standalone SDK is usually simpler. For a backend service, web UI, automation system, or Agent Canvas-style deployment, run an Agent Server and connect to it from the client service.
If you are working from the SDK repository, run the module through uv instead:
uv run python -m openhands.agent_server --host 127.0.0.1 --port 8000
Check that the server is alive:
curl http://127.0.0.1:8000/health
The interactive API docs are available at:
http://127.0.0.1:8000/docs
If SESSION_API_KEY (legacy alias) or OH_SESSION_API_KEYS_* is already set in your shell, the server will require that key for /api/* requests. Unset those variables for unauthenticated local-only testing.
By default, the Agent Server starts without API authentication. Before exposing it to another process, container, host, or user, set at least one session API key.
OH_SECRET_KEY encrypts sensitive values stored with conversations, including LLM API keys and secrets. Keep it stable across restarts. If it changes, previously encrypted values cannot be restored.
Pass the server URL and API key to Workspace. The SDK sends the key as X-Session-API-Key and uses remote HTTP/WebSocket calls for workspace and conversation operations.
import osfrom pydantic import SecretStrfrom openhands.sdk import Conversation, LLM, Workspacefrom openhands.tools.preset.default import get_default_agentllm = LLM( model=os.environ.get("LLM_MODEL", "anthropic/claude-sonnet-4-5-20250929"), api_key=SecretStr(os.environ["LLM_API_KEY"]),)agent = get_default_agent(llm=llm, cli_mode=True) # disable browser-automation toolsworkspace = Workspace( host="http://127.0.0.1:8000", api_key=os.environ["OH_SESSION_API_KEYS_0"], working_dir="workspace/project",)conversation = Conversation(agent=agent, workspace=workspace)conversation.send_message("Create a NOTES.md file with three facts about this project.")conversation.run()conversation.close()
If the server was started without OH_SESSION_API_KEYS_0, remove the api_key=... argument.
If another service runs on the same machine, keep the server bound to 127.0.0.1 and let that service connect locally.If another host must connect to the server:
Set OH_SESSION_API_KEYS_0 and OH_SECRET_KEY.
Bind the server to a reachable interface, for example --host 0.0.0.0.
Put the server behind TLS, a private network, or a trusted reverse proxy.
Restrict firewall access to only the services that need it.
Configure CORS only for browser clients that must call the server directly.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"OpenHands Docs","colors":{"primary":"#99873c","light":"#ffe165","dark":"#ffe165"},"logo":{"light":"https://mintcdn.com/allhandsai/DjhqLcIy_hW6pRTg/logo/light.png?fit=max\u0026auto=format\u0026n=DjhqLcIy_hW6pRTg\u0026q=85\u0026s=49b636402b03f7279ca5e1afefeec1d2","dark":"https://mintcdn.com/allhandsai/DjhqLcIy_hW6pRTg/logo/dark.png?fit=max\u0026auto=format\u0026n=DjhqLcIy_hW6pRTg\u0026q=85\u0026s=e0c4017631cebc3a289798438e2c0d7a"},"favicon":"https://mintcdn.com/allhandsai/DjhqLcIy_hW6pRTg/openhands/logo-square.png?fit=max\u0026auto=format\u0026n=DjhqLcIy_hW6pRTg\u0026q=85\u0026s=6ef1bab575660ae6e2d44fcc57bc675f","appearance":{"default":"light"},"background":{"color":{"light":"#f7f3ee","dark":"#0B0D0E"}},"navbar":{"links":[],"primary":{"type":"github","href":"https://github.com/OpenHands/OpenHands"}},"footer":{"socials":{"slack":"https://openhands.dev/joinslack","github":"https://github.com/OpenHands"},"links":[{"header":"Links","items":[{"label":"Company","href":"https://openhands.dev/"},{"label":"Blog","href":"https://openhands.dev/blog"},{"label":"Cloud","href":"https://app.all-hands.dev"},{"label":"Enterprise","href":"https://openhands.dev/enterprise"}]}]},"seo":{"indexing":"navigable"},"contextual":{"options":["copy","view","download-spec","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"allhandsai","hasAudioNarration":false,"actualSubdomain":"allhandsai","customDomains":["docs.openhands.dev"],"gitSource":{"type":"github","owner":"openhands","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae0e0731f773164aafa07a6","collectionId":"fce82e26-3479-4755-a53c-dac0279db9d6","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae0e0731f773164aafa07a6"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae0e0731f773164aafa07a6","clientVersion":"0.0.3990","searchFilterCounts":[{"language":"default","tag":"Cloud","count":196},{"language":"default","tag":"Cloud API","count":187},{"language":"default","tag":"REST API Reference","count":185},{"language":"default","tag":"SDK","count":127},{"language":"default","tag":"Guides","count":104},{"language":"default","tag":"API Reference","count":95},{"language":"default","tag":"Enterprise","count":71},{"language":"default","tag":"Home","count":58},{"language":"default","tag":"Remote Agent Server","count":55},{"language":"default","tag":"Agent Canvas","count":52}]},"assistantConfig":{"deflection":{"enabled":true,"email":"contact@openhands.dev","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","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":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#banner *{color:#434240}"}],"page":{"pagePath":"sdk/arch/agent-server","slug":"/sdk/arch/agent-server","pageMetadata":{"title":"Agent Server Package","description":"Install, run, and secure the OpenHands Agent Server for remote agent execution.","href":"/sdk/arch/agent-server"},"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: \"Install, run, and secure the OpenHands Agent Server for remote agent execution.\"\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`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The Agent Server package (`,_jsx(_components.code,{children:`openhands-agent-server`}),`) runs the OpenHands Software Agent SDK behind an HTTP and WebSocket API. Use it when another service, such as an Agent Canvas backend, needs to start conversations, stream events, and run file or command operations in a workspace without embedding the SDK directly in the same process.`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-to-use-it`,children:`When to Use It`}),`\n`,_jsx(_components.p,{children:`Use the Agent Server when you need:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A backend process that clients can reach over HTTP/WebSocket.`}),`\n`,_jsx(_components.li,{children:`A long-running service for conversations and workspace files.`}),`\n`,_jsx(_components.li,{children:`A server API that can be protected with a session API key.`}),`\n`,_jsx(_components.li,{children:`A clean boundary between your application backend and the agent runtime.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`For a single local script, the standalone SDK is usually simpler. For a backend service, web UI, automation system, or Agent Canvas-style deployment, run an Agent Server and connect to it from the client service.`}),`\n`,_jsx(Heading,{level:`2`,id:`install`,children:`Install`}),`\n`,_jsx(_components.p,{children:`Install the server package and its SDK dependencies into a Python environment:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`uv`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` venv`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`source`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` .venv/bin/activate`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`uv`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -U`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands-sdk`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands-tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands-workspace`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands-agent-server`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If you are working from the `,_jsx(_components.code,{children:`OpenHands/software-agent-sdk`}),` repository, use the repository’s normal `,_jsx(_components.code,{children:`uv`}),` setup instead:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`git`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` clone`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://github.com/OpenHands/software-agent-sdk.git`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` software-agent-sdk`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`uv`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sync`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`start-a-local-server`,children:`Start a Local Server`}),`\n`,_jsxs(_components.p,{children:[`For local-only use, bind to `,_jsx(_components.code,{children:`127.0.0.1`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands.agent_server`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 127.0.0.1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8000`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If you are working from the SDK repository, run the module through `,_jsx(_components.code,{children:`uv`}),` instead:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`uv`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` python`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands.agent_server`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 127.0.0.1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8000`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Check that the server is alive:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http://127.0.0.1:8000/health`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The interactive API docs are available at:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`http://127.0.0.1:8000/docs`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`If `,_jsx(_components.code,{children:`SESSION_API_KEY`}),` (legacy alias) or `,_jsx(_components.code,{children:`OH_SESSION_API_KEYS_*`}),` is already set in your shell, the server will require that key for `,_jsx(_components.code,{children:`/api/*`}),` requests. Unset those variables for unauthenticated local-only testing.`]}),`\n`,_jsx(Heading,{level:`2`,id:`secure-the-server`,children:`Secure the Server`}),`\n`,_jsx(_components.p,{children:`By default, the Agent Server starts without API authentication. Before exposing it to another process, container, host, or user, set at least one session API key.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_SESSION_API_KEYS_0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`-hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_SECRET_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`-hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands.agent_server`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 127.0.0.1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8000`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Clients must send the session key in the `,_jsx(_components.code,{children:`X-Session-API-Key`}),` header. This request returns the conversation count when the key is accepted:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Session-API-Key: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$OH_SESSION_API_KEYS_0`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http://127.0.0.1:8000/api/conversations/count`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Use additional indexed variables when you need key rotation:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_SESSION_API_KEYS_0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"current-key\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_SESSION_API_KEYS_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"next-key\"`})]}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`OH_SECRET_KEY`}),` encrypts sensitive values stored with conversations, including LLM API keys and secrets. Keep it stable across restarts. If it changes, previously encrypted values cannot be restored.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`connect-from-python`,children:`Connect From Python`}),`\n`,_jsxs(_components.p,{children:[`Pass the server URL and API key to `,_jsx(_components.code,{children:`Workspace`}),`. The SDK sends the key as `,_jsx(_components.code,{children:`X-Session-API-Key`}),` and uses remote HTTP/WebSocket calls for workspace and conversation operations.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`24`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`24`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pydantic `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SecretStr`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openhands.sdk `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Conversation, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`LLM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, Workspace`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openhands.tools.preset.default `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_default_agent`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`llm `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LLM(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.environ.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"LLM_MODEL\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-sonnet-4-5-20250929\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`SecretStr(os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"LLM_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_default_agent(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`llm`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`llm, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cli_mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# disable browser-automation tools`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`workspace `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Workspace(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` host`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"http://127.0.0.1:8000\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"OH_SESSION_API_KEYS_0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` working_dir`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"workspace/project\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`conversation `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Conversation(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`agent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`workspace`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`workspace)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`conversation.send_message(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Create a NOTES.md file with three facts about this project.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`conversation.run()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`conversation.close()`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If the server was started without `,_jsx(_components.code,{children:`OH_SESSION_API_KEYS_0`}),`, remove the `,_jsx(_components.code,{children:`api_key=...`}),` argument.`]}),`\n`,_jsx(Heading,{level:`2`,id:`expose-it-safely`,children:`Expose It Safely`}),`\n`,_jsxs(_components.p,{children:[`If another service runs on the same machine, keep the server bound to `,_jsx(_components.code,{children:`127.0.0.1`}),` and let that service connect locally.`]}),`\n`,_jsx(_components.p,{children:`If another host must connect to the server:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Set `,_jsx(_components.code,{children:`OH_SESSION_API_KEYS_0`}),` and `,_jsx(_components.code,{children:`OH_SECRET_KEY`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Bind the server to a reachable interface, for example `,_jsx(_components.code,{children:`--host 0.0.0.0`}),`.`]}),`\n`,_jsx(_components.li,{children:`Put the server behind TLS, a private network, or a trusted reverse proxy.`}),`\n`,_jsx(_components.li,{children:`Restrict firewall access to only the services that need it.`}),`\n`,_jsx(_components.li,{children:`Configure CORS only for browser clients that must call the server directly.`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_SESSION_API_KEYS_0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`-hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_SECRET_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`-hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OH_ALLOW_CORS_ORIGINS_0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://your-frontend.example.com\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openhands.agent_server`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8000`})]}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Do not expose an unauthenticated Agent Server on a public network. It can execute commands and read or write files in its configured workspace.`})}),`\n`,_jsx(Heading,{level:`2`,id:`runtime-files`,children:`Runtime Files`}),`\n`,_jsxs(_components.p,{children:[`By default, the server stores conversation and workspace data under `,_jsx(_components.code,{children:`workspace/`}),` relative to the process working directory:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`workspace/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`|-- bash_events/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`|-- conversations/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:\"`-- project/\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Run the server from a directory with enough disk space and with permissions appropriate for the files the agent should access.`}),`\n`,_jsx(Heading,{level:`2`,id:`useful-endpoints`,children:`Useful Endpoints`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GET /health`}),` - Basic health check.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GET /ready`}),` - Readiness check after startup initialization.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GET /server_info`}),` - Version, uptime, and available tool information.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GET /docs`}),` - Interactive OpenAPI documentation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`/api/*`}),` - Authenticated conversation, workspace, file, command, and settings APIs when session API keys are configured.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting`,children:`Troubleshooting`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`401 responses`}),`: Send `,_jsx(_components.code,{children:`X-Session-API-Key`}),` with one of the configured `,_jsx(_components.code,{children:`OH_SESSION_API_KEYS_*`}),` values.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Secrets disappear after restart`}),`: Set a stable `,_jsx(_components.code,{children:`OH_SECRET_KEY`}),` before starting the server.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Port already in use`}),`: Change the port with `,_jsx(_components.code,{children:`--port`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Browser CORS errors`}),`: Add the browser origin with `,_jsx(_components.code,{children:`OH_ALLOW_CORS_ORIGINS_0`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Cannot reach the server from another host`}),`: Check `,_jsx(_components.code,{children:`--host`}),`, firewall rules, reverse proxy routing, and TLS configuration.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next Steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdk/guides/agent-server/local-server`,children:`Local Agent Server`}),` - Run and connect to a local server.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdk/guides/agent-server/docker-sandbox`,children:`Docker Sandboxed Server`}),` - Run the server in an isolated Docker workspace.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdk/guides/agent-server/api-sandbox`,children:`API Sandboxed Server`}),` - Start agent servers through a hosted runtime API.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdk/guides/agent-server/api-reference/server-details/alive`,children:`Agent Server API Reference`}),` - Browse the generated REST API docs.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Agent Server Package","description":"Install, run, and secure the OpenHands Agent Server for remote agent execution.","href":"/sdk/arch/agent-server"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"When to Use It","slug":"when-to-use-it","depth":2,"children":[]},{"title":"Install","slug":"install","depth":2,"children":[]},{"title":"Start a Local Server","slug":"start-a-local-server","depth":2,"children":[]},{"title":"Secure the Server","slug":"secure-the-server","depth":2,"children":[]},{"title":"Connect From Python","slug":"connect-from-python","depth":2,"children":[]},{"title":"Expose It Safely","slug":"expose-it-safely","depth":2,"children":[]},{"title":"Runtime Files","slug":"runtime-files","depth":2,"children":[]},{"title":"Useful Endpoints","slug":"useful-endpoints","depth":2,"children":[]},{"title":"Troubleshooting","slug":"troubleshooting","depth":2,"children":[]},{"title":"Next Steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/allhandsai/dddab338317a519d/openhands/reo-init.js","/_mintlify/custom/allhandsai/ae719f15d762e1fe/openhands/posthog-init.js","/_mintlify/custom/allhandsai/a9d394cdba761c3d/openhands/canvas-handoff.js","/_mintlify/custom/allhandsai/771d6371c43b73b7/openhands/linkedin-copy-tracking.js"],"subdomain":"allhandsai","siteName":"OpenHands Docs","title":"Agent Server Package - OpenHands Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-06-22T01:48:35.255Z","originalFileLocation":"sdk/arch/agent-server.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=\"light\"}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=\"Install, run, and secure the OpenHands Agent Server for remote agent execution.\">\u003cmeta data-mint-head name=\"application-name\" content=\"OpenHands Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_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/allhandsai/NJyVpY-OoVetrcKF/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Agent Server Package - OpenHands Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Install, run, and secure the OpenHands Agent Server for remote agent execution.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"OpenHands Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.openhands.dev/sdk/arch/agent-server\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://allhandsai.mintlify.app/_mintlify/api/og/v2?division=Remote+Agent+Server\u0026amp;title=Agent+Server+Package\u0026amp;description=Install%2C+run%2C+and+secure+the+OpenHands+Agent+Server+for+remote+agent+execution.\u0026amp;theme=d1346828d5653c6c432bc1fc\u0026amp;signature=ae2f9a7f0e3c1434249ae49834f56feb3444e2ccb70d4f89ecd1da4d0241fe0d\">\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=\"Agent Server Package - OpenHands Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Install, run, and secure the OpenHands Agent Server for remote agent execution.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://allhandsai.mintlify.app/_mintlify/api/og/v2?division=Remote+Agent+Server\u0026amp;title=Agent+Server+Package\u0026amp;description=Install%2C+run%2C+and+secure+the+OpenHands+Agent+Server+for+remote+agent+execution.\u0026amp;theme=d1346828d5653c6c432bc1fc\u0026amp;signature=ae2f9a7f0e3c1434249ae49834f56feb3444e2ccb70d4f89ecd1da4d0241fe0d\">\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/allhandsai/NJyVpY-OoVetrcKF/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"OpenHands Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#99873c\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.openhands.dev/sdk/arch/agent-server\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk/arch/agent-server.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.openhands.dev/#organization\",\"name\":\"OpenHands Docs\",\"url\":\"https://docs.openhands.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/allhandsai/DjhqLcIy_hW6pRTg/logo/light.png?fit=max\u0026auto=format\u0026n=DjhqLcIy_hW6pRTg\u0026q=85\u0026s=49b636402b03f7279ca5e1afefeec1d2\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.openhands.dev#website\",\"name\":\"OpenHands Docs\",\"url\":\"https://docs.openhands.dev\",\"publisher\":{\"@id\":\"https://docs.openhands.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.openhands.dev/sdk/arch/agent-server#webpage\",\"url\":\"https://docs.openhands.dev/sdk/arch/agent-server\",\"name\":\"Agent Server Package\",\"description\":\"Install, run, and secure the OpenHands Agent Server for remote agent execution.\",\"dateModified\":\"2026-06-22T01:48:35.255Z\",\"isPartOf\":{\"@id\":\"https://docs.openhands.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.openhands.dev/sdk/arch/agent-server#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.openhands.dev/sdk/arch/agent-server#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://docs.openhands.dev/sdk/guides/hello-world\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remote Agent Server\",\"item\":\"https://docs.openhands.dev/sdk/guides/agent-server/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Agent Server Package\",\"item\":\"https://docs.openhands.dev/sdk/arch/agent-server\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.openhands.dev/sdk/arch/agent-server#article\",\"headline\":\"Agent Server Package\",\"name\":\"Agent Server Package\",\"description\":\"Install, run, and secure the OpenHands Agent Server for remote agent execution.\",\"url\":\"https://docs.openhands.dev/sdk/arch/agent-server\",\"mainEntityOfPage\":{\"@id\":\"https://docs.openhands.dev/sdk/arch/agent-server#webpage\"},\"dateModified\":\"2026-06-22T01:48:35.255Z\",\"publisher\":{\"@id\":\"https://docs.openhands.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.openhands.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"OpenHands Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"OpenHands Docs","nav":{"global":null,"tabs":[{"tab":"Home","pages":[{"title":"Home","href":"/overview/introduction"}]},{"tab":"Agent Canvas","pages":[{"title":"Agent Canvas","href":"/openhands/usage/agent-canvas/overview"}]},{"tab":"SDK","pages":[{"title":"Software Agent SDK","icon":"code","mode":"wide","href":"/sdk"},{"title":"Getting Started","icon":"rocket","href":"/sdk/getting-started"},{"title":"FAQ","icon":"question","href":"/sdk/faq"},{"group":"Guides","pages":[{"title":"Hello World","href":"/sdk/guides/hello-world"},{"title":"Custom Tools","href":"/sdk/guides/custom-tools"},{"title":"Structured Output","href":"/sdk/guides/structured-output"},{"title":"Model Context Protocol","href":"/sdk/guides/mcp"},{"title":"Agent Skills \u0026 Context","href":"/sdk/guides/skill"},{"title":"Plugins","href":"/sdk/guides/plugins"},{"title":"Persistence","href":"/sdk/guides/convo-persistence"},{"title":"Context Condenser","href":"/sdk/guides/context-condenser"},{"title":"Persistent Memory","href":"/sdk/guides/persistent-memory"},{"title":"Agent Settings","href":"/sdk/guides/agent-settings"},{"title":"Parallel Tool Execution","href":"/sdk/guides/parallel-tool-execution"},{"title":"Task Tool Set","href":"/sdk/guides/task-tool-set"},{"title":"Iterative Refinement","href":"/sdk/guides/iterative-refinement"},{"title":"Security \u0026 Action Confirmation","href":"/sdk/guides/security"},{"title":"Metrics Tracking","href":"/sdk/guides/metrics"},{"title":"Observability \u0026 Tracing","href":"/sdk/guides/observability"},{"title":"Secret Registry","href":"/sdk/guides/secrets"},{"group":"LLM Features","pages":[{"title":"LLM Subscriptions","href":"/sdk/guides/llm-subscriptions"},{"title":"LLM Registry","href":"/sdk/guides/llm-registry"},{"title":"Model Routing","href":"/sdk/guides/llm-routing"},{"title":"Reasoning","href":"/sdk/guides/llm-reasoning"},{"title":"GPT-5 Preset (ApplyPatchTool)","href":"/sdk/guides/llm-gpt5-preset"},{"title":"LLM Streaming","href":"/sdk/guides/llm-streaming"},{"title":"Image Input","href":"/sdk/guides/llm-image-input"},{"title":"Exception Handling","href":"/sdk/guides/llm-error-handling"},{"title":"LLM Fallback Strategy","href":"/sdk/guides/llm-fallback"},{"title":"LLM Profile Store","href":"/sdk/guides/llm-profile-store"},{"title":"Task-Based Model Routing","href":"/sdk/guides/llm-task-routing"}]},{"group":"Agent Features","pages":[{"title":"ACP Agent","href":"/sdk/guides/agent-acp"},{"title":"Interactive Terminal","href":"/sdk/guides/agent-interactive-terminal"},{"title":"Browser Use","href":"/sdk/guides/agent-browser-use"},{"title":"Browser Session Recording","href":"/sdk/guides/browser-session-recording"},{"title":"Creating Custom Agent","href":"/sdk/guides/agent-custom"},{"title":"File-Based Agents","href":"/sdk/guides/agent-file-based"},{"title":"Stuck Detector","href":"/sdk/guides/agent-stuck-detector"},{"title":"Ask Oracle","href":"/sdk/guides/agent-ask-oracle"},{"title":"Theory of Mind (TOM) Agent","href":"/sdk/guides/agent-tom-agent"},{"title":"Critic (Experimental)","href":"/sdk/guides/critic"}]},{"group":"Conversation Features","pages":[{"title":"Fork a Conversation","href":"/sdk/guides/convo-fork"},{"title":"Pause and Resume","href":"/sdk/guides/convo-pause-and-resume"},{"title":"Custom Visualizer","href":"/sdk/guides/convo-custom-visualizer"},{"title":"Send Message While Running","href":"/sdk/guides/convo-send-message-while-running"},{"title":"Conversation with Async","href":"/sdk/guides/convo-async"},{"title":"Ask Agent Questions","href":"/sdk/guides/convo-ask-agent"},{"title":"Goal Completion Loop","href":"/sdk/guides/convo-goal"},{"title":"Hooks","href":"/sdk/guides/hooks"}]},{"group":"Remote Agent Server","pages":[{"title":"Overview","href":"/sdk/guides/agent-server/overview"},{"title":"Local Agent Server","description":"Install and run an OpenHands Agent Server on your machine, then connect to it from the SDK.","href":"/sdk/guides/agent-server/local-server"},{"title":"Agent Server Package","href":"/sdk/arch/agent-server"},{"title":"Conversation Goals","description":"Add a resumable goal strategy to a normal agent-server conversation.","href":"/sdk/guides/agent-server/conversation-goals"},{"title":"Docker Sandbox","href":"/sdk/guides/agent-server/docker-sandbox"},{"title":"Apptainer Sandbox","href":"/sdk/guides/agent-server/apptainer-sandbox"},{"title":"API-based Sandbox","href":"/sdk/guides/agent-server/api-sandbox"},{"title":"OpenHands Cloud Workspace","href":"/sdk/guides/agent-server/cloud-workspace"},{"title":"Custom Tools with Remote Agent Server","href":"/sdk/guides/agent-server/custom-tools"},{"title":"OpenAI-Compatible Endpoint","href":"/sdk/guides/agent-server/openai-gateway"},{"title":"Deferred Init (Warm-Pool)","href":"/sdk/guides/agent-server/deferred-init"},{"group":"API Reference","pages":[{"group":"Server Details","pages":[{"title":"Alive","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /alive","href":"/sdk/guides/agent-server/api-reference/server-details/alive"},{"title":"Health","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /health","href":"/sdk/guides/agent-server/api-reference/server-details/health"},{"title":"Ready","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /ready","href":"/sdk/guides/agent-server/api-reference/server-details/ready"},{"title":"Get Server Info","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /server_info","href":"/sdk/guides/agent-server/api-reference/server-details/get-server-info"}]},{"group":"Events","pages":[{"title":"Search Conversation Events","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/{conversation_id}/events/search","href":"/sdk/guides/agent-server/api-reference/events/search-conversation-events"},{"title":"Count Conversation Events","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/{conversation_id}/events/count","href":"/sdk/guides/agent-server/api-reference/events/count-conversation-events"},{"title":"Get Conversation Event","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/{conversation_id}/events/{event_id}","href":"/sdk/guides/agent-server/api-reference/events/get-conversation-event"},{"title":"Batch Get Conversation Events","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/{conversation_id}/events","href":"/sdk/guides/agent-server/api-reference/events/batch-get-conversation-events"},{"title":"Send Message","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/events","href":"/sdk/guides/agent-server/api-reference/events/send-message"},{"title":"Respond To Confirmation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/events/respond_to_confirmation","href":"/sdk/guides/agent-server/api-reference/events/respond-to-confirmation"}]},{"group":"Conversations","pages":[{"title":"Search Conversations","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/search","href":"/sdk/guides/agent-server/api-reference/conversations/search-conversations"},{"title":"Count Conversations","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/count","href":"/sdk/guides/agent-server/api-reference/conversations/count-conversations"},{"title":"Get Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations/{conversation_id}","href":"/sdk/guides/agent-server/api-reference/conversations/get-conversation"},{"title":"Delete Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json delete /api/conversations/{conversation_id}","href":"/sdk/guides/agent-server/api-reference/conversations/delete-conversation"},{"title":"Update Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json patch /api/conversations/{conversation_id}","href":"/sdk/guides/agent-server/api-reference/conversations/update-conversation"},{"title":"Batch Get Conversations","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/conversations","href":"/sdk/guides/agent-server/api-reference/conversations/batch-get-conversations"},{"title":"Start Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations","href":"/sdk/guides/agent-server/api-reference/conversations/start-conversation"},{"title":"Pause Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/pause","href":"/sdk/guides/agent-server/api-reference/conversations/pause-conversation"},{"title":"Run Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/run","href":"/sdk/guides/agent-server/api-reference/conversations/run-conversation"},{"title":"Update Conversation Secrets","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/secrets","href":"/sdk/guides/agent-server/api-reference/conversations/update-conversation-secrets"},{"title":"Set Conversation Confirmation Policy","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/confirmation_policy","href":"/sdk/guides/agent-server/api-reference/conversations/set-conversation-confirmation-policy"},{"title":"Set Conversation Security Analyzer","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/security_analyzer","href":"/sdk/guides/agent-server/api-reference/conversations/set-conversation-security-analyzer"},{"title":"Generate Conversation Title","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/generate_title","href":"/sdk/guides/agent-server/api-reference/conversations/generate-conversation-title"},{"title":"Ask Agent","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/ask_agent","href":"/sdk/guides/agent-server/api-reference/conversations/ask-agent"},{"title":"Condense Conversation","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/conversations/{conversation_id}/condense","href":"/sdk/guides/agent-server/api-reference/conversations/condense-conversation"}]},{"group":"Tools","pages":[{"title":"List Available Tools","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/tools/","href":"/sdk/guides/agent-server/api-reference/tools/list-available-tools"}]},{"group":"Bash","pages":[{"title":"Search Bash Events","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/bash/bash_events/search","href":"/sdk/guides/agent-server/api-reference/bash/search-bash-events"},{"title":"Get Bash Event","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/bash/bash_events/{event_id}","href":"/sdk/guides/agent-server/api-reference/bash/get-bash-event"},{"title":"Batch Get Bash Events","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/bash/bash_events/","href":"/sdk/guides/agent-server/api-reference/bash/batch-get-bash-events"},{"title":"Start Bash Command","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/bash/start_bash_command","href":"/sdk/guides/agent-server/api-reference/bash/start-bash-command"},{"title":"Execute Bash Command","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/bash/execute_bash_command","href":"/sdk/guides/agent-server/api-reference/bash/execute-bash-command"},{"title":"Clear All Bash Events","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json delete /api/bash/bash_events","href":"/sdk/guides/agent-server/api-reference/bash/clear-all-bash-events"}]},{"group":"Git","pages":[{"title":"Git Changes","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/git/changes/{path}","href":"/sdk/guides/agent-server/api-reference/git/git-changes"},{"title":"Git Diff","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/git/diff/{path}","href":"/sdk/guides/agent-server/api-reference/git/git-diff"}]},{"group":"Files","pages":[{"title":"Upload File","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/file/upload/{path}","href":"/sdk/guides/agent-server/api-reference/files/upload-file"},{"title":"Download File","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/file/download/{path}","href":"/sdk/guides/agent-server/api-reference/files/download-file"},{"title":"Download Trajectory","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/file/download-trajectory/{conversation_id}","href":"/sdk/guides/agent-server/api-reference/files/download-trajectory"}]},{"group":"VSCode","pages":[{"title":"Get Vscode Url","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/vscode/url","href":"/sdk/guides/agent-server/api-reference/vscode/get-vscode-url"},{"title":"Get Vscode Status","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/vscode/status","href":"/sdk/guides/agent-server/api-reference/vscode/get-vscode-status"}]},{"group":"Desktop","pages":[{"title":"Get Desktop Url","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /api/desktop/url","href":"/sdk/guides/agent-server/api-reference/desktop/get-desktop-url"}]},{"group":"Skills","pages":[{"title":"Get Skills","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/skills","href":"/sdk/guides/agent-server/api-reference/skills/get-skills"},{"title":"Sync Skills","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/skills/sync","href":"/sdk/guides/agent-server/api-reference/skills/sync-skills"}]},{"group":"Hooks","pages":[{"title":"Get Hooks","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json post /api/hooks","href":"/sdk/guides/agent-server/api-reference/hooks/get-hooks"}]},{"group":"API Reference","pages":[{"title":"Get Server Info","deprecated":null,"version":null,"openapi":"/openapi/agent-sdk.json get /","href":"/sdk/guides/agent-server/api-reference/get-server-info"}]}]}]},{"group":"GitHub Workflows","pages":[{"title":"Assign Reviews","href":"/sdk/guides/github-workflows/assign-reviews"},{"title":"PR Review","href":"/sdk/guides/github-workflows/pr-review"},{"title":"TODO Management","href":"/sdk/guides/github-workflows/todo-management"}]}]},{"group":"Architecture","pages":[{"title":"Overview","href":"/sdk/arch/overview"},{"title":"Design Principles","href":"/sdk/arch/design"},{"group":"SDK Components","pages":[{"title":"Agent","href":"/sdk/arch/agent"},{"title":"Conversation","href":"/sdk/arch/conversation"},{"title":"Tool System \u0026 MCP","href":"/sdk/arch/tool-system"},{"title":"MCP Integration","href":"/sdk/arch/mcp"},{"title":"Events","href":"/sdk/arch/events"},{"title":"Workspace","href":"/sdk/arch/workspace"},{"title":"LLM","href":"/sdk/arch/llm"},{"title":"Skill","href":"/sdk/arch/skill"},{"title":"Condenser","href":"/sdk/arch/condenser"},{"title":"Security","href":"/sdk/arch/security"}]}]},{"group":"API Reference","pages":[{"title":"openhands.sdk.agent","href":"/sdk/api-reference/openhands.sdk.agent"},{"title":"openhands.sdk.conversation","href":"/sdk/api-reference/openhands.sdk.conversation"},{"title":"openhands.sdk.event","href":"/sdk/api-reference/openhands.sdk.event"},{"title":"openhands.sdk.llm","href":"/sdk/api-reference/openhands.sdk.llm"},{"title":"openhands.sdk.security","href":"/sdk/api-reference/openhands.sdk.security"},{"title":"openhands.sdk.tool","href":"/sdk/api-reference/openhands.sdk.tool"},{"title":"openhands.sdk.utils","href":"/sdk/api-reference/openhands.sdk.utils"},{"title":"openhands.sdk.workspace","href":"/sdk/api-reference/openhands.sdk.workspace"}]}]},{"tab":"Cloud","pages":[{"title":"Cloud","href":"/openhands/usage/cloud/openhands-cloud"}]},{"tab":"Enterprise","pages":[{"title":"Enterprise","href":"/enterprise"}]},{"tab":"Enterprise Cookbook","pages":[{"title":"Enterprise Cookbook","href":"/cookbook"}]}]},"title":"Agent Server Package - OpenHands Docs","buildId":"dpl_2oYXwqkEXirXBPk8wV1FtM5USFWi","deploymentId":"dpl_2oYXwqkEXirXBPk8wV1FtM5USFWi","dynamics":[],"chunks":[]}