Back to Blog

research

Laravel AI SDK Skill: Build Agents, RAG, and Tests

Scenario-driven guide to installing and using the laravel-ai-sdk agent skill for agents, embeddings, vector search, and AI test fakes.

OpenAgentSkillPublished:

Where this fits

Your Laravel app already has queues, a database, and PHP 8.3. Adding an AI feature means wiring SDK calls, prompt context, tool-calling, and test doubles together. This skill is a Laravel-specific reference that makes an agent apply official laravel/ai patterns instead of generic AI boilerplate.

Why agents benefit

  • Makes the agent use Laravel-native AI conventions: 17 rules across 7 categories for Laravel 13.x and PHP 8.3+.
  • Covers agent construction (instructions, tools, structured output) and conversation prompting, so your agent can build multi-step tools, not one-off prompts.
  • Handles media and retrieval: image/audio generation, transcriptions, embeddings, and vector search, so RAG is built with compatible Laravel packages.
  • Includes testing rules for fakes and assertions, so the agent writes deterministic AI tests without calling external model APIs in CI.
  • Reduces guessing around streaming and queueing, so the agent knows when to stream tokens and when to queue work.

Practical scenarios

Support agent with order lookup

An agent needs to call a tool to fetch order status, format the reply, and only call the tool when an order number is mentioned. The skill shows how to configure tools and structured output through laravel/ai while keeping conversation context minimal.

RAG over product documentation

The team wants answers grounded in a vector store. The agent follows the skill's embeddings and vector-store rules to build a RAG pipeline: embed chunks, query similar content, and return source-backed answers.

AI tests that avoid external calls

A developer wants CI coverage for a new AI feature. The testing rules show how to fake AI responses and assert on tool calls, so the suite runs fast and deterministically.

Add it to your agent workflow

Install the skill into any agent project with:

npx skills add AsyrafHussin/agent-skills --skill laravel-ai-sdk

After installation, reference laravel-ai-sdk when asking for a Laravel AI feature. For example: Use the laravel-ai-sdk skill to create a streaming agent that calls a get_order tool and returns structured output. The agent then loads the relevant rules and applies the SDK's expected structure.

Compare before adopting

Before adopting, compare four things. Quality: are the 17 rules concrete enough to constrain API usage, or do they only restate the docs? Look at code snippets in each category. Maintenance: Laravel AI moves fast; verify the skill's Laravel version and last update match your project. Alternatives: the official Laravel AI docs remain the source of truth, and a generic AI skill may fit non-Laravel work. Workflow fit: the skill should slot into your agent's tool path without conflicting with existing Laravel conventions. See the broader skill catalog at https://www.openagentskill.com/skills/asyrafhussin-laravel-ai-sdk for community adoption context.

Why it is worth tracking

Worth tracking because it packages the official Laravel AI SDK for agent use: MIT license, 72 GitHub stars, and clear Laravel 13.x/PHP 8.3+ constraints signal active community maintenance. AI SDK APIs change often, so this skill can save hours of trial and error by mapping agent behavior to current patterns. Evaluate it when your team standardizes on Laravel AI, and re-evaluate after each SDK major release.

Featured Skill

laravel-ai-sdk

Skill by AsyrafHussin