Skip to content

Runnable examples for AgentPatterns.tech articles (safe agent loops, budgeting, tool calling demos).

License

Notifications You must be signed in to change notification settings

AgentPatterns-tech/agentpatterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentPatterns Examples: Runnable AI Agent Patterns in Python

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.

Why this repository

  • 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.

Available examples

Agent Patterns (Core Block)

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

Foundations

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

Project structure

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/

Quick start

1) Choose an example

CATEGORY=agent-patterns
EXAMPLE=react-agent
cd examples/$CATEGORY/$EXAMPLE/python

2) Install and run

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export OPENAI_API_KEY="sk-..."
python main.py

Prerequisites

  • Python 3.10+ (3.11+ recommended)
  • OPENAI_API_KEY environment variable
  • macOS/Linux shell commands above (adapt activation/export commands on Windows)

How this maps to agentpatterns.tech

  • 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.

License

MIT

About

Runnable examples for AgentPatterns.tech articles (safe agent loops, budgeting, tool calling demos).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors