This repository is a comprehensive collection of Agentic Design Patterns implemented using the Google Agent Development Kit (ADK). It provides production-ready implementations, detailed documentation, and practical examples for building sophisticated AI agent systems.
Each pattern addresses specific challenges in agent designβfrom simple task chaining to complex multi-agent orchestrationβenabling developers to build reliable, maintainable, and scalable AI applications.
- Python 3.10+
- uv (recommended) or pip
Using uv (recommended):
# Clone the repository
git clone <repository-url>
cd agentic-design
# Create virtual environment and install dependencies
uv venv
uv pip install -e .
# Set up environment variables
cp .env.example .env
# Edit .env with your API keysUsing pip:
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e .Create a .env file with your API credentials:
GOOGLE_API_KEY=your_google_api_key_here
# Add other API keys as needed for specific patterns| Pattern | Description | Module |
|---|---|---|
| π Prompt Chaining | Sequential LLM calls for multi-step workflows | prompt-chaining/ |
| π§ Routing | Dynamic decision-making for adaptive systems | routing/ |
| β‘ Parallelization | Concurrent execution for performance optimization | Parallelization/ |
| π Reflection | Self-correction and iterative improvement | Reflection/ |
| π οΈ Tool Use | External tool integration via function calling | Tool_use/ |
| π€ Multi-Agent | Cooperative ensembles of specialized agents | Multi_Agent/ |
| π Planning | Strategic goal decomposition for complex tasks | Planning/ |
| π€ Human-in-the-Loop | Strategic human-AI collaboration | Human_in_the_loop/ |
| π‘οΈ Guardrails & Safety | Content policy enforcement and safety controls | Guardrails_Safety_Patterns/ |
| π Evaluation & Monitoring | Performance assessment and continuous monitoring | Evaluation_and_Monitoring/ |
| π― Prioritization | Task scheduling and importance-based execution | Prioritization/ |
| π Exploration & Discovery | Information gathering and knowledge expansion | Exploration_and_Discovery/ |
| π Goal Setting & Monitoring | Objective definition and progress tracking | Goal_setting_monitoring/ |
| π§ Learning & Adaptation | Continuous improvement from feedback | Learning_and_adaptation/ |
| π‘ Inter-Agent Communication | Standardized agent interaction protocols | Inter_Agent_Communication/ |
| π§ Resource-Aware Optimization | Efficient resource utilization and cost management | Resource_aware_optimisation/ |
| π§© Model Context Protocol | Context management and state handling | Model_context_protocol/ |
| Recovery and resilience patterns | Exception_handling_recovery/ |
These patterns define how agents make decisions and orchestrate tasks:
- Prompt Chaining β Sequential execution for multi-step processes
- Routing β Dynamic path selection based on context
- Parallelization β Concurrent execution of independent tasks
- Reflection β Iterative self-improvement through critique
These patterns extend agent capabilities through external integration:
- Tool Use β Function calling and external API integration
- Multi-Agent β Specialized agent collaboration
- Planning β Strategic goal decomposition
These patterns ensure reliable and safe agent operation:
- Guardrails & Safety β Content filtering and policy enforcement
- Human-in-the-Loop β Strategic human oversight
- Evaluation & Monitoring β Performance tracking and assessment
- Exception Handling β Recovery from failures
These patterns improve efficiency and effectiveness:
- Prioritization β Importance-based task scheduling
- Resource-Aware Optimization β Efficient resource utilization
- Learning & Adaptation β Continuous improvement
Divide complex tasks into sequential steps where each step refines the output.
Input β Step 1 β Step 2 β Step 3 β Output
When to use: Multi-stage workflows requiring progressive refinement
Example: Content generation (ideation β outline β draft β edit)
Dynamically route requests to specialized handlers based on intent.
Input β Router β Handler A / Handler B / Handler C
When to use: Different input types requiring specialized processing
Example: Customer support (billing, technical, sales)
Execute independent tasks concurrently to reduce latency.
ββ Task A ββ
Input ββΌβ Task B ββΌβ Synthesize β Output
ββ Task C ββ
When to use: Multiple independent operations (API calls, data processing)
Example: Research agent (search multiple sources simultaneously)
Generate β Critique β Refine for high-quality outputs.
Generate β Evaluate β Refine β Final Output
When to use: Quality-critical applications requiring accuracy
Example: Code generation with self-review
Extend agent capabilities through function calling and external APIs.
User Request β Agent β Tool Call β Execution β Response
When to use: Access to real-time data, calculations, or external systems
Example: Weather queries, database lookups, calculations
Coordinate multiple specialized agents to solve complex problems.
ββ Specialist A β
User βββ Coordinator βΌβ Specialist B β Synthesis β Output
ββ Specialist C β
When to use: Complex tasks requiring diverse expertise
Example: Software development team (requirements, coding, testing, docs)
Each pattern includes a runnable agent.py file. Execute any example:
# Using uv
uv run python prompt-chaining/agent.py
# Using Python directly
python prompt-chaining/agent.pyagentic-design/
βββ README.md # This file
βββ pyproject.toml # Project configuration
βββ .python-version # Python version specification
βββ agent.py # Main demo: Farm Management System
βββ main.py # Entry point placeholder
β
βββ prompt-chaining/ # Sequential pattern implementation
βββ routing/ # Dynamic routing pattern
βββ Parallelization/ # Concurrent execution pattern
βββ Reflection/ # Self-correction pattern
βββ Tool_use/ # Function calling pattern
βββ Multi_Agent/ # Agent collaboration pattern
βββ Planning/ # Goal decomposition pattern
βββ Human_in_the_loop/ # Human-AI collaboration
βββ Guardrails_Safety_Patterns/ # Safety and policy enforcement
βββ Evaluation_and_Monitoring/ # Performance tracking
βββ Prioritization/ # Task scheduling
βββ Exploration_and_Discovery/ # Information gathering
βββ Goal_setting_monitoring/ # Objective management
βββ Learning_and_adaptation/ # Continuous improvement
βββ Inter_Agent_Communication/ # Agent interaction protocols
βββ Resource_aware_optimisation/ # Resource management
βββ Model_context_protocol/ # Context handling
βββ Exception_handling_recovery/ # Resilience patterns
β
βββ assets/ # Documentation images and diagrams
# Run all tests
uv run pytest
# Run specific pattern tests
uv run pytest Evaluation_and_Monitoring/# Format code
uv run ruff format .
# Lint code
uv run ruff check .This repository uses the Google Agent Development Kit (ADK)βa comprehensive framework for building production-grade AI agents.
- Agents: LLM-powered agents with structured instructions
- Tools: Function calling for external integrations
- Sessions: State management for multi-turn conversations
- Runners: Orchestration and execution management
- Callbacks: Before/after model hooks for guardrails and personalization
- MCP Integration: Model Context Protocol for external tool access
- Start with Prompt Chainingβunderstand sequential workflows
- Explore Tool Useβadd external capabilities
- Study Reflectionβlearn self-correction
- Implement Routingβbuild decision-making agents
- Master Parallelizationβoptimize performance
- Design Multi-Agent systemsβcoordinate specialists
- Add Guardrails & Safetyβensure reliability
- Implement Evaluation & Monitoringβproduction readiness
- Explore Human-in-the-Loopβstrategic collaboration
| Use Case | Recommended Pattern |
|---|---|
| Multi-stage processing | Prompt Chaining |
| Intent classification | Routing |
| Multiple API calls | Parallelization |
| Quality-critical outputs | Reflection |
| External data access | Tool Use |
| Complex collaborative tasks | Multi-Agent |
| Step-by-step goal achievement | Planning |
| High-stakes decisions | Human-in-the-Loop |
| Content safety | Guardrails |
| Production monitoring | Evaluation & Monitoring |
- Decompose complex tasks into smaller, focused agents
- Compose patterns together for sophisticated behaviors
- Validate outputs at critical transition points
- Monitor performance in production environments
- Iterate based on real-world feedback
This repository is built upon the foundational work presented in Antonio Gulli's book on Agentic Design Patterns. The concepts, patterns, and architectural insights are drawn from his comprehensive research and expertise in the field.
- Antonio Gulli β For the foundational book on Agentic Design Patterns that inspired this implementation
- Google ADK Team β For the excellent agent framework
- Anthropic β For pioneering agentic AI patterns
- LangChain/LangGraph β For workflow orchestration concepts
Ready to build intelligent agents?
Start with prompt-chaining/ β Tool_use/ β Multi_Agent/