Sub-Agents

Use of sub-agents must be allowed by enabling the session configuration allow_sub_agents. This in turn ensures the system prompt includes guidance on how and when to use sub-agents automatically when responding to user requests.

spawn_agent

Run a prompt in a completely fresh, isolated context window and receive the result as [query, response]. Ideal for consuming large amounts of tokens, handling self‑contained tasks, or avoiding context pollution.

Parameters

Parameter Type Required Description
prompt String Yes The full instruction for the sub‑agent; be explicit, especially when not including history.
include_caller_history Boolean No Set to true only when the task requires awareness of the current session (e.g., summarizing, continuing a thread). Defaults to false.

Notes

  • The tool spawns a temporary session, executes the prompt, and returns the query‑response pair. It is useful for multi‑step research or large codebase analysis.