Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Claude PHP Agent Framework - Tutorials

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.

📚 Tutorial Index

🎯 Getting Started

New to the framework? Start here:

  1. Service Layer Getting StartedNEW: INFRASTRUCTURE

    • Best for: Production applications needing enterprise features
    • Learn: Service management, dependency injection, configuration
    • Time: 30 minutes
    • Difficulty: Beginner-friendly
  2. Adaptive Agent Service TutorialRECOMMENDED START

    • Best for: Everyone - automatic agent selection
    • Learn: Intelligent routing, quality validation, adaptive retry
    • Time: 60 minutes
    • Difficulty: Beginner-friendly

🤖 Core Agent Patterns

Master the foundational agent types:

  1. 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
  2. Hierarchical Agent Tutorial

    • Best for: Multi-domain tasks requiring specialization
    • Learn: Master-worker patterns, task delegation
    • Time: 50 minutes
    • Difficulty: Intermediate
  3. Autonomous Agent Tutorial

    • Best for: Long-running, persistent goal-oriented tasks
    • Learn: State management, goal tracking, multi-session work
    • Time: 55 minutes
    • Difficulty: Intermediate

🏭 Production & Operations

Build production-ready systems:

  1. Alert Agent Tutorial

    • Best for: Intelligent alerting and notification systems
    • Learn: Multi-channel delivery, severity classification, deduplication
    • Time: 40 minutes
    • Difficulty: Intermediate
  2. Coordinator Agent Tutorial

    • Best for: Multi-agent orchestration and load balancing
    • Learn: Agent coordination, capability matching, workload distribution
    • Time: 45 minutes
    • Difficulty: Advanced

💬 Conversational AI

Build chat and dialog systems:

  1. Dialog Agent Tutorial

    • Best for: Multi-turn conversations and chatbots
    • Learn: Session management, context tracking, conversation flow
    • Time: 40 minutes
    • Difficulty: Beginner
  2. Intent Classifier Agent Tutorial

    • Best for: Intent recognition and NLU
    • Learn: Intent classification, entity extraction, routing
    • Time: 35 minutes
    • Difficulty: Beginner

🎓 Advanced Patterns

Explore sophisticated agent behaviors:

  1. Learning Agent Tutorial

    • Best for: Adaptive systems that improve over time
    • Learn: Experience replay, strategy evolution, feedback loops
    • Time: 50 minutes
    • Difficulty: Advanced
  2. 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
  3. Environment Simulator Agent Tutorial

    • Best for: What-if analysis and prediction
    • Learn: Scenario simulation, outcome prediction, risk assessment
    • Time: 40 minutes
    • Difficulty: Intermediate

🆕 New Features (v0.7.0 - v0.8.0)

Recent additions to the framework:

  1. Component Validation Tutorial

    • Best for: Runtime component validation by instantiation
    • Learn: Dynamic class loading, constructor validation, comprehensive error handling
    • Time: 45 minutes
    • Difficulty: Intermediate
  2. Services System Tutorial

    • Best for: Enterprise service management with dependency injection
    • Learn: ServiceManager, custom services, lifecycle management
    • Time: 50 minutes
    • Difficulty: Intermediate
  3. MCP Server Tutorial

    • Best for: Model Context Protocol integration with Claude Desktop
    • Learn: MCP tools, agent discovery, custom tools, SSE transport
    • Time: 55 minutes
    • Difficulty: Advanced
  4. Code Generation Tutorial

    • Best for: AI-powered code generation with validation
    • Learn: CodeGenerationAgent, validation pipelines, retry logic, templates
    • Time: 50 minutes
    • Difficulty: Intermediate
  5. Production Patterns Tutorial

    • Best for: Production-ready deployment and operations
    • Learn: Error handling, logging, observability, caching, security, monitoring
    • Time: 60 minutes
    • Difficulty: Advanced
  6. Testing Strategies Tutorial

    • Best for: Comprehensive testing approaches
    • Learn: Unit tests, feature tests, integration tests, mocking, coverage
    • Time: 55 minutes
    • Difficulty: Intermediate

🗺️ Learning Paths

Choose a path based on your goals:

Path 1: Quick Start (For Beginners)

Goal: Get productive fast with automatic agent selection

  1. Adaptive Agent Service - Start here!
  2. Dialog Agent - Build a chatbot
  3. Intent Classifier - Add routing

Time: ~2.5 hours
Outcome: Working chatbot with intelligent routing


Path 6: New Features Mastery

Goal: Master the latest framework capabilities (v0.7.0 - v0.8.0)

  1. Component Validation - Runtime validation
  2. Services System - Enterprise services
  3. MCP Server - Claude Desktop integration
  4. Code Generation - AI code generation
  5. Production Patterns - Production deployment
  6. Testing Strategies - Comprehensive testing

Time: ~5.5 hours
Outcome: Production-ready AI systems with latest features


Path 2: Reasoning & Logic

Goal: Master systematic problem-solving agents

  1. Chain of Thought - Step-by-step reasoning
  2. Autonomous Agent - Goal-oriented behavior
  3. Task Prioritization - Dynamic planning

