π OpenHands: AI-Driven Development
Deployment Configuration
Supported deployment environment variables:
VITE_BACKEND_BASE_URLβ Agent Server base URL.VITE_SESSION_API_KEYβ optional session authentication.VITE_WORKING_DIRβ default workspace path sent when starting conversations.VITE_ENABLE_BROWSER_TOOLS=falseβ start the agent-server with the browser tool set off (OH_ENABLE_BROWSER=false).VITE_BASE_PATHβ serve the SPA under a subpath such as/canvas; pair it withscripts/static-server.mjs --base-pathat runtime.MARS_WEB=1β opt in to the experimental DigitalOcean web bridge. Keep it off by default until the integration is ready; session-key authentication is a separate requirement. Static children and Electron keep their bridge disabled so the web ingress is the only owner.
GitHub automation includes .github/workflows/ci.yml for npm ci, npm test, and npm run build, plus .github/dependabot.yml with weekly npm and GitHub Actions updates gated by a seven-day cooldown.
Runtime Services in Dev Stacks
- When the agent-canvas dev launchers (
npm run dev/dev:static/ the publishedagent-canvasbinary) start a stack with ingress/static-server, the backend-facing server appends runtime service metadata to/server_infoas the optionalruntime_servicesfield. The frontend reads that backend-provided value when creating conversations and forwards it asAgentContext.system_message_suffixonPOST /api/conversations, so conversations land with a<RUNTIME_SERVICES>block appended to the system prompt. - The block lists URLs from the agent's point of view:
- The Agent Server is always reachable as
http://localhost:<port>from inside the sandbox β but that is you, not the automation backend. - Host-side services (ingress, Vite, automation) are reachable as
http://localhost:<port>.
- The Agent Server is always reachable as
- Agents should treat the
<RUNTIME_SERVICES>block as authoritative: don't hardcodelocalhost:8000for "the automation server", and don't probe random ports trying to discover services. If the block says automation is not running, skip/api/automationcalls; otherwise use the listedurl_from_agent+api_prefix(default/api/automation) and theX-Session-API-Key: $OPENHANDS_AUTOMATION_API_KEYheader. - The launcher β backend β frontend β suffix plumbing is:
scripts/runtime-services-info.mjs::buildRuntimeServicesInfo()β dependency-free module that constructs the info object; also runs as a CLI for the Docker entrypoint. Re-exported byscripts/dev-safe.mjsfor backward compat.scripts/dev-with-automation.mjs::buildAutomationRuntimeServicesInfo()β wraps it with automation details.dev-with-automation,dev-static, and the published binary pass the JSON toscripts/ingress.mjsorscripts/static-server.mjsvia--runtime-services-info.scripts/ingress.mjsandscripts/static-server.mjsproxy the real agent-server/server_inforesponse and appendruntime_serviceswhen configured. This keeps version/tool compatibility fields authoritative from the SDK while letting the Agent Canvas stack advertise automation/frontend/ingress topology.src/api/agent-server-adapter.ts::fetchBackendRuntimeServicesInfo()readsruntime_servicesfrom cached or freshly fetched/server_info;buildRuntimeServicesSystemSuffix()renders the<RUNTIME_SERVICES>markdown block;buildAgentContext()attaches it toagent_context.system_message_suffixwhen present.- E2E coverage: the mock-LLM automation test (
tests/e2e/mock-llm/automations/mock-llm-automation.spec.ts) verifies the<RUNTIME_SERVICES>block reaches the LLM viagetMockLLMRequests()and checks for Agent Server, Automation backend, and/api/automationentries.
/server_info.runtime_services shape
The runtime_services value is a JSON object of:
{
"mode": "dev:automation",
"services": {
"agent_server": {
"description": "The OpenHands Agent Server this agent is running inside. ...",
"url_from_agent": "http://localhost:18000"
},
"ingress": {
"description": "Unified entry point. Routes /api/automation/* ...",
"url_from_agent": "http://localhost:8000"
},
"frontend": {
"kind": "vite",
"description": "Vite dev server hosting the agent-canvas frontend.",
"url_from_agent": "http://localhost:3001"
},
"automation": {
"description": "OpenHands Automations service. All routes are mounted under '/api/automation'. Authenticate with header 'X-Session-API-Key: $OPENHANDS_AUTOMATION_API_KEY'.",
"url_from_agent": "http://localhost:18001",
"api_prefix": "/api/automation",
"docs_url": "http://localhost:18001/api/automation/docs",
"openapi_url": "http://localhost:18001/api/automation/openapi.json",
"auth_env_var": "OPENHANDS_AUTOMATION_API_KEY"
}
}
}
All keys under services are optional and omitted when the corresponding service isn't running. frontend.kind is "vite" for dev launchers running the Vite dev server and "static" for stacks serving a pre-built build/ directory (dev:static, the published agent-canvas binary).
Example <RUNTIME_SERVICES> block (dev with automation)
<RUNTIME_SERVICES>
You are running inside an agent-canvas dev stack started in 'dev:automation' mode.
The following services are reachable from your sandbox. URLs are written
from your point of view (i.e., as you should curl/fetch them).
* Agent Server (you): http://localhost:18000
The OpenHands Agent Server this agent is running inside. Tool calls (terminal, file_editor, browser, etc.) execute here.
* Ingress: http://localhost:8000
Unified entry point. Routes /api/automation/* to the automation backend, /api/* and /sockets to the agent-server, and /* to the frontend.
* Frontend: http://localhost:3001
Vite dev server hosting the agent-canvas frontend.
* Automation backend: http://localhost:18001
OpenHands Automations service. All routes are mounted under '/api/automation'. Authenticate with header 'X-Session-API-Key: $OPENHANDS_AUTOMATION_API_KEY'.
Docs: http://localhost:18001/api/automation/docs
OpenAPI: http://localhost:18001/api/automation/openapi.json
Auth: header 'X-Session-API-Key: $OPENHANDS_AUTOMATION_API_KEY'
Trust this block over guessing: do not assume any other URLs are running.
In particular, http://localhost:18000 inside your sandbox is the Agent Server
you are running inside of β NOT the automation backend.
</RUNTIME_SERVICES>
README expectation: keep the first section as a concrete, chronological from-scratch quickstart for running this frontend against a real
openhands-agent-server(clone, install prerequisites, optional.env, runnpm run dev).Windows-specific command syntax (PowerShell) lives in
README.windows.md. When changing install / Docker sandbox instructions inREADME.md, updateREADME.windows.mdin the same PR to keep them in sync.scripts/dev-safe.mjsusesuvxfor temporary agent-server installation β no permanentuv tool installneeded. Environment variables (highest precedence first):OH_AGENT_SERVER_LOCAL_PATHβ absolute path to a localsoftware-agent-sdkcheckout. Runs the local checkout viauvxwith--with-editableforopenhands-sdk/openhands-tools/openhands-workspaceand--reinstallforopenhands-agent-server, so SDK edits are picked up on restart. Highest precedence.OH_AGENT_SERVER_GIT_REFβ git commit SHA or branch name (takes precedence over version)OH_AGENT_SERVER_VERSIONβ specific PyPI version (e.g., "1.58.1")UV_PYTHONβ Python version or range uvx may use for agent-server and automation. Defaults topython.uvxRequestinconfig/defaults.json(>=3.12,<3.15), so a machine with no supported Python downloads the newest 3.14 instead of the newest CPython, whose wheels the SDK's compiled dependencies lag behind (#18654).OH_SECRET_KEYβ secret key for settings encryption; auto-generated and persisted to~/.openhands/agent-canvas/secret-key.txton first run (same file Docker uses), ensuring dev mode and Docker share the same key when both mount the same~/.openhandsdirectory. Override with the env var to pin a specific key.SESSION_API_KEY/OH_SESSION_API_KEYS_0/VITE_SESSION_API_KEYβ session API key for agent-server authentication; auto-generated usingcrypto.randomBytes(32)if not set, passed to both agent-server (OH_SESSION_API_KEYS_0) and frontend (VITE_SESSION_API_KEY)- Default: released PyPI version
1.58.1for agent-server SDK libraries
Security: launchers generate and persist a 64-character session API key at
~/.openhands/agent-canvas/session-api-key.txtunless overridden. The agent-server and automation backend share that session key.OH_SECRET_KEYprotects settings encryption and is persisted separately at~/.openhands/agent-canvas/secret-key.txt.scripts/dev-safe.mjsshould fail fast ifuvxcannot be spawned (for example missing PATH entries).tools/holds Python modules the agent-server can import:buildAgentServerEnvexposes the directory throughOH_EXTRA_PYTHON_PATH(Docker:/opt/agent-canvas/tools, seedocker/entrypoint.sh).tools/canvas_ui_tool.pyis imported at startup via--import-modules canvas_ui_tool(appended bybuildAgentServerCommandand by both launch lines indocker/entrypoint.sh), not only lazily from persisted conversation metadata: besides the legacycanvas_uiregistration it registers the SDK's builtinFinishTool, soopenhands-automationβ₯ 1.9.0 presets β which dispatch remote conversations withfinish_tool_response_schema=TaskOutcomeand advertise the tool as the non-self-registeringopenhands.sdk.tool.builtins.finishβ do not fail every run withToolDefinition 'FinishTool' is not registered. Remove that registration once the SDK registers builtins for remote conversations.Every launcher points the agent-server at the installed
@openhands/extensionspackage throughEXTENSIONS_PATH, so the public skills Agent Profiles select (public_skills) are the files Canvas bundles and nothing is cloned.buildAgentServerEnvsets it fromresolveExtensionsDir()unless the environment already sets one; Docker copies the package to/opt/agent-canvas/node_modules/@openhands/extensionsand exports it indocker/entrypoint.sh; the desktop app ships it throughRUNTIME_PACKAGESinelectron-builder.config.mjs.npm run devruns the full local stack viauvx(agent-server + automation backend + Vite dev server + ingress proxy) with no Docker dependency.npm run dev:staticdoes the same but serves a production build of the frontend instead of the Vite dev server.scripts/dev-with-automation.mjsruns the full stack: agent-server, automation backend (both via uvx), frontend server, and ingress proxy. It defaults to Vite when run directly, supports--staticfor an existing build, and supports--dynamicso wrappers that default static can opt back into Vite. Uses a standalone ingress proxy (scripts/ingress.mjs) to route traffic:- Keep
SIGINT,SIGTERM, andSIGHUPwired through the coordinated shutdown handler. Services run in detached process groups on POSIX, so cleanup must usesignalProcessTree()rather than signaling only the direct child; regression coverage lives in__tests__/scripts/dev-with-automation.test.ts. main()prints the banner without waiting for the automation backend, then watches/api/automation/healthin the background. If automation exits before it is healthy (a failed database migration, #18299), the launcher stops every service it started and callsonAutomationStartupFailure: the CLI exits 1, and Electron replaces the splash or main window with its startup-failure screen. A slow start only logs a timeout. The Docker entrypoint still tolerates a dead automation backend./api/automation/*β automation backend (:18001)/api/*,/sockets, etc. β agent server (:18000)/*(default) β frontend server (:3001), either Vite or static depending on launcher mode- Environment variables:
PORT(ingress port, default fromconfig/defaults.json),OH_AUTOMATION_GIT_REF(git ref, overrides default version), andOH_AUTOMATION_VERSION(defaults toversions.automationinconfig/defaults.json) scripts/check-sdk-version-sync.mjschecks the releasedopenhands-automationpackage againstversions.agentServerinconfig/defaults.json; these must always match β if the automation package's SDK dependencies differ fromagentServer, the check fails.- Access points:
http://localhost:8000/(main UI),http://localhost:8000/api/automation/docs(API docs) - Security: the automation backend receives the same session key as the agent-server through
AUTOMATION_LOCAL_API_KEY; the frontend does not bake a separate automation API key.
- Keep
scripts/ingress.mjsis a standalone HTTP reverse proxy that can be used independently to route traffic to multiple backends based on URL path prefix.scripts/dev-safe.mjs(nownpm run dev:minimal) runs just agent-server + Vite without automation.Backend log level: every Canvas launch path defaults the spawned backends to
WARNINGso a plain launch is readable β atINFOthe automation service'ssetup_all_loggers()raises every registered logger, includingsqlalchemy.orm, which emits hundreds of model-mapping lines before the service is reachable. The policy lives inscripts/dev-safe.mjs(DEFAULT_BACKEND_LOG_LEVEL,backendLogLevel(),buildBackendLogEnv()), whichdev-with-automation.mjs,dev-static.mjs, anddocker/entrypoint.shall use; the same resolved level is passed to Uvicorn's--log-level, because that flag β notLOG_LEVELβ governs the startup banner and per-request access lines. Precedence:--verbose> an explicitLOG_LEVEL/AUTOMATION_LOG_LEVEL> theWARNINGdefault. Standalone automation-service deployments keep their ownINFOdefault; only what Canvas passes changes.WARNINGrather thanERRORis deliberate βERRORwould also hide the workspace-retention warning.- The two sides accept different vocabularies, so the Uvicorn argument is narrowed by
uvicornLogLevel()(and the shell'suvicorn_log_level()in the entrypoint) rather than forwarded verbatim. The app readsLOG_LEVELthrough Python's logging module, which also understandsWARN,FATAL,NOTSETand numeric levels; Uvicorn validates--log-levelwith aclick.Choiceovercritical | error | warning | info | debug | traceand exits2on anything else, which would take the service β and the dev stack β down. Aliases map to their equivalents (WARNβwarning,FATALβcritical), numbers map to the nearest name, and values with no Uvicorn equivalent (NOTSET,0, unrecognized strings) fall back toinfo, Uvicorn's own default. The env value keeps its raw form; only the CLI argument is narrowed.
- The two sides accept different vocabularies, so the Uvicorn argument is narrowed by
Centralized config:
config/defaults.jsonis the single source of truth for version pins (agent-server, automation, automation SDK), port defaults, persistence paths, and package names. All consumers read from this file:- JS scripts (
dev-safe.mjs,dev-with-automation.mjs,check-sdk-version-sync.mjs) read it viaJSON.parse(readFileSync(...)). - Docker: a
config-genbuild stage converts the JSON to/opt/agent-canvas/defaults.env(shell-sourceable);entrypoint.shsources it at startup. - CI workflow: a
Read defaults from config/defaults.jsonstep usesnode -pto extract values into$GITHUB_OUTPUT. - Dockerfile ARG defaults are kept as fallbacks for local
docker buildwithout the CI workflow; CI always passes--build-argoverrides from the JSON. - To bump a version, edit
config/defaults.jsononly β the JS scripts, Docker build, and CI workflow all derive their values from it.
- JS scripts (
Docker all-in-one image:
.github/workflows/docker.ymlbuilds and publishesghcr.io/openhands/agent-canvasβ a combined image that bundles the agent-server (fromghcr.io/openhands/agent-server), the automation server (openhands-automationvia pip), and the agent-canvas frontend (static build). The Dockerfile lives atdocker/Dockerfile, the entrypoint atdocker/entrypoint.sh. The workflow structure mirrors the SDK repo'sserver.yml: abuild-and-push-imagematrix job (2 Γ arch: amd64 onubuntu-24.04, arm64 onubuntu-24.04-arm) pushes arch-suffixed tags, thenmerge-manifestscreates multi-arch manifests viadocker buildx imagetools create, thenconsolidate-build-infoaggregates artifacts, andupdate-pr-descriptionupdates the PR body (using<!-- AGENT_CANVAS_DOCKER_START -->/<!-- AGENT_CANVAS_DOCKER_END -->markers). The workflow triggers on push to main,v*tags (releases), PRs, andworkflow_dispatch. On release tags it also pushes semver tags (e.g.1.2.3,1.2,1,latest). Fork PRs are skipped (no GHCR auth). On PRs that link anOpenHands/software-agent-sdkPR in the description, the Docker workflow uses that SDK PR's published branch image (ghcr.io/openhands/agent-server:<branch-with-slashes-as-dashes>-python) as the agent-server base image unless aworkflow_dispatchinput explicitly overrides it. The image exposes port 8000 as a unified entry point:/api/automation/*β automation (:18001),/api/*β agent-server (:18000),/*β static frontend. The Dockerfile accepts the publicVITE_POSTHOG_API_KEYbuild arg; CI passes staging for PR/main images and production for tagged releases. The npm release workflow passes the same production key to both the app and library builds. The entrypoint auto-generates both the session API key andOH_SECRET_KEY(persisted to~/.openhands/agent-canvas/session-api-key.txtandsecret-key.txtrespectively) when none is provided, so the image runs secure by default. Users can override either via env var (OH_SECRET_KEY,SESSION_API_KEY/OH_SESSION_API_KEYS_0).scripts/dev-safe.mjsuses the samesecret-key.txtfile, so dev mode and Docker share the same key when both use the same~/.openhandsdirectory.