Skip to content

spawn_agent

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

The child agent executes the task in the target repo and returns the result. Use after initializing a Polygraph session with start_session. Optionally specify the agent type (claude, opencode, codex) and pass a taskId to route follow-up messages to an existing active run rather than starting a new one.

NameTypeRequiredDescription
sessionIdstringyesThe Polygraph session ID, or a Polygraph app session URL (/s/<session-id> or /orgs/<org-id>/sessions/<session-id>).
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.
taskIdstringnoOptional task id from a prior delegate call. Pass this to route a follow-up message to a specific active task instead of starting a new run. Unknown task ids are ignored and a fresh run is started.