HTTP API

Every alineod route — runs, agents, control actions, and results.

Base URL: http://localhost:4600 by default. Request bodies are JSON. Errors are returned as { "error": "<message>" } with an appropriate status; an invalid body is 400 and names each failing field.

MethodPathDescription
GET/healthLiveness check.
POST/runsCreate a run and its root agent.
GET/runs/:runIdThe run's spawn tree.
DELETE/runs/:runIdStop every live agent in the run.
GET/runs/:runId/eventsThe run's event stream (SSE).
POST/runs/:runId/agentsSpawn a child agent.
GET/agents/:agentIdOne agent's state and session stats.
POST/agents/:agentId/promptStart a new turn.
POST/agents/:agentId/steerRedirect the current turn.
POST/agents/:agentId/pauseFreeze the agent's container.
POST/agents/:agentId/resumeThaw a paused container.
POST/agents/:agentId/stopAbort and close the agent.
GET/agents/:agentId/resultGet, or wait for, the agent's result.

Runs

POST /runs

Create a run with one root agent. Returns 202; the sandbox is provisioned in the background and prompt, if set, runs once it's ready.

FieldTypeDescription
specobjectAn agent spec, validated by the SDK. Required.
promptstringFirst turn to run on the root agent.
budget.spawnDepthintegerOverrides the spec's spawnDepth.
budget.maxAgentsintegerOverrides the spec's maxAgents.
// 202
{ "runId": "r_3f9a1c20", "rootAgentId": "a_7b2e44d1", "state": "provisioning" }

If provisioning fails, the root ends with outcome failed and the error appears on its agent_ended event.

GET /runs/:runId

The run's whole tree as a flat list with parent pointers. asOf is the highest ledger seq reflected in the response — pass it as Last-Event-ID to stream everything after this snapshot.

{
  "runId": "r_3f9a1c20",
  "rootAgentId": "a_7b2e44d1",
  "asOf": 42,
  "agents": [
    {
      "agentId": "a_7b2e44d1",
      "runId": "r_3f9a1c20",
      "parentAgentId": null,
      "depth": 0,
      "spawnIndex": 0,
      "state": "done",
      "specName": "coordinator",
      "sandboxId": "6a69afcb-7a00-437a-9819-e032022cc736",
      "createdAt": 1789000000000,
      "endedAt": 1789000071000,
      "outcome": "success"
    }
  ]
}

404 if the run doesn't exist.

DELETE /runs/:runId

Aborts and closes every live agent in the run, ending each with outcome aborted. The run's ledger is kept, so GET /runs/:runId and its event stream still work afterwards. Returns 204; 404 if the run doesn't exist.

GET /runs/:runId/events

A Server-Sent Events stream for the whole run. Send Last-Event-ID to replay persisted events after that seq. See Events.

Agents

POST /runs/:runId/agents

Spawn a child by forking a live parent's sandbox. Returns 202.

FieldTypeDescription
parentAgentIdstringA live agent in this run. Required.
specobjectThe child's agent spec. Required.
promptstringTurn to run once the child is ready.
waitForstring[]Agents in this run whose results must settle before the child is forked. Their results are written to /inputs/.
budget.spawnDepthintegerOverrides the parent's remaining spawnDepth.
budget.maxAgentsintegerOverrides the parent's remaining maxAgents.
idempotencyKeystringA retry with the same key returns the original child instead of creating another.
// 202
{ "agentId": "a_c01d9e3a", "state": "provisioning" }

state is spawning when waitFor is set.

StatusWhen
400Invalid body, or waitFor names an agent not in this run.
404parentAgentId isn't an agent in this run.
409The parent isn't live.

A spawn refused by a budget still returns 202; the child then ends with outcome budget-exceeded and a budget_denied event is emitted. See Fan-out and gather.

GET /agents/:agentId

The agent's view (same fields as an entry in GET /runs/:runId) plus sessionStats from the harness when available. sessionStats is omitted while the agent is paused, or if the harness doesn't answer within 2 seconds. 404 if the agent doesn't exist.

POST /agents/:agentId/prompt

{ "text": "Now write tests for the fix." }

Starts a new turn and returns 202 immediately; follow it on the event stream or via the result route. 409 if the agent isn't live.

POST /agents/:agentId/steer

{ "message": "Focus only on src/auth." }

Delivers a steering message to the current turn — after its running tool calls finish, before the next model call. Returns 202 and emits agent_steered. Applies to this agent only.

StatusWhen
404No such agent.
409The agent isn't live.
502The harness didn't accept the message.

See Steering and pausing.

POST /agents/:agentId/pause

Freezes the agent's container. Returns 202 and emits agent_state_changed (to: "paused"). A no-op if already paused. 404 if no such agent, 409 if not live, 502 if the sandbox couldn't be paused.

POST /agents/:agentId/resume

Thaws a paused container and returns the agent to running. Returns 202. 404 if no such agent, 409 if the agent isn't paused or isn't live, 502 if the sandbox couldn't be resumed.

POST /agents/:agentId/stop

{ "mode": "abort" }

Aborts the current turn, closes the sandbox, and ends the agent with outcome aborted. The body is optional; mode is abort (default) or drain, which currently behaves the same. Returns 202; 404 if no such agent.

Results

GET /agents/:agentId/result

QueryDescription
waitSeconds to hold the request open while the result is pending. Maximum 240. Default 0.

Settled — 200:

{
  "agentId": "a_e4b7d210",
  "state": "settled",
  "outcome": "success",
  "resultRef": "fs://a_e4b7d210/result.md",
  "result": "Three Landscapes\n\n..."
}

Still pending after wait202:

{ "agentId": "a_e4b7d210", "state": "pending", "outcome": null, "resultRef": null, "result": null }

404 if the agent doesn't exist. resultRef is null when a turn failed without producing any text.