Skip to content

spawn_agent

Delegate a task to a child AI agent in a dependent repository.

The child agent will execute the task in that repo and return the result. Use this after initializing a Polygraph session with start_session. Multiple agents per repo are supported via the optional role parameter (omitted = the default role, whose logs are the only ones uploaded to the cloud). Follow-up routing is automatic per agent: if the targeted repo+role already has an active task (in-progress or input-required), the instruction is delivered to that task as a follow-up message instead of starting a new run.

NameTypeRequiredDescription
sessionIdstringyesThe Polygraph session ID, or a supported Polygraph app session URL. Supported URL paths are /s/<session-id> and /orgs/<org-id>/sessions/<session-id>. URL inputs are normalized to the session ID; the MCP always uses the current Polygraph API configuration.
repostringyesRepo name or ID to delegate to
instructionstringyesTask instruction for the child agent
contextstringnoBackground context about the task
agentenumnoAI agent implementation to use for the delegated task. One of: claude, opencode, codex.
rolestringnoOptional role identifying which of the repo's agents to target; omit for the default agent.