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 (or times out after 5 minutes).
| Parameter | Required | Description |
|---|---|---|
task |
yes | What to accomplish: exact goal, success criteria, expected output format. End with: "Complete ALL assigned work before responding. Your output is final." |
briefing |
no | All context the sub-agent needs (IPs, credentials, file paths, prior findings, step-by-step instructions). Sub-agent starts blank — include everything. |
profile_id |
no | Which profile to use (secretary, server_admin, developer). Defaults to current session's profile. |
system_prompt |
no | Role definition injected on top of the profile's built-in subagent prompt. Use to specialise the agent for this task (e.g. "You are a security auditor. Report findings by severity."). |
max_iterations |
no | Tool-call iteration limit (default: 20). |
Before spawning, write key working state to your scratchpad context_transfer section:
scratchpad(op="write", section="context_transfer", content="...")
This section is automatically injected into the sub-agent at the start of its context. Use it to pass findings from earlier tool calls or parallel agents without duplicating them in briefing.
Sub-agents receive a focused tool set (not all profile tools — no todo, switch_profile, email_manager, etc.):
| Profile | Sub-agent tools |
|---|---|
secretary |
scratchpad, reflect, web_search, web_view, http_request, filesystem, code_exec, image_view, memory, share_file, weather |
server_admin |
scratchpad, reflect, web_search, http_request, filesystem, code_exec, terminal, ssh_exec, image_view, share_file |
developer |
scratchpad, reflect, web_search, web_view, http_request, filesystem, code_exec, terminal, image_view, reload_tools, test_tool, share_file |
The result header tells you how the sub-agent finished:
[Sub-agent completed ...] — finished normally; synthesise the findings.[Sub-agent hit iteration limit ...] — may be incomplete; note what's missing in your response.Never repeat the result header to the user. Synthesise findings in your own words.
{
"task": "Check CPU temperature and memory usage. Return a structured table: metric, value, unit, status (ok/warn/crit). Complete ALL assigned work before responding. Your output is final.",
"briefing": "Host: 192.168.1.75\nUser: gmikcon\nPassword: getroot\nUse ssh_exec to connect. Check temperature via 'sensors' or /sys/class/thermal. Check memory via 'free -h'.",
"profile_id": "server_admin"
}
{
"task": "Audit the SSH configuration for security issues.",
"briefing": "Host: 192.168.1.75, user: gmikcon, password: getroot.",
"profile_id": "server_admin",
"system_prompt": "You are a security auditor. For each finding report: setting name, current value, risk level (critical/warning/info), recommended fix."
}
The user cannot see sub-agent output — you must present the findings yourself.