Skip to content

[docs] API server: clarify the :agent parameter in session endpoints #2074

@k33g

Description

@k33g

Description

The API server documentation documents the following endpoints:

/api/sessions/:id/agent/:agent
/api/sessions/:id/agent/:agent/:name

However, it does not explain what the :agent parameter actually represents.

What is unclear

  • Is :agent the YAML filename (without .yaml extension)?
  • Is it a field defined inside the YAML config itself?
  • Is it always root, or something else?

What I discovered through trial and error

The :agent parameter is the config filename without the .yaml extension, matching the file passed to docker agent serve api. For example:

# Start the server with this config file:
docker agent serve api config.01.golang.expert.yaml

# The correct agent identifier in the URL is:
POST /api/sessions/:id/agent/config.01.golang.expert

Using root or any other value results in the request failing silently or returning unexpected behavior.

Additionally

The difference between the two endpoint variants is not explained:

POST /api/sessions/:id/agent/:agent         # When to use?
POST /api/sessions/:id/agent/:agent/:name   # When to use?

It is unclear when to use :name and what it refers to (a sub-agent name defined in the YAML?).

Suggested fix

  1. Explicitly document that :agent is the config filename without the .yaml extension.
  2. Add a concrete example with a real filename (not a placeholder).
  3. Explain the difference between the two endpoint variants and when each should be used, with an example showing how to target a specific sub-agent (e.g., coder or reviewer in a multi-agent config).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiFor features/issues/fixes related to the usage of the cagent APIkind/documentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions