Learn to build production-ready AI agents through real-world patterns extracted from OpenAI's Codex CLI
Beautiful, searchable, mobile-friendly documentation with:
- β¨ Interactive navigation through all 21 patterns
- π Full-text search across all content
- π± Mobile responsive design
- π Dark/light mode toggle
- π Progress tracking through learning paths
The Codex Agentic Patterns is a comprehensive learning resource that teaches you to build intelligent AI agents by studying real production code from OpenAI's Codex CLI. Instead of toy examples, you'll learn from battle-tested patterns used in production systems.
β
21 Agentic Design Patterns - Complete coverage
β
8 Fully Implemented Patterns - With runnable Python code
β
Production-Grade Examples - Not academic demos
β
Safety & Error Handling - Real-world robustness
β
Multi-Turn Conversations - Complex agent workflows
β
Tool Integration - External system connections
β
Human-in-the-Loop - Approval and oversight patterns
Visit the Interactive Documentation β
No setup required! Browse all patterns, search content, and explore at your own pace.
# Clone the repository
git clone https://github.com/artvandelay/codex-agentic-patterns.git
cd codex-agentic-patterns
# Navigate to learning materials
cd docs/learning-material
# Install dependencies
pip install -r requirements.txt
# Set up environment
export OPENAI_API_KEY="your-key-here"
# Run your first example
cd 01-prompt-chaining
python pattern_simple.pyπ Start learning production agentic patterns!
Start here if you're new to AI agents:
For developers with some AI experience:
For experienced developers wanting production patterns:
codex-agentic-patterns/
βββ docs/learning-material/ π Your learning journey starts here
β βββ 01-prompt-chaining/ β
Sequential workflows
β βββ 02-routing/ β
Dynamic dispatch
β βββ 03-parallelization/ β
Concurrent execution
β βββ 05-tool-use/ β
External integration
β βββ 16-sandbox-escalation/ β Advanced: Multi-stage execution
β βββ 17-turn-diff-tracking/ β Advanced: Git-style diffs
β βββ 18-rollout-system/ β Advanced: Session replay
β βββ complete-agent-example/ π Full production agent
βββ docs/ π Documentation site
This learning resource analyzes patterns from:
- OpenAI Codex CLI - The original Rust implementation we study
- 21 agentic patterns - Complete coverage from theory to practice
- 8 patterns fully implemented in Python with runnable code
- 13 patterns analyzed from Codex source with detailed explanations
- 500+ lines complete production agent example
- Production-grade error handling & safety mechanisms
This learning resource was created using AI-assisted education with Cursor and grounded in real production code:
- Source Analysis: Deep dive into OpenAI's Codex CLI Rust codebase
- Pattern Extraction: Identified agentic patterns using the Agentic Design Patterns textbook
- Python Implementation: Abstracted patterns into learnable Python examples
- Production Focus: Emphasized real-world complexity, not toy examples
- Iterative Refinement: Polished through multiple review cycles
This work builds upon:
- Agentic Design Patterns Complete - The foundational textbook defining 21 agentic patterns
- OpenAI Codex CLI - Production Rust implementation providing real-world examples
- Cursor - AI-powered development environment used for analysis and content generation
This is an educational resource created to make agentic AI patterns accessible to developers worldwide.
- Toy examples that don't scale
- Academic focus, not production-ready
- Missing error handling & edge cases
- No real-world complexity
- Production patterns from real systems
- Complete error handling & retry logic
- Safety mechanisms & approval workflows
- Multi-turn conversations & state management
- Tool integration with external systems
- Python 3.8+ with pip
- OpenAI API key (get one here)
- Basic understanding of Python and APIs
- Curiosity about building intelligent agents!
- Main Documentation Site - Beautiful, searchable interface
- Getting Started Guide - Your entry point
- Quick Setup - Get running in 10 minutes
- Complete Index - Navigate all content
- 11 Hands-on Exercises - From beginner to expert
- Pattern Implementations - Runnable Python code
- Complete Agent Example - 500+ line production example
- Codex Patterns Analysis - How production systems work
- Advanced Patterns - Production complexity
- Original Codex Source - Rust implementation
Found something unclear? Want to improve the materials?
- Open an issue - Report bugs or suggest improvements
- Start a discussion - Ask questions or share ideas
- Submit a PR - Fix typos, add examples, improve explanations
Guidelines: These are educational materials, so clarity and accuracy are paramount!
This educational resource is licensed under the MIT License.
The original Codex CLI and textbook retain their respective licenses.
If this helped you learn agentic AI patterns, please:
β Star this repository
π¦ Share on Twitter
πΌ Share on LinkedIn
π Write a blog post
Help others discover production-grade agentic patterns!
- Learning Materials - Start your journey
- Agentic Design Patterns Textbook - Original theory
- OpenAI Codex CLI - Production implementation
- OpenAI Platform - Get your API key
- Cursor - AI development environment
π Ready to build the future of AI? Start learning β
Built with β€οΈ using AI-assisted education β’ Created October 2025 β’ Version 1.0