Welcome to the comprehensive tutorial collection for the Claude PHP Agent Framework! These step-by-step guides will help you master every agent type and pattern in the framework.
New to the framework? Start here:
-
Service Layer Getting Started ⭐ NEW: INFRASTRUCTURE
- Best for: Production applications needing enterprise features
- Learn: Service management, dependency injection, configuration
- Time: 30 minutes
- Difficulty: Beginner-friendly
-
Adaptive Agent Service Tutorial ⭐ RECOMMENDED START
- Best for: Everyone - automatic agent selection
- Learn: Intelligent routing, quality validation, adaptive retry
- Time: 60 minutes
- Difficulty: Beginner-friendly
Master the foundational agent types:
-
Chain of Thought Agent Tutorial
- Best for: Reasoning and step-by-step logic
- Learn: Zero-shot and few-shot CoT, transparent reasoning
- Time: 45 minutes
- Difficulty: Beginner
-
- Best for: Multi-domain tasks requiring specialization
- Learn: Master-worker patterns, task delegation
- Time: 50 minutes
- Difficulty: Intermediate
-
- Best for: Long-running, persistent goal-oriented tasks
- Learn: State management, goal tracking, multi-session work
- Time: 55 minutes
- Difficulty: Intermediate
Build production-ready systems:
-
- Best for: Intelligent alerting and notification systems
- Learn: Multi-channel delivery, severity classification, deduplication
- Time: 40 minutes
- Difficulty: Intermediate
-
- Best for: Multi-agent orchestration and load balancing
- Learn: Agent coordination, capability matching, workload distribution
- Time: 45 minutes
- Difficulty: Advanced
Build chat and dialog systems:
-
- Best for: Multi-turn conversations and chatbots
- Learn: Session management, context tracking, conversation flow
- Time: 40 minutes
- Difficulty: Beginner
-
Intent Classifier Agent Tutorial
- Best for: Intent recognition and NLU
- Learn: Intent classification, entity extraction, routing
- Time: 35 minutes
- Difficulty: Beginner
Explore sophisticated agent behaviors:
-
- Best for: Adaptive systems that improve over time
- Learn: Experience replay, strategy evolution, feedback loops
- Time: 50 minutes
- Difficulty: Advanced
-
Task Prioritization Agent Tutorial
- Best for: Goal-driven task management (BabyAGI pattern)
- Learn: Dynamic task generation, priority queues, adaptive planning
- Time: 45 minutes
- Difficulty: Advanced
-
Environment Simulator Agent Tutorial
- Best for: What-if analysis and prediction
- Learn: Scenario simulation, outcome prediction, risk assessment
- Time: 40 minutes
- Difficulty: Intermediate
Recent additions to the framework:
-
- Best for: Runtime component validation by instantiation
- Learn: Dynamic class loading, constructor validation, comprehensive error handling
- Time: 45 minutes
- Difficulty: Intermediate
-
- Best for: Enterprise service management with dependency injection
- Learn: ServiceManager, custom services, lifecycle management
- Time: 50 minutes
- Difficulty: Intermediate
-
- Best for: Model Context Protocol integration with Claude Desktop
- Learn: MCP tools, agent discovery, custom tools, SSE transport
- Time: 55 minutes
- Difficulty: Advanced
-
- Best for: AI-powered code generation with validation
- Learn: CodeGenerationAgent, validation pipelines, retry logic, templates
- Time: 50 minutes
- Difficulty: Intermediate
-
- Best for: Production-ready deployment and operations
- Learn: Error handling, logging, observability, caching, security, monitoring
- Time: 60 minutes
- Difficulty: Advanced
-
- Best for: Comprehensive testing approaches
- Learn: Unit tests, feature tests, integration tests, mocking, coverage
- Time: 55 minutes
- Difficulty: Intermediate
Choose a path based on your goals:
Goal: Get productive fast with automatic agent selection
- ✅ Adaptive Agent Service - Start here!
- ✅ Dialog Agent - Build a chatbot
- ✅ Intent Classifier - Add routing
Time: ~2.5 hours
Outcome: Working chatbot with intelligent routing
Goal: Master the latest framework capabilities (v0.7.0 - v0.8.0)
- ✅ Component Validation - Runtime validation
- ✅ Services System - Enterprise services
- ✅ MCP Server - Claude Desktop integration
- ✅ Code Generation - AI code generation
- ✅ Production Patterns - Production deployment
- ✅ Testing Strategies - Comprehensive testing
Time: ~5.5 hours
Outcome: Production-ready AI systems with latest features
Goal: Master systematic problem-solving agents
- ✅ Chain of Thought - Step-by-step reasoning
- ✅ Autonomous Agent - Goal-oriented behavior
- ✅ Task Prioritization - Dynamic planning
Time: ~2.5 hours
Outcome: Intelligent reasoning and planning systems
Goal: Build enterprise-ready AI systems
- ✅ Adaptive Agent Service - Quality assurance
- ✅ Alert Agent - Monitoring and notifications
- ✅ Coordinator Agent - Multi-agent orchestration
Time: ~2.5 hours
Outcome: Production-grade AI infrastructure
Goal: Coordinate multiple specialized agents
- ✅ Hierarchical Agent - Master-worker pattern
- ✅ Coordinator Agent - Load balancing
- ✅ Adaptive Agent Service - Intelligent selection
Time: ~2.5 hours
Outcome: Complex multi-agent architectures
Goal: Build systems that improve over time
- ✅ Learning Agent - Experience-based improvement
- ✅ Adaptive Agent Service - Performance tracking
- ✅ Environment Simulator - Prediction
Time: ~2.5 hours
Outcome: Self-improving AI systems
Each tutorial follows a consistent structure:
- Introduction - Overview and learning objectives
- Conceptual Explanation - What the agent does and why
- Setup - Installation and prerequisites
- Tutorial 1-7 - Progressive hands-on exercises
- Common Patterns - Real-world usage patterns
- Troubleshooting - Common issues and solutions
- Next Steps - Where to go from here
- Code Examples: All code is complete and runnable
- Progressive Learning: Each tutorial builds on previous concepts
- Copy-Paste Ready: Examples work out of the box
- Production Focus: Best practices throughout
| Use Case | Recommended Tutorial | Difficulty |
|---|---|---|
| Don't know which agent to use | Adaptive Agent Service | Beginner |
| Build a chatbot | Dialog Agent | Beginner |
| Route user requests | Intent Classifier | Beginner |
| Step-by-step reasoning | Chain of Thought | Beginner |
| Quality-critical content | Adaptive Agent Service | Beginner |
| Multi-domain tasks | Hierarchical Agent | Intermediate |
| Long-running projects | Autonomous Agent | Intermediate |
| Monitoring & alerts | Alert Agent | Intermediate |
| What-if analysis | Environment Simulator | Intermediate |
| Multi-agent coordination | Coordinator Agent | Advanced |
| Task management | Task Prioritization | Advanced |
| Adaptive systems | Learning Agent | Advanced |
| Component validation | Component Validation | Intermediate |
| Service management | Services System | Intermediate |
| Claude Desktop integration | MCP Server | Advanced |
| AI code generation | Code Generation | Intermediate |
| Production deployment | Production Patterns | Advanced |
| Testing strategies | Testing Strategies | Intermediate |
Beginner (Start here!)
- Adaptive Agent Service ⭐
- Dialog Agent
- Intent Classifier Agent
- Chain of Thought Agent
Intermediate (Some experience recommended)
- Hierarchical Agent
- Autonomous Agent
- Alert Agent
- Environment Simulator Agent
Advanced (Requires solid understanding)
- Coordinator Agent
- Task Prioritization Agent
- Learning Agent
If you're unsure where to begin, start with the Adaptive Agent Service Tutorial. It:
- ✅ Works with any task type
- ✅ Handles agent selection automatically
- ✅ Includes quality validation
- ✅ Great for learning agent capabilities
Every tutorial includes complete, runnable code:
# Copy the example
cp tutorial_example.php my_project.php
# Run it!
php my_project.phpAfter completing a tutorial:
- Try different configurations
- Combine multiple agents
- Build small projects
- Share your creations!
Each tutorial references:
- API documentation
- Agent selection guide
- Best practices
- Related tutorials
- Ask questions
- Share solutions
- Report issues
- Contribute improvements
- PHP 8.1+
- Composer for dependencies
- Anthropic API Key (Get one here)
# Install the framework
composer require claude-php/agent
# Set your API key
export ANTHROPIC_API_KEY='your-key-here'
# Or create .env file
echo "ANTHROPIC_API_KEY=your-key-here" > .env- Monolog - Logging (included)
- PHPUnit - Testing
- PHP-CS-Fixer - Code formatting
| Tutorial | Time | Difficulty | Agents Used | Best For |
|---|---|---|---|---|
| Adaptive Agent Service | 60min | ⭐ Beginner | Multiple | Everyone! |
| Chain of Thought | 45min | ⭐ Beginner | 1 | Reasoning |
| Dialog Agent | 40min | ⭐ Beginner | 1 | Chatbots |
| Intent Classifier | 35min | ⭐ Beginner | 1 | NLU |
| Hierarchical Agent | 50min | ⭐⭐ Intermediate | 2+ | Multi-domain |
| Autonomous Agent | 55min | ⭐⭐ Intermediate | 1 | Long tasks |
| Alert Agent | 40min | ⭐⭐ Intermediate | 1 | Monitoring |
| Environment Simulator | 40min | ⭐⭐ Intermediate | 1 | Prediction |
| Coordinator Agent | 45min | ⭐⭐⭐ Advanced | 2+ | Orchestration |
| Task Prioritization | 45min | ⭐⭐⭐ Advanced | 1 | Planning |
| Learning Agent | 50min | ⭐⭐⭐ Advanced | 1 | Adaptation |
After completing these tutorials, you'll be able to build:
-
Intelligent Customer Support
- Multi-turn conversations (Dialog)
- Intent routing (Intent Classifier)
- Escalation (Hierarchical)
- Quality assurance (Adaptive Service)
-
Content Generation Pipeline
- Research (Autonomous)
- Writing (with quality validation)
- Editing (Reflection pattern)
- Publishing workflow
-
Code Assistant
- Problem understanding (Chain of Thought)
- Solution generation (React)
- Testing (automated validation)
- Learning from feedback
-
Project Manager Bot
- Task decomposition (Task Prioritization)
- Resource allocation (Coordinator)
- Progress tracking (Autonomous)
- Status reporting (Alert)
-
Decision Support System
- Scenario simulation (Environment Simulator)
- Analysis (Chain of Thought)
- Recommendations (with validation)
- Learning from outcomes
- Each tutorial has a Troubleshooting section
- Check the Common Patterns for solutions
- Review the API Reference for details
- GitHub Issues for bug reports
- Discussions for questions
- Discord for real-time help
- Examples repository
Master the framework with this progression:
Complete 3 beginner tutorials
- ✅ Adaptive Agent Service
- ✅ Dialog Agent
- ✅ Chain of Thought
Complete 3 intermediate tutorials
- ✅ Hierarchical Agent
- ✅ Autonomous Agent
- ✅ Alert Agent
Complete 3 advanced tutorials
- ✅ Coordinator Agent
- ✅ Task Prioritization
- ✅ Learning Agent
Build a complete application using 5+ agents
Day 1: Foundations
- Morning: Adaptive Agent Service (2 hours)
- Afternoon: Dialog + Intent Classifier (2 hours)
- Evening: Build a simple chatbot (2 hours)
Day 2: Advanced
- Morning: Hierarchical Agent (2 hours)
- Afternoon: Coordinator Agent (2 hours)
- Evening: Build multi-agent system (2 hours)
Week 1: Beginner tutorials (3 hours) Week 2: Intermediate tutorials (3 hours) Week 3: Advanced tutorials (3 hours) Week 4: Build your own project (6 hours)
See what others have built:
- Customer Support Bot - 4 agents, 99% satisfaction
- Content Pipeline - Automated blog generation
- Code Reviewer - Quality-assured code analysis
- Research Assistant - Multi-source research synthesis
(Submit your project to be featured!)
Help improve these tutorials:
- Report Issues - Found a bug or unclear section?
- Suggest Improvements - Have a better example?
- Add Tutorials - Cover a new pattern?
- Share Projects - Show what you built!
See CONTRIBUTING.md for guidelines.
| Tutorial | Status | Date Completed | Notes |
|---|---|---|---|
| Service Layer | |||
| Service Layer Getting Started | ⬜ | ||
| CacheService | ⬜ | ||
| VariableService | ⬜ | ||
| TracingService | ⬜ | ||
| Service Best Practices | ⬜ | ||
| Agent Patterns | |||
| Adaptive Agent Service | ⬜ | ||
| Chain of Thought | ⬜ | ||
| Dialog Agent | ⬜ | ||
| Intent Classifier | ⬜ | ||
| Hierarchical Agent | ⬜ | ||
| Autonomous Agent | ⬜ | ||
| Alert Agent | ⬜ | ||
| Environment Simulator | ⬜ | ||
| Coordinator Agent | ⬜ | ||
| Task Prioritization | ⬜ | ||
| Learning Agent | ⬜ | ||
| New Features (v0.7.0-v0.8.0) | |||
| Component Validation | ⬜ | v0.8.0 | |
| Services System | ⬜ | v0.7.0 | |
| MCP Server | ⬜ | v0.7.0 | |
| Code Generation | ⬜ | v0.8.0 | |
| Production Patterns | ⬜ | v0.8.0 | |
| Testing Strategies | ⬜ | v0.8.0 |
Recommended First Step: Adaptive Agent Service Tutorial
This tutorial gives you:
- ✅ Automatic agent selection
- ✅ Quality validation
- ✅ Production-ready patterns
- ✅ Foundation for all other tutorials
Happy learning! 🚀
The latest release includes 6 new tutorials covering cutting-edge features:
- Component Validation - Validate components at runtime by instantiation
- Services System - Enterprise-grade service management
- MCP Server Integration - Connect to Claude Desktop and IDEs
- Code Generation - AI-powered code generation with validation
- Production Patterns - Deploy agents in production environments
- Testing Strategies - Comprehensive testing approaches
Each tutorial includes:
- 7 progressive examples in
examples/tutorials/ - Runnable code snippets
- Production-ready patterns
- Integration with existing features
Last Updated: February 2026
Framework Version: v0.8.0+