Skip to content

Latest commit

 

History

History
245 lines (169 loc) · 9.88 KB

File metadata and controls

245 lines (169 loc) · 9.88 KB

🤖 Codex Agentic Patterns

🚨 NEW: Check out the successor to this project! Agentic Design Patterns in Production — extracting patterns from the 500K-line Claude Code source leak.

Learn to build production-ready AI agents through real-world patterns extracted from OpenAI's Codex CLI

License: MIT Python 3.8+ OpenAI Documentation Ask DeepWiki

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

🎯 What Is This?

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.

📚 What You'll Master

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


🚀 Quick Start

🌐 Option 1: Browse Online (Recommended)

Visit the Interactive Documentation →

No setup required! Browse all patterns, search content, and explore at your own pace.

💻 Option 2: Run Code Locally

# 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!


📖 Learning Paths

🟢 Beginner (1-2 weeks)

Start here if you're new to AI agents:

🟡 Intermediate (2-3 weeks)

For developers with some AI experience:

🔴 Advanced (3-4 weeks)

For experienced developers wanting production patterns:


🏗️ What's Inside?

📁 Repository Structure

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

🔗 Related Repositories

This learning resource analyzes patterns from:

📊 By The Numbers

  • 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

🎓 How This Was Created

This learning resource was created using AI-assisted education with Cursor and grounded in real production code:

📝 Our Process

  1. Source Analysis: Deep dive into OpenAI's Codex CLI Rust codebase
  2. Pattern Extraction: Identified agentic patterns using the Agentic Design Patterns textbook
  3. Python Implementation: Abstracted patterns into learnable Python examples
  4. Production Focus: Emphasized real-world complexity, not toy examples
  5. Iterative Refinement: Polished through multiple review cycles

🙏 Attribution

This work builds upon:

This is an educational resource created to make agentic AI patterns accessible to developers worldwide.


🌟 Why This Matters

❌ Traditional AI Tutorials

  • Toy examples that don't scale
  • Academic focus, not production-ready
  • Missing error handling & edge cases
  • No real-world complexity

✅ Agentic Patterns Codebook

  • Production patterns from real systems
  • Complete error handling & retry logic
  • Safety mechanisms & approval workflows
  • Multi-turn conversations & state management
  • Tool integration with external systems

🛠️ Prerequisites

  • Python 3.8+ with pip
  • OpenAI API key (get one here)
  • Basic understanding of Python and APIs
  • Curiosity about building intelligent agents!

📚 Learning Resources

🌐 Interactive Documentation (Start Here!)

🎯 Practice & Exercises

🔍 Deep Analysis


🤝 Contributing

Found something unclear? Want to improve the materials?

  1. Open an issue - Report bugs or suggest improvements
  2. Start a discussion - Ask questions or share ideas
  3. Submit a PR - Fix typos, add examples, improve explanations

Guidelines: These are educational materials, so clarity and accuracy are paramount!


📄 License

This educational resource is licensed under the MIT License.

The original Codex CLI and textbook retain their respective licenses.


🌟 Star & Share

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!


🔗 Links


🚀 Ready to build the future of AI? Start learning →


Built with ❤️ using AI-assisted education • Created October 2025 • Version 1.0