docker agent serve api command starts an HTTP server that exposes your agents through a REST-style API with Server-Sent Events (SSE) streaming.
Starting the server
Flags
| Flag | Default | Description |
|---|---|---|
-l, --listen <addr> | 127.0.0.1:8080 | Address to listen on |
-s, --session-db <path> | session.db | Path to the SQLite session database |
--pull-interval <mins> | 0 (disabled) | Auto-pull OCI reference every N minutes |
--working-dir <path> | (current dir) | Working directory for sessions |
Endpoints
All endpoints are under the/api prefix.
Agents
| Method | Path | Description |
|---|---|---|
GET | /api/agents | List all available agents |
GET | /api/agents/:id | Get a specific agent’s configuration |
Sessions
| Method | Path | Description |
|---|---|---|
GET | /api/sessions | List all sessions |
POST | /api/sessions | Create a new session |
GET | /api/sessions/:id | Get a session by ID (messages, tokens, permissions) |
DELETE | /api/sessions/:id | Delete a session |
PATCH | /api/sessions/:id/title | Update the session title |
PATCH | /api/sessions/:id/permissions | Update session permissions |
POST | /api/sessions/:id/resume | Resume a paused session (after tool confirmation) |
POST | /api/sessions/:id/tools/toggle | Toggle auto-approve (YOLO) mode |
POST | /api/sessions/:id/elicitation | Respond to an MCP tool elicitation request |
Agent execution
| Method | Path | Description |
|---|---|---|
POST | /api/sessions/:id/agent/:agent | Run the root agent (SSE stream) |
POST | /api/sessions/:id/agent/:agent/:name | Run a specific named agent (SSE stream) |
Health
| Method | Path | Description |
|---|---|---|
GET | /api/ping | Health check — returns {"status": "ok"} |
Streaming responses
Agent execution endpoints return Server-Sent Events (SSE). Each event is a JSON object:Integration patterns
- Web frontend
- CI/CD pipeline
- OCI registry
Build a chat UI that creates sessions via
POST /api/sessions, then streams responses using the EventSource API: