The best agent architecture is a simple while loop
Claude Code and the pi agent show the same thing: a main loop, a few general-purpose tools and careful context management beat elaborate orchestration.
Written by
-
Benedikt Stemmildt Founder & Co-CEO
Published: 20 January 2026 Updated: 1 min read
Everyone’s building complex agent architectures. The best ones are embarrassingly simple.
We now know how Claude Code works under the hood. There’s an even simpler agent called “pi” that goes further with less. Both prove the same thing: the winning architecture is a while loop.
Not a DAG. Not a classifier chain. Not 40 specialized tools. Just: run tool, get result, repeat.
What makes minimal agents work
A simple main loop
While there are tool calls, run the tool, give the results to the model, repeat. Four lines of code.
Bash is all you need
Every other tool is optional. Bash has the most training data. The model knows it best.
Context is the bottleneck
The longer your context, the stupider your agent. Sub-agents exist to fork context, not to specialize.
Trust the model
Frontier models are RL-trained extensively. They understand what a coding agent is. Don’t over-engineer around flaws that will be fixed in months.
Less tooling, better results
The “pi” agent uses 4 tools. No MCP. No plan mode. No to-dos. Its system prompt is under 1000 tokens. It outperforms complex agents on coding benchmarks.
What this means for your agents
Drop these:
- Complex DAGs with 20 routing nodes
- ML classifiers deciding which prompt to run
- Hundreds of specialized tool calls
- RAG pipelines stuffed into every request
Build these instead:
- A simple while loop
- A few general-purpose tools
- Context management via sub-agents
- Room for the model to explore
The Zen of Python applies
“Simple is better than complex. Flat is better than nested.” That is the whole architecture.
The teams winning with AI aren’t building elaborate orchestration. They’re trusting simple loops and getting out of the way.
Are you building complex agent architectures? Or simple ones that actually work?
Further reading
Written by
-
Benedikt Stemmildt · Founder & Co-CEO
More on Coding agent setup
- Claude Code can now navigate your code like an IDE Claude Code used to search a codebase with grep and text matching. With Language Server Protocol plugins it gets real code intelligence: references, signatures and types.
- Agents should write code to call MCP tools, not call them directly In Anthropic's example, direct MCP tool calls took 150,000 tokens and an agent writing code to call the same tools took 2,000. Code execution is the way to use MCP.
- For tools you own, build a CLI before an MCP server Every MCP server loads all its tools into context before the agent starts. Keep MCP for external services and give your own tools a CLI, scripts or skills, which cost a fraction of the context.
Test the constraint in your system
The Factory Readiness Assessment connects this research to your value stream, your data, and the next decision.
Training on this topic: Agentic Engineering for Developers and QAWant to check one team first? The self-check: twelve yes or no questions, three minutes, instant result, no account. Take the self-check