Key Insight: An AI coding agent is just a loop that lets a model call tools.
- The agent loop — the pattern behind every AI coding agent
- That one tool (bash) is enough for full capability
- How simple the "magic" behind Claude Code, Cursor, etc. really is
- Python 3.10+ installed
- Anthropic API key configured in
.env make installcompleted
make 01-agent-loop
# or
uv run python 01-agent-loop/agent.py- The loop — the agent keeps calling bash until it decides the task is done
- The model decides — you don't tell it which commands to run, it figures it out
- One tool is enough — bash gives access to everything: files, search, execution
User → Model → [bash → result]* → Response
^____________|
The asterisk (*) means "repeat until done." That's the whole secret.
| File | Lines | Description |
|---|---|---|
agent.py |
~130 lines (17-line core loop) | The complete agent |
Ready for more? → 02: Bash Agent