Skip to content

Commit e2610a1

Browse files
authored
Merge pull request #2213 from dgageot/board/fix-docker-agent-issue-2074-6f581fc3
docs: clarify :agent and :name parameters in API server endpoints
2 parents e1d1873 + ffd865e commit e2610a1

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

docs/features/api-server/index.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,34 @@ All endpoints are under the `/api` prefix.
5858
| `POST` | `/api/sessions/:id/agent/:agent` | Run the root agent for a session (SSE stream) |
5959
| `POST` | `/api/sessions/:id/agent/:agent/:name` | Run a specific named agent (SSE stream) |
6060

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 \
73+
-H "Content-Type: application/json" \
74+
-d '[{"role": "user", "content": "Hello!"}]'
75+
76+
# Multi-agent config: team.yaml (defines agents: root, coder, reviewer)
77+
# Start: docker agent serve api team.yaml
78+
# Run the root agent:
79+
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+
6189
### Health
6290

6391
| Method | Path | Description |
@@ -66,10 +94,11 @@ All endpoints are under the `/api` prefix.
6694

6795
## Streaming Responses
6896

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):
7098

7199
```bash
72100
# Send a message and stream the response
101+
# (assuming the server was started with: docker agent serve api my-agent.yaml)
73102
$ curl -N -X POST http://localhost:8080/api/sessions/$SID/agent/my-agent \
74103
-H "Content-Type: application/json" \
75104
-d '[{"role": "user", "content": "Hello!"}]'

0 commit comments

Comments
 (0)