The runtime serves HTTP on 127.0.0.1:4741, and CONDENSATE_AGENTS_PORT changes the port. It binds to loopback only, so a caller on another machine comes in through Tailscale Serve or another front you run on the same computer. The SDK wraps most routes and decodes their answers, so prefer it from TypeScript. Request and response schemas are in packages/agents-host/src/http.ts, and the HTTP route index lists every route.
A spawn's optional engine field picks the agent that runs the thread: Claude Code (claude), Codex (codex) or Condensate's own agent (condensate). Without it, a Claude model runs on claude and most other models on condensate.
Errors
A refusal is JSON with an error message. A refusal a program should act on also carries a code, so branch on the code and not the message. A plain input error, such as a bad limit, is a 400 with only error.
| Status | Code | Meaning |
|---|---|---|
| 400 | spawn-cwd-required | A build thread has no cwd. Pass a worktree |
| 400 | spawn-cwd-fenced | The cwd is inside a checkout the runtime keeps agents out of |
| 400 | account-not-in-roster | The spec names an account the workspace doesn't allow. The body lists the allowed ones |
| 400 | model-not-allowed | The model is outside the workspace's allowed list. The body lists the allowed models |
| 400 | head-slot-without-head | The spec names a lead agent in spec.head, but the spawn is not one |
| 404 | no-head | The workspace has no lead agent of that name |
| 409 | head-name-taken | The workspace already has a lead agent of that name. The body names its thread |
| 409 | not-a-head | A role change names a thread that is not a lead agent |
| 429 | session-cap | The runtime is running as many sessions as it allows. Retry after Retry-After |
| 429 | thread-list-rate-limited | Too many first-page listings. Retry after Retry-After |
| 429 | stream-cap | The thread has as many live stream readers as it allows. Use follow instead |
| 503 | draining | The runtime is getting ready to restart. Retry after Retry-After |
| 503 | spawns-paused | New spawns are paused because disk space is low. Retry after Retry-After |
A path no route matches returns 404 with { "error", "build" }. build is the commit the runtime runs, the same one GET /health reports, so you can tell a route your build doesn't have yet from a typo.
Secrets in a spawn spec never come back in an answer. Any field whose name ends in a word such as apiKey, token, secret or password, every value under env and proxyEnv, and credential headers all read as [redacted]. The runtime goes by field names and does not scan text, so a key pasted into a URL or a title is shown as written.
Read threads
| Method | Route | Purpose |
|---|---|---|
| GET | /threads | A page of thread summaries. Query: limit (default 50, at most 200), after (the nextAfter cursor), sort (created or recent), archived (live, archived or all), role, type, workspace and parent |
| GET | /threads/:id | The thread, its stage, cost so far, archive flag and location |
| GET | /threads/:id/tail | A page of the event log. after=<seq> reads forward and before=<seq> reads older events newest first. limit defaults to 200 and caps at 1000. wait=<ms> holds the request open for new events, up to 30 seconds |
| GET | /threads/:id/follow | Server-sent events from the log. Resumes from after or the Last-Event-ID header |
| GET | /threads/:id/stream | Server-sent live text as the model writes it. Nothing is replayed, and a slow reader loses its oldest frames |
| GET | /threads/:id/agui | The thread as an AG-UI event stream, from after=<seq> |
| GET | /threads/:id/turn | Whether a turn is running |
| GET | /threads/:id/tool-results/:seq | The full body of one tool result |
A forward page returns events, nextAfter and hasMore, and a reverse page returns prevBefore and hasMore. Keep the two cursors apart.
location is null while no agent is running the thread, and its next message starts one. Otherwise it names the runner (process, k8s, container or worker), the machine and the reason it was placed there, which Where agents run explains.
To watch one thread, poll tail or open follow. To watch many, follow GET /workspaces/:name/changes and re-read only the threads that changed, because polling the first page of GET /threads gets rate-limited.
curl -fsS 'http://127.0.0.1:4741/threads?limit=20'
curl -fsS 'http://127.0.0.1:4741/threads/THREAD_ID/tail?limit=20'
Start work
| Method | Route | Purpose |
|---|---|---|
| POST | /spawn | Create a thread from a spawn spec. Returns { threadId } |
| POST | /threads/:id/messages | Append a message. Returns 202 with its seq and ts as soon as it is stored, before any model runs. hold: true keeps it as a draft you can edit with PATCH or remove with DELETE /threads/:id/messages/:seq |
| POST | /threads/:id/send | Send a message and wait for the reply |
| POST | /threads/:id/fork | Start a new thread that continues this one as it stood at atSeq |
| POST | /threads/:id/interrupt | Stop the running turn |
| POST | /threads/:id/approvals/:approvalId | Answer a tool approval with { "decision": "allow" } or "deny". An approval already closed answers approval-closed |
| POST | /threads/:id/questions/:requestId/answer | Answer a question the agent asked. /dismiss and /continue drop it or go on without an answer |
| POST | /threads/:id/seats/replace | Change an agent's engine, model or placement, keeping its name and history |
| POST | /threads/:id/compact | Shrink the thread's context now |
| DELETE | /threads/:id?reason= | Archive a thread. Nothing is deleted; one archive event is added |
| POST | /threads/:id/restore | Bring an archived thread back |
A 202 means the runtime stored the request, not that the work succeeded, so read the log for the outcome.
Workspaces
| Method | Route | Purpose |
|---|---|---|
| GET | /workspaces, /workspaces/:name | The configured workspaces, or one of them |
| PUT | /workspaces/:name/policy | Replace the workspace's policy |
| GET | /workspaces/:name/heads | Every live lead agent |
| GET | /workspaces/:name/approvals | Every tool call waiting on approval, with its thread |
| GET | /workspaces/:name/questions | Open questions across the workspace |
| GET | /workspaces/:name/changes | Server-sent changes to the workspace's threads |
| POST | /workspaces/:name/memory/recall, /retain | Search and add to the workspace's memory |
A workspace can have several lead agents. A spawn names one in spec.head, for example { "name": "triage", "lane": "incoming bug reports" }, where name is 1 to 48 lowercase letters, digits or dashes and lane is one sentence on its area of work. A spawn with no name starts the default lead agent.
Reviews and code
| Method | Route | Purpose |
|---|---|---|
| POST | /workspaces/:name/rooms | Start a review of a pull request |
| GET | /workspaces/:name/rooms?repo=&pr= | Find a pull request's review and its newest round |
| POST | /rooms/:id/rounds | Run another review round |
| POST | /rooms/:id/finalize | Post a round's verdict as a GitHub review |
| POST | /workspaces/:name/prs/:number/agents | Start a build thread on the pull request's branch, in a worktree the runtime owns |
| GET | /code/roots, /code/files, /code/read | Browse and read the registered repositories |
| POST | /code/search | Search code with a pattern |
| GET | /github/:owner/:repo/prs | The repository's pull requests |
Completions
POST /v1/chat/completions and GET /v1/models are an OpenAI-compatible endpoint over your signed-in accounts. Each call is one model call with no tools and no thread, so use POST /spawn for agent work. Name the workspace to charge in the x-condensate-workspace header, which you can leave out when CONDENSATE_COMPLETIONS_DEFAULT_WORKSPACE is set. x-condensate-session takes an optional label of up to 128 characters, and x-condensate-traffic: smoke marks a test call. stream: true returns server-sent deltas.
Errors use OpenAI's shape, { "error": { "message", "type", "code" } }. Common codes are unknown_workspace (400), model_not_found (404), no_eligible_account (409), accounts_exhausted (429) and rate_limited (429).
Operator inbox
A lead agent writes to the operator, the person who runs this machine, with its message_operator tool. The operator answers here. The POST route files an agent's message under the caller's own thread. The runtime gives each MCP server it starts a key for its thread, in CONDENSATE_THREAD_KEY beside CONDENSATE_THREAD_ID. The caller sends both in the x-condensate-thread and x-condensate-thread-key headers. A restart of the runtime makes new keys.
| Method | Route | Purpose |
|---|---|---|
| POST | /operator/messages | An agent's message (text, urgency, refs, and an optional from_thread that must be the caller's thread), or the operator's reply (in_reply_to, text), which is delivered to the asking thread as a message. 400 bad-request for a body that does not decode; 403 caller-unbound for an agent message without a valid thread key; 403 sender-mismatch when from_thread is not the caller's thread; 403 caller-refused for a reply from an agent client; 404 thread-not-found when the caller's thread is gone; 404 operator-message-not-found for an unknown in_reply_to; 502 steer-failed when the reply cannot reach the asking thread; 503 draining for a reply while the runtime waits to restart |
| GET | /operator/messages?after=<seq> | Up to 500 inbox rows after seq, and last_seq. 400 bad-cursor when after is not a nonnegative integer |
| GET | /operator/messages/stream | The same rows as server-sent events, live. after=<seq> or Last-Event-ID resumes |
Operate the runtime
| Method | Route | Purpose |
|---|---|---|
| GET | /health | The build commit, the fields /spawn accepts, and any open memory alert |
| GET | /live | Live threads |
| GET | /metrics | Runtime metrics |
| GET, POST, DELETE | /drain | Read, start or cancel a drain before a restart |
| GET | /keeper/spawn-pause | Whether spawns are paused. POST /keeper/spawn-pause/clear lifts it |
| GET | /attention | Everything waiting on a person |
| GET | /incidents | Turns that failed |
During a drain or a spawn pause, new threads get 503 with Retry-After, and running turns carry on. Account routes are under /accounts, covered in Accounts.
Setup and Tailscale
These four routes back Dex's setup page. They answer only a page on the same computer, and refuse anything else with 403 and a code: peer-refused for a caller on another machine, proxied for a request with a forwarding header such as X-Forwarded-For, and origin-refused for a page on another site. The two POST routes also need an application/json body, and answer 415 json-required without one.
| Method | Route | Purpose |
|---|---|---|
| GET | /setup | The four steps, github, claude, codex and tailscale, each with a state (not-started, waiting, done, skipped or failed), and firstRun |
| POST | /setup/:step/skip | Skip claude, codex or tailscale. GitHub can't be skipped, because cloning needed it |
| GET | /tailscale | The node's state, a loginUrl while it needs a login, and its node name and address once it serves |
| POST | /tailscale/login/start | Ask the node for a login address |
firstRun is true while no Claude or Codex account is signed in and no step is skipped. A failure answers { "code", "id" }, and the log line tailscale_failed id=<id> or setup_failed id=<id> has the detail.
| Status | Code | Meaning |
|---|---|---|
| 503 | tailscale-unreachable | No Tailscale node answers, or this install runs none |
| 410 | tailscale-login-expired | The node's key expired. POST /tailscale/login/start gets a new login address |
| 409 | tailscale-login-refused | The tailnet refused this node, or has not approved it yet |
| 502 | serve-failed | The node runs but has no certificate name. Turn on HTTPS certificates for the tailnet |
| 503 | setup-write-failed | The skip could not be saved |
| 404 | answer-unreadable | That step can't be skipped |