Browse all series
AIIntermediate13 episodes

The Batteries-Included AI Toolkit

The Laravel AI SDK is a first-party toolkit for adding AI features to your applications. Using a helpdesk app as our playground, you’ll learn structured output, chat with memory, streaming, tool use, retrieval, and everything else you need to build AI features that are reliable, testable, and ready for production.

This is an incredibly powerful toolkit, and I can't wait to show you what you can build. Let's get going!

Series episodes

Structured Output as the Foundation

19m 53s

Build a ticket triage flow using structured output: extract priority, department, sentiment, tags, and summary from ticket text, then apply it.

Logging AI Usage

10m 37s

Add real visibility to AI calls in Laravel: build AiRun and AiUsage, log requests and token usage, and debug triage flows with confidence.

Conversation Architecture & Context Management

16m 48s

Build ticket-scoped AI chat in Laravel: add conversation IDs, create TicketAssistant, and manage context via TicketChatController.

Demoing Our Chat Agent

7m 51s

Add an Alpine chat panel to a ticket page, call your Laravel controller via fetch, handle CSRF, and prep the loop for streaming.

Streaming AI Responses to the UI

19m 30s

Stream AI chat replies in real time with Laravel and Alpine: add output_text, build a streaming endpoint, and render chunks as they arrive.

Giving AI the Ability to Use Tools

14m 19s

Stop AI guessing by adding safe tools in Laravel—generate Artisan tool classes, enforce schemas/auth, and set max_steps for real ticket data.

Retrieval Augmented Generation with Your Database

14m 17s

Add retrieval-augmented generation to your app: create embeddings, store vectors in SQLite JSON, and rank documents with cosine similarity.

Retrieval from Files and External Sources

19m 46s

Scale Laravel AI Q&A: upload files, store embeddings in provider vector stores, and ask questions with FileSearch using clean endpoints.

Designing for Reliability and Failure

15m 9s

Build reliable AI features with provider failover, smart timeouts, and queue fallback—create a product description agent that runs sync or async.

Controlling Cost Before It Controls You

13m 51s

Control AI token costs in Laravel: correlate runs and usage via invocation_id, auto-log with events, and enforce a daily budget middleware.

Safety Layers and Guardrails

13m 48s

Add trusted safety layers: wire Input/OutputSafetyMiddleware, screen prompts, filter responses, and lock WebSearch to approved domains.

Testing AI Features Without Hitting the API

11m 33s

Test AI features fast and safely—fake providers, keep tests local and deterministic, and fail fast with preventStrayPrompts guards.

Exposing Your AI Features with MCP

12m 49s

Expose Laravel AI features safely with MCP: install Laravel MCP, publish a triageTicket tool, and verify responses with the inspector.

Continue learning

Thumbnail for Russian-Doll Caching in Laravel
Russian-Doll Caching in Laravel

With Jeffrey Way

  • 7 episodes
  • Advanced
  • Tooling
Thumbnail for AI Developer Workflows
AI Developer Workflows

With Jeffrey Way

  • 3 episodes
  • Intermediate
  • AI
Thumbnail for Let's Build a SaaS in Laravel
Let's Build a SaaS in Laravel

With Matt Stauffer

  • 12 episodes
  • Intermediate
  • Frameworks
Thumbnail for What's New in Laravel 5.2
What's New in Laravel 5.2

With Jeffrey Way

  • 5 episodes
  • Beginner
  • Frameworks
Thumbnail for Add Passkeys to a Laravel App
Add Passkeys to a Laravel App

With Luke Downing

  • 7 episodes
  • Advanced
  • Techniques

Would you like to hear from Laracasts by email occasionally?