Episode 02: Getting Started with the Laravel AI SDK Laravel released the Laravel AI SDK, a first-party package that gives developers a single Laravel-native integration layer for configuring AI providers, defining agents, calling models, using tools, requesting structured output, and tracking usage. The SDK is installed via Composer and provides an agent class pattern, per-environment provider and model configuration, and database-backed conversation storage, with guidance to start from one narrow feature such as support-ticket summarization rather than a general assistant. The Laravel AI SDK is Laravel's first-party package for building AI-powered application features without turning your codebase into a collection of provider-specific HTTP calls. It gives Laravel developers one consistent place to configure providers, define agents, call models, use tools, request structured output, and track usage. The important mental shift is this: the SDK is not the product feature by itself. It is the integration layer. Your Laravel application still owns the use case, authorization, validation, persistence, queues, logs, and user experience. The SDK gives you a Laravel-native way to connect those responsibilities to AI providers. Start with one narrow feature: Do not begin by building a general assistant. Begin with a small task such as support-ticket summarization, product description improvement, review classification, or internal document Q&A. A narrow feature makes the prompt, output, fallback, cost, and success criteria much easier to control. Before the SDK, many Laravel applications integrated AI with raw HTTP clients, direct provider SDKs, or small wrapper services. That works for a prototype, but it becomes messy once the product needs multiple providers, conversation context, structured output, tools, streaming, cost tracking, testing, and failover. The SDK gives you several production-friendly building blocks: A new Laravel AI SDK setup starts like a normal Laravel package: composer require laravel/ai php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider" php artisan migrate The migration step matters because SDK features such as remembered conversations need database tables. If your first feature is a stateless classification or summarization endpoint, you may not use conversation storage immediately, but publishing configuration early keeps provider and model choices visible. Provider credentials should stay in environment variables and configuration, not inside prompts, controllers, jobs, or agent classes. OPENAI API KEY= ANTHROPIC API KEY= GEMINI API KEY= GROQ API KEY= MISTRAL API KEY= OPENROUTER API KEY= OPENAI COMPATIBLE API KEY= OPENAI COMPATIBLE URL= A useful first production habit is to define a default provider and model per environment. Local development may use a cheap or local model. Staging may use a stable low-cost model. Production may pin a specific model for predictable behavior and pricing. Do not hide model choice: The selected provider and model affect quality, latency, cost, context window, supported tools, and output behavior. Treat model selection like infrastructure configuration, not like a random string inside a controller. The SDK's main application-facing concept is the agent. An agent is a PHP class with a responsibility. For a first feature, imagine a SupportSummaryAgent that turns a long support message into a short internal summary. php artisan make:agent SupportSummaryAgent php