laravel/ai
Laravel AI SDK offers a unified, Laravel-friendly API for OpenAI, Anthropic, Gemini, and more. Build agents with tools and structured output, generate images, synthesize/transcribe audio, and create embeddings—all through one consistent interface.
Agent, Tool, Provider), enabling extensibility via custom providers, tools, and middleware. This is ideal for applications requiring domain-specific AI integrations (e.g., chatbots, agents, embeddings).AgentPrompted, AgentCompleted) supports real-time interactions, which is critical for streaming responses, notifications, or async workflows.ServiceProvider (e.g., AiServiceProvider).config/ai.php for provider settings (API keys, models, timeouts), aligning with existing patterns.QueuedAgent), leveraging Laravel’s queue system.Conversation, ToolCall), enabling auditability and stateful agents.Filesystem contracts.withFailover()). Misconfiguration could lead to throttling or cost overruns.AiManager or Agent via constructor/bindings.QueuedAgent for async workflows (e.g., long-running chatbots).pusher:channels for real-time agent events.Storage facade (local/S3).guzzlehttp/guzzle for HTTP calls).laravel-scout, pinecone-php).laravel-queue-workers).laravel/ai wrappers.laravel/ai abstractions.AiProvider enum or create custom providers via AiManager::extend().Tool::make() with Laravel’s macroable pattern.make:agent-middleware.AgentPrompted, AgentCompleted, etc., for custom logic.Cache::remember) for frequent identical requests.Conversation model scoping.composer require laravel/ai.php artisan vendor:publish --tag="ai-config".config/ai.php.use Laravel\AI\Agents\Agent;
use Laravel\AI\Tools\Tool;
$agent = Agent::make()
->rememberConversations()
->canUseTool(Tool::make('search_web')->action(fn ($query) => ...));
config/ai.php:
'providers' => [
'openai' => [
'key' => env('OPENAI_KEY'),
'model' => 'gpt-4',
],
How can I help you explore Laravel packages today?