v1.1.0 - Streaming Flow Execution System π
v1.1.0 - Streaming Flow Execution System π
Major feature release bringing real-time streaming flow execution to claude-php-agent, inspired by Langflow's sophisticated event-driven architecture.
π Highlights
- Real-Time Streaming: Token-by-token LLM responses as they're generated
- Event-Driven Architecture: Queue-based event management with 25+ event types
- Progress Tracking: Detailed execution progress with time estimation
- Multi-Listener Broadcasting: One-to-many event distribution
- SSE Support: Server-Sent Events for web applications
- Production Ready: 42 tests, 9/9 real API tests passing
π― Key Features
Core Components
-
EventQueue - FIFO event queue based on
SplQueue- Configurable max size (default: 100)
- Overflow tracking
- Statistics and utilization metrics
-
FlowEvent - Comprehensive event system
- 25+ event types (flow, token, iteration, tool, progress, error)
- SSE/JSON/Array output formats
- Type checking helpers
- Langflow-compatible events
-
FlowEventManager - Advanced event management
- Event registration with callbacks
- Queue-based non-blocking emission
- Multiple listener support
- Magic method emission
-
FlowProgress - Real-time progress tracking
- Iteration and step tracking
- Duration measurement
- Time remaining estimation
- Metadata support
-
StreamingFlowExecutor - Main execution engine
- Generator-based streaming
- Token-by-token output
- SSE streaming support
- Blocking execution option
Service Integration
- New
ServiceType::FLOW_EXECUTORservice - New
ServiceType::EVENT_MANAGERservice - Automatic dependency injection
- Full ServiceManager integration
Enhanced StreamingLoop
- Optional FlowEventManager integration
- Automatic event emission
- Backward compatible (opt-in)
π Documentation
Comprehensive documentation (2,800+ lines):
- Execution Guide - Architecture and API reference
- Event Reference - All 25+ event types
- Streaming Patterns - SSE, patterns, optimization
- Navigation Index - Learning paths
- Tutorial - 60-minute guide
π‘ Examples
Tutorial Series (100 minutes, 7 examples):
- Basic streaming
- Progress tracking
- Event listeners
- SSE streaming
- Custom events
- Error handling
- Full integration
Advanced Examples (4 files):
- Production streaming patterns
- Progress monitoring
- Multi-listener broadcasting
- SSE server with HTML client
All examples tested with real Claude API β
π§ͺ Testing
- Unit Tests: 42 methods (100% passing)
- Real API Tests: 9/9 examples working
- Integration Tests: 12 scenarios verified
- Code Verification: 100+ samples
π Quick Start
```php
use ClaudeAgents\Services\ServiceManager;
use ClaudeAgents\Services\ServiceType;
$executor = ServiceManager::getInstance()->get(ServiceType::FLOW_EXECUTOR);
foreach ($executor->executeWithStreaming($agent, $task) as $event) {
match ($event['type']) {
'token' => print($event['data']['token']),
'progress' => printf("%.1f%%\n", $event['data']['progress_percent']),
'end' => print("Done!\n"),
default => null
};
}
```
π Tutorial
```bash
Run the tutorial series
cd examples/tutorials/streaming-flow
php 01-basic-streaming.php
php 02-progress-tracking.php
... through 07-integration.php
```
ποΈ Architecture
Adapts Python patterns to PHP:
| Python (Langflow) | PHP (claude-php-agent) |
|---|---|
async/await |
Generator/yield |
asyncio.Queue |
SplQueue |
| Async subscribers | Observer pattern |
π Statistics
- Files: 35 created/modified
- Code: ~8,500 lines
- Core: ~3,500 lines
- Examples: ~1,600 lines
- Tests: ~800 lines
- Docs: ~2,600 lines
π Backward Compatibility
Fully backward compatible - all existing code continues to work. Streaming features are opt-in.
π Acknowledgments
Inspired by Langflow's excellent event-driven architecture.
Full Changelog: https://github.com/claude-php/claude-php-agent/blob/master/CHANGELOG.md