ExAthena.Tools.SpawnAgent (ExAthena v0.3.0)

Copy Markdown View Source

Synchronously run a sub-agent-loop with its own prompt, tools, and budget.

Useful for delegating a bounded task (exploring a codebase, summarising a file) to a fresh conversation with its own message history — so the parent loop doesn't pay the token cost of the sub-task's intermediate steps.

Arguments:

  • prompt (required) — the sub-agent's opening message.
  • tools (optional) — list of tool names to expose to the sub-agent; defaults to whatever the parent had (minus PlanMode + SpawnAgent to avoid loops).
  • max_iterations (optional, default 10) — cap on agent-loop iterations.
  • system_prompt (optional) — system prompt override for the sub-agent.

Inherits the parent's provider / model / permissions unless overridden in ctx.assigns[:spawn_agent_opts].