symfony/ai-chat
Symfony AI Chat is a lightweight package for building chat-style AI features in Symfony apps. It provides simple abstractions to connect to LLM providers, manage messages and context, and integrate conversational workflows with clean, framework-friendly APIs.
langchain, react-ai).SupportAgent, CodeDebugger) using Laravel’s DI.DatabaseTool using Eloquent, AuthTool with Laravel’s Auth).auth, throttle) via Symfony’s pipeline.symfony/messenger adapter) for background agent tasks.AppServiceProvider:
$this->app->bind(AgentInterface::class, SupportAgent::class);
Route::post('/chat', [ChatController::class, 'handle'])->middleware('auth');
symfony/http-client, symfony/messenger (optional for async).| Risk | Impact | Mitigation |
|---|---|---|
| Symfony/Laravel DI Conflicts | Integration failures | Use symfony/bridge or manual DI resolution. |
| Async Complexity | Latency, retries, deadlocks | Leverage Laravel Queues + symfony/messenger with exponential backoff. |
| Tool Customization | Laravel-specific tools (e.g., DB) | Abstract behind interfaces (e.g., DatabaseToolInterface). |
| State Management | Memory leaks, session corruption | Use Laravel’s cache() or Redis for agent memory. |
| Performance Bottlenecks | High concurrency slowdowns | Profile with Laravel Debugbar; optimize with caching (e.g., Cache::remember). |
| Vendor Lock-in | Migration challenges | Design agents/tools as Laravel services for future portability. |
queue:work handle expected message volume?bind(AgentInterface::class, SupportAgent::class)).auth, throttle).Chat* events for analytics/notifications.symfony/http-client for LLM/API calls (or replace with Laravel’s Http client).symfony/messenger for async workflows (configure with Laravel’s queue drivers).AppServiceProvider./chat route with Laravel middleware (e.g., auth, CORS).cache() helper).| Component | Compatibility Notes |
|---|---|
| Laravel Version | Tested with Laravel 10.x+ (Symfony 6.4+). Use symfony/bridge if DI conflicts arise. |
| PHP Version | Requires PHP 8.1+ (aligns with Laravel’s minimum). |
| LLM/API Providers | Supports OpenAI, Anthropic, etc., via Tool interfaces (custom adapters may be needed). |
| Database | No direct DB dependency; use Laravel’s Eloquent or Query Builder for tool implementations. |
| Auth | Integrate with Laravel’s Auth system via middleware or custom tools. |
symfony/http-client).symfony/ai-chat, symfony/messenger, symfony/bridge (if needed).symfony/ai-chat's Agent base class.DatabaseTool, LLMTool).Chat component in Laravel’s service container.symfony/ai-chat for breaking changes (MIT license allows forks if needed).Agent_v1, Agent_v2).config() for agent-specific settings (e.g., LLM API keys).DatabaseToolInterface).telescope or laravel-debugbar to inspect agent execution flows.retry helper or symfony/messenger retries.throttle middleware for API tool calls.How can I help you explore Laravel packages today?