AgentSource syncs each upstream (the OpenClaw Gateway, the in-process native runtime) into SQLite on startup and on demand. Reads always serve SQLite, so the agent list keeps answering even when the Gateway connection is down — a stale flag marks that case. Writes (create, file updates, sessions) delegate to the owning source and return 503 when that source needs a live upstream connection that is unavailable.
These routes return Clawboo-native
AgentRecord shapes, not OpenClaw protocol shapes. A native (clawboo-native) agent is owned by a peer source whose reads and writes are pure SQLite and always work offline.Routes
| Method | Path | Summary |
|---|---|---|
GET | /api/agents | List all agents from every source |
POST | /api/agents | Create an agent through its source |
POST | /api/agents/sync | Manual sync of the OpenClaw source |
GET | /api/agents/registry/health | Server-side OpenClaw connection state |
POST | /api/agents/cleanup-ghosts | Sweep stale local rows not in the live set |
GET | /api/agents/:agentId | One agent record from its source |
DELETE | /api/agents/:agentId | Archive upstream and clean local rows |
GET | /api/agents/:agentId/files/:name | Read one agent file |
PUT | /api/agents/:agentId/files/:name | Write one agent file |
GET | /api/agents/:agentId/sessions | List the agent’s live sessions |
The AgentRecord shape
Every response that returns an agent uses this shape:
GET /api/agents
Returns the merged agent list across every registered source. All data is served from SQLite so the response succeeds even when the Gateway is disconnected.
Pass
"true" to include soft-deleted (archived) agents. Omit for live agents only.Filter agents to a specific team by its UUID.
Response 200 OK
The OpenClaw source’s Boo Zero id. Empty string if unset.
The OpenClaw main session key. Defaults to
"main" if unset.The merged agent list across all sources.
true when the server-side OpenClaw connection is not connected. SQLite data is still served.Epoch ms of the last successful sync with OpenClaw, or
null if never synced.POST /api/agents
Creates an agent through its owning source. By default this routes to the OpenClaw source, which returns 503 when the Gateway connection is down. Pass sourceId: "clawboo-native" to create a native agent using only SQLite — no Gateway required.
Request body
The agent’s display name. Trimmed; must be non-empty.
Assign the agent to a team by its UUID.
Personality slider values and optional custom text.
Execution permission settings (
execAsk, execSecurity).Seed string used to deterministically generate the agent’s avatar.
Agent files to write at creation time, keyed by filename (e.g.
"SOUL.md", "IDENTITY.md").The source to create the agent through. Defaults to
"openclaw". Pass "clawboo-native" for an offline-capable native agent.Responses
201 Created — the agent was created:
400 Bad Request — name is missing or blank:
503 Service Unavailable — the source needs a live Gateway that is down:
GET /api/agents/:agentId
Returns one agent record by its Clawboo id, routed to the source that owns the row.
Response 200 OK
404 Not Found — no agent with that id:
DELETE /api/agents/:agentId
Archives the agent. Deletes the upstream record, then cleans the local SQLite row and its FK-referenced children (cost_records, approval_history, per-agent settings keys). If the Gateway is disconnected, falls back to SQLite-only cleanup so the local row never rots.
The browser is responsible for the Gateway
agents.delete RPC. This endpoint cleans up Clawboo’s local metadata. Without it, deleted agents leave ghost rows that inflate per-team agent counts.Responses
200 OK — archived upstream and locally:
200 OK — Gateway was disconnected, so only local rows were cleaned:
GET /api/agents/:agentId/files/:name
Reads one agent file through the owning source. The :name segment must be one of the seven canonical filenames:
| Filename | Purpose |
|---|---|
AGENTS.md | Team context injected at session start |
SOUL.md | Personality and behavioral guidance |
IDENTITY.md | Agent identity and role definition |
USER.md | User self-introduction |
TOOLS.md | Tool usage preferences |
HEARTBEAT.md | Agent routine cadence |
MEMORY.md | Persistent memory notes |
Responses
200 OK:
400 Bad Request — unrecognized filename:
503 Service Unavailable — the owning source needs a live Gateway that is down:
PUT /api/agents/:agentId/files/:name
Writes one agent file through the owning source. Uses the same seven-filename allowlist as the read endpoint.
Request body
The file’s full content. Must be a string.
Response 200 OK
GET /api/agents/:agentId/sessions
Lists the agent’s live sessions. The OpenClaw source queries the Gateway live, so this returns 503 when disconnected.
Response 200 OK
POST /api/agents/sync
Reconciles the OpenClaw source’s upstream into SQLite. With no body it runs a server-side sync (needs the Gateway). With a body containing an agents array it runs a browser-fallback upsert — the browser pushes its own agents.list result so SQLite warms without the server’s own connection.
GET /api/agents/registry/health
Reports the server-side OpenClaw connection state. Always returns 200 — this is a liveness surface, not gated by the connection.
Response 200 OK
POST /api/agents/cleanup-ghosts
Sweeps stale local OpenClaw rows not present in the live Gateway set. Pass the ids of all agents currently alive in the Gateway; the endpoint deletes every local OpenClaw-owned row NOT in that list, plus its FK-referenced children.
Pass
"true" to permit an empty liveAgentIds array. Guards against a Gateway hiccup nuking all rows.Request body
The ids of all agents currently alive in the Gateway.
See also
- Agent model — Boo, Boo Zero, and the registry of record
- Teams API — assign an agent to a team
- Runtimes API — drive a board task on a runtime
- REST API overview