Delegates a focused multi-step sub-task to an isolated agent instance with its own tool-calling loop and a clean context window. Returns the sub-agent's complete final response as a tool result.
CRITICAL: spawn_agent is SYNCHRONOUS. It blocks until the sub-agent fully completes. When the call returns, the work is done. There is no background process.
task (string, required) — what the sub-agent must accomplish, including success criteria and expected output formatbriefing (string) — all context from the current conversation the sub-agent needsprofile_id (string) — which profile to use (secretary, server_admin, smart_home); defaults to current session's profilemax_iterations (integer) — tool-call iteration limit (default: 20)For any task involving multiple sub-agents, state the plan in your response first:
Plan: 1. Agent A — audit network exposure on host X 2. Agent B — check auth config on host Y (independent of A) 3. Agent C — cross-reference findings from A and B → needs A and B results first
This prevents wasted spawns, wrong ordering, and missed dependencies.
Bad:
"Check the server security."
Good:
"Audit SSH configuration on the server. Check: PasswordAuthentication, PermitRootLogin, AllowUsers, Port, key-only auth enforcement. Return a list of findings with severity (critical/warning/info) and suggested fix for each."
Include:
The sub-agent knows nothing. Include everything it needs:
End every briefing with:
"Complete ALL assigned work before responding. Your output is final."
| Profile | Best for |
|---|---|
secretary |
Research, writing, file analysis, web lookups |
server_admin |
Remote ops, SSH, monitoring, infra changes |
smart_home |
Home Assistant, IoT, automations |
The user cannot see sub-agent output — you must present the findings yourself.
{
"task": "Read tools/get_current_datetime.py and tools/user_notes.py. For each file report: purpose, any external dependencies, potential security issues. Return as a structured list per file.",
"briefing": "Project root is /home/user/Projects/navi-1. Both files are small user-defined tools. No credentials needed — filesystem access is unrestricted.\n\nComplete ALL assigned work before responding. Your output is final.",
"profile_id": "secretary"
}