16. Deep Read: AgentTool

What AgentTool Represents

AgentTool is where the product stops being “one model with tools” and starts becoming a multi-worker system. The file contains schemas for agent launching, background behavior, isolation modes, agent naming, team wiring, and remote execution variants.

What This Tells You About the Product

  • Subagents are not hacks. They have explicit input and output contracts.
  • Background execution is a product feature, not a side effect.
  • Worktree and remote isolation are first-class execution modes.
  • Agent orchestration is integrated with session storage, progress tracking, and UI rendering.

Why This Is Useful for Learning

Even if you never build a full multi-agent system, this file teaches how to structure delegated work as a typed task interface instead of letting one loop recursively improvise. It is an architecture lesson in delegation boundaries.

Source Navigation

Recommended Source Files

  • source/tools/AgentTool/AgentTool.tsx
  • source/tools/AgentTool/runAgent.ts
  • source/tools/AgentTool/agentToolUtils.ts
  • source/tools/AgentTool/forkSubagent.ts
  • source/tools/AgentTool/loadAgentsDir.ts

Next Files to Read

  • source/services/tools/toolOrchestration.ts
  • source/services/AgentSummary/agentSummary.ts
  • source/services/mcp/client.ts