Skip to main content

Module sub_agent

Module sub_agent 

Source
Expand description

Sub-agent tool: spawn a fresh agent loop with a restricted tool subset.

The parent agent can delegate focused sub-tasks to a child agent that starts with an empty transcript. This prevents the parent’s context window from growing with intermediate exploration steps.

Recursive safety: a depth limit (env RECURSIVE_SUBAGENT_MAX_DEPTH, default 2) prevents unbounded nesting. Each nested invocation increments a counter; when the limit is reached, the tool returns an error string instead of spawning.

Structs§

SubAgent
The sub-agent tool.