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.
targetstringyesRepo 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 target a follow-up message at a specific active task instead of starting a new run. Unknown task ids are ignored and a fresh run is started.