You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/api-server/index.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,34 @@ All endpoints are under the `/api` prefix.
58
58
|`POST`|`/api/sessions/:id/agent/:agent`| Run the root agent for a session (SSE stream) |
59
59
|`POST`|`/api/sessions/:id/agent/:agent/:name`| Run a specific named agent (SSE stream) |
60
60
61
+
**Path parameters:**
62
+
63
+
-**`:agent`** — The agent identifier, which is the **config filename without the `.yaml` extension**. This must match the filename passed to `docker agent serve api`. For example, if you start the server with `docker agent serve api my-assistant.yaml`, the agent identifier is `my-assistant`. When serving a directory of YAML files, each file becomes a separate agent identified by its filename without the extension.
64
+
-**`:name`**_(optional)_ — The name of a specific sub-agent defined in a multi-agent configuration. If omitted, the request targets the `root` agent. For example, in a config that defines agents named `root`, `coder`, and `reviewer`, use `/api/sessions/:id/agent/my-config/coder` to run the `coder` sub-agent directly.
65
+
66
+
**Examples:**
67
+
68
+
```bash
69
+
# Single-agent config: my-assistant.yaml
70
+
# Start: docker agent serve api my-assistant.yaml
71
+
# Run the root agent:
72
+
curl -N -X POST http://localhost:8080/api/sessions/$SID/agent/my-assistant \
curl -N -X POST http://localhost:8080/api/sessions/$SID/agent/team \
80
+
-H "Content-Type: application/json" \
81
+
-d '[{"role": "user", "content": "Review this PR"}]'
82
+
83
+
# Run a specific sub-agent (reviewer):
84
+
curl -N -X POST http://localhost:8080/api/sessions/$SID/agent/team/reviewer \
85
+
-H "Content-Type: application/json" \
86
+
-d '[{"role": "user", "content": "Review this PR"}]'
87
+
```
88
+
61
89
### Health
62
90
63
91
| Method | Path | Description |
@@ -66,10 +94,11 @@ All endpoints are under the `/api` prefix.
66
94
67
95
## Streaming Responses
68
96
69
-
The agent execution endpoints (`POST /api/sessions/:id/agent/:agent`) return **Server-Sent Events (SSE)**. Each event is a JSON object representing a runtime event:
97
+
The agent execution endpoints (`POST /api/sessions/:id/agent/:agent`) return **Server-Sent Events (SSE)**. Each event is a JSON object representing a runtime event (remember that `:agent` is the config filename without the `.yaml` extension):
70
98
71
99
```bash
72
100
# Send a message and stream the response
101
+
# (assuming the server was started with: docker agent serve api my-agent.yaml)
73
102
$ curl -N -X POST http://localhost:8080/api/sessions/$SID/agent/my-agent \
0 commit comments