Anthropic Says Fold Your Subagents. Let's Build a Tiny Single Agent Loop in TypeScript
Description and use
The post explains moving from a hierarchical agent architecture to a single loop that loads skills and tools on demand, reducing prompt length and improving quality.
Problem
Organizational agent architectures create long prompts and lose context through handoffs.
Outcome
Running npx tsx loop.ts demonstrates a single loop handling a refund by loading only necessary skills and tools, then stopping at a write gate.
Workflow
- Define a two‑level catalog of skills and tools.
- Expose only the catalog (names and short descriptions) to the model at start.
- Implement loader tools that fetch full skill or tool definitions when needed.
- Run the agent loop with a limit on context size and a write gate.
- Execute the loop for a refund scenario, loading only required components.
- Terminate after the write gate is reached.
- Measure performance and compare to org‑chart approach.
Evidence
using fewer subagents in favor of progressively disclosed context and tools can improve quality while reducing cost and latency.
By the end, you'll run one command: npx tsx loop.ts
- Record date: 2026-10-25T22:11:22.881Z