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.

§Agent types (subagent_type)

Inspired by fake-cc’s AgentTool, this tool accepts an optional subagent_type parameter that selects a named agent personality:

  • "explore": read-only tools only; declared ReadOnly so the dispatch layer can run multiple explore sub-agents in parallel.
  • "general_purpose" (default): full tool access; declared External.

Structs§

SubAgent
The sub-agent tool.

Enums§

AgentType
Named sub-agent personality, aligned with fake-cc’s subagent_type.