Time: ~2.5 hours
Outcome: Intelligent reasoning and planning systems


Path 3: Production Systems

Goal: Build enterprise-ready AI systems

  1. Adaptive Agent Service - Quality assurance
  2. Alert Agent - Monitoring and notifications
  3. Coordinator Agent - Multi-agent orchestration

Time: ~2.5 hours
Outcome: Production-grade AI infrastructure


Path 4: Multi-Agent Systems

Goal: Coordinate multiple specialized agents

  1. Hierarchical Agent - Master-worker pattern
  2. Coordinator Agent - Load balancing
  3. Adaptive Agent Service - Intelligent selection

Time: ~2.5 hours
Outcome: Complex multi-agent architectures


Path 5: Adaptive & Learning Systems

Goal: Build systems that improve over time

  1. Learning Agent - Experience-based improvement
  2. Adaptive Agent Service - Performance tracking
  3. Environment Simulator - Prediction

Time: ~2.5 hours
Outcome: Self-improving AI systems


📖 Tutorial Structure

Each tutorial follows a consistent structure:

What You'll Find

  1. Introduction - Overview and learning objectives
  2. Conceptual Explanation - What the agent does and why
  3. Setup - Installation and prerequisites
  4. Tutorial 1-7 - Progressive hands-on exercises
  5. Common Patterns - Real-world usage patterns
  6. Troubleshooting - Common issues and solutions
  7. Next Steps - Where to go from here

How to Use

  • 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

🚀 Quick Reference

By Use Case

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

By Complexity

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

💡 Tips for Success

1. Start with Adaptive Agent Service

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

2. Follow the Code Examples

Every tutorial includes complete, runnable code:

# Copy the example
cp tutorial_example.php my_project.php

# Run it!
php my_project.php

3. Experiment

After completing a tutorial:

  • Try different configurations
  • Combine multiple agents
  • Build small projects
  • Share your creations!

4. Use the Documentation

Each tutorial references:

  • API documentation
  • Agent selection guide
  • Best practices
  • Related tutorials

5. Join the Community

  • Ask questions
  • Share solutions
  • Report issues
  • Contribute improvements

🛠️ Prerequisites

Required

  • PHP 8.1+
  • Composer for dependencies
  • Anthropic API Key (Get one here)

Installation

# 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

Optional Tools

  • Monolog - Logging (included)
  • PHPUnit - Testing
  • PHP-CS-Fixer - Code formatting

📊 Tutorial Comparison

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

🎯 What You'll Build

After completing these tutorials, you'll be able to build:

Real-World Applications

  1. Intelligent Customer Support

    • Multi-turn conversations (Dialog)
    • Intent routing (Intent Classifier)
    • Escalation (Hierarchical)
    • Quality assurance (Adaptive Service)
  2. Content Generation Pipeline

    • Research (Autonomous)
    • Writing (with quality validation)
    • Editing (Reflection pattern)
    • Publishing workflow
  3. Code Assistant

    • Problem understanding (Chain of Thought)
    • Solution generation (React)
    • Testing (automated validation)
    • Learning from feedback
  4. Project Manager Bot

    • Task decomposition (Task Prioritization)
    • Resource allocation (Coordinator)
    • Progress tracking (Autonomous)
    • Status reporting (Alert)
  5. Decision Support System

    • Scenario simulation (Environment Simulator)
    • Analysis (Chain of Thought)
    • Recommendations (with validation)
    • Learning from outcomes

🆘 Getting Help

During Tutorials

  • Each tutorial has a Troubleshooting section
  • Check the Common Patterns for solutions
  • Review the API Reference for details

Additional Resources

Community

  • GitHub Issues for bug reports
  • Discussions for questions
  • Discord for real-time help
  • Examples repository

🎓 Certification Path

Master the framework with this progression:

Level 1: Foundation (Beginner)

Complete 3 beginner tutorials

  • ✅ Adaptive Agent Service
  • ✅ Dialog Agent
  • ✅ Chain of Thought

Level 2: Intermediate (Practitioner)

Complete 3 intermediate tutorials

  • ✅ Hierarchical Agent
  • ✅ Autonomous Agent
  • ✅ Alert Agent

Level 3: Advanced (Expert)

Complete 3 advanced tutorials

  • ✅ Coordinator Agent
  • ✅ Task Prioritization
  • ✅ Learning Agent

Level 4: Master (Architect)

Build a complete application using 5+ agents


📅 Suggested Schedule

Weekend Workshop (2 days)

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)

Weekly Learning (4 weeks)

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)


🌟 Featured Projects

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


🤝 Contributing

Help improve these tutorials:

  1. Report Issues - Found a bug or unclear section?
  2. Suggest Improvements - Have a better example?
  3. Add Tutorials - Cover a new pattern?
  4. Share Projects - Show what you built!

See CONTRIBUTING.md for guidelines.


📈 Track Your Progress

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

🎉 Ready to Start?

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


🎁 What's New in v0.8.0

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+