21 runnable reference implementations for understanding common LLM-agent workflow patterns.
This repository is a clean-room educational reference library containing runnable implementations of 21 agent design primitives. Each directory isolates one pattern and pairs the implementation with a small practical example.
The goal is not to present one universal agent framework. It is to make individual orchestration ideas easy to inspect, run, compare, and combine.
Project status: educational reference implementations. CI verifies repository structure and Python syntax; examples that call external model APIs are not treated as production systems or exercised end to end without credentials.
| # | Pattern | Reference use case |
|---|---|---|
| 1 | Prompt Chaining | Sequential document processing |
| 2 | Routing | Request classification and delegation |
| 3 | Parallelization | Concurrent analysis and synthesis |
| 4 | Reflection | Generate, critique, refine |
| 5 | Tool Use | Function calling and external tools |
| 6 | Planning | Goal decomposition and task execution |
| 7 | Multi-Agent | Specialized agent collaboration |
| 8 | Memory | Conversation state and persistence |
| 9 | Adaptation | Feedback-driven behavior changes |
| 10 | MCP | Standardized tool/resource integration |
| 11 | Goal Setting | Goal breakdown and progress tracking |
| 12 | Exception Handling | Fallback and recovery workflows |
| 13 | Human-in-the-Loop | Escalation and human feedback |
| 14 | RAG | Retrieval-augmented generation |
| 15 | Inter-Agent Communication | Agent-to-agent messaging |
| 16 | Resource Optimization | Caching, batching, and cost control |
| 17 | Reasoning | Structured problem-solving workflows |
| 18 | Guardrails | Validation and policy checks |
| 19 | Evaluation | LLM-as-a-Judge and quality assessment |
| 20 | Prioritization | Priority-based task ordering |
| 21 | Exploration | Testing multiple candidate approaches |
Clone the repository:
git clone https://github.com/josephsenior/Agentic-Design-Patterns.git
cd Agentic-Design-Patterns
cp .env.example .envMove into a pattern directory, install its dependencies, and run the example:
cd prompt_chaining
pip install -r requirements.txt
python example.pySome examples use Gemini. Add the required API key to the pattern's .env file when needed.
Each implementation is intentionally small and pattern-focused:
pattern_name/
├── implementation.py
├── example.py
├── README.md
├── requirements.txt
└── .env.example
Exact filenames can vary by pattern, but the examples are organized so the orchestration primitive remains easy to identify.
- Prompt Chaining
- Planning
- Goal Setting
- Prioritization
These patterns organize work over time and make task progression explicit.
- Routing
- Reflection
- Adaptation
- Exploration
These patterns select, critique, revise, or compare candidate paths.
- Tool Use
- Multi-Agent
- Inter-Agent Communication
- MCP
These patterns connect agents to capabilities or to other specialized agents.
- Memory
- RAG
These patterns provide persistent conversational state or external knowledge retrieval.
- Exception Handling
- Human-in-the-Loop
- Guardrails
- Evaluation
- Resource Optimization
These patterns help make agent workflows more observable, bounded, and testable.
| Combination | Use case |
|---|---|
| Routing + Tool Use | Select the right capability for each request |
| Planning + Evaluation | Validate progress before advancing |
| RAG + Tool Use | Combine retrieved context with external actions |
| Memory + Adaptation | Use historical feedback to adjust behavior |
| Multi-Agent + Inter-Agent Communication | Coordinate specialized roles |
| Guardrails + Exception Handling | Bound actions and recover from failures |
- Engineers learning agent orchestration beyond single-prompt applications
- Students comparing common LLM-agent patterns
- Builders looking for small references before integrating a pattern into a larger system
For a larger autonomous-agent runtime that combines planning, tools, execution, durability, and validation, see Grinta.
Issues and pull requests are welcome.
MIT — see LICENSE.