Production-style and beginner-friendly AI agent examples that map directly to the guides on agentpatterns.tech.
If you want to learn how to build agents with real execution loops, tool boundaries, routing, and safety checks, this repo is the fastest way to run and inspect working code.
- Learn by running real code, not pseudo-code.
- Move from simple loops to advanced multi-step agent patterns.
- Reuse minimal, clean implementations in your own projects.
- Follow examples that are aligned with concrete docs and architecture explanations.
The most important block of the site and the main architecture layer for production agents.
| Example | Local path | Article |
|---|---|---|
| ReAct Agent | examples/agent-patterns/react-agent/python |
Read article |
| Routing Agent | examples/agent-patterns/routing-agent/python |
Read article |
| Task Decomposition Agent | examples/agent-patterns/task-decomposition-agent/python |
Read article |
| Example | Local path | Article |
|---|---|---|
| Write Your First Agent | examples/start-here/write-your-first-agent/python |
Read article |
| Tool Calling Basics | examples/foundations/tool-calling-basics/python |
Read article |
| Tool Calling | examples/foundations/tool-calling/python |
Read article |
| LLM Limits in Agents | examples/foundations/llm-limits-agents/python |
Read article |
examples/
agent-patterns/
react-agent/
python/
routing-agent/
python/
task-decomposition-agent/
python/
foundations/
tool-calling-basics/
python/
tool-calling/
python/
llm-limits-agents/
python/
start-here/
write-your-first-agent/
python/
CATEGORY=agent-patterns
EXAMPLE=react-agent
cd examples/$CATEGORY/$EXAMPLE/pythonpython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export OPENAI_API_KEY="sk-..."
python main.py- Python 3.10+ (3.11+ recommended)
OPENAI_API_KEYenvironment variable- macOS/Linux shell commands above (adapt activation/export commands on Windows)
- Docs explain when and why to use each agent pattern.
- This repo shows runnable implementations of those exact patterns.
- Each example folder includes its own README with direct links to related concepts.
MIT