berta-cms/berta/ai-sdk-development
Claude Code and agent skill by berta-cms/berta
- community
Checking that the SKILL.md file is still in the repository.
TRIGGER when working with ai-sdk, Laravel's official first-party AI SDK. Activate when building or editing AI agents, chatbots, text generation, image generation, audio/TTS, transcription/STT, embeddings, RAG, vector stores, reranking, structured output, streaming, conversation memory, tools, MCP servers, queueing, broadcasting, and provider failover across OpenAI, Anthropic, Gemini, Azure, Groq, xAI, DeepSeek, Mistral, Ollama, ElevenLabs, Cohere, Jina, and VoyageAI. Invoke when the user refere…
Install
npx vskill@latest install berta-cms/berta/ai-sdk-developmentSKILL.md
Developing with the Laravel AI SDK
The Laravel AI SDK (laravel/ai) is the official AI package for Laravel, providing a unified API for agents, images, audio, transcription, embeddings, reranking, vector stores, and file management across multiple AI providers.
Searching the Documentation
This package is new. Always search the documentation before implementing any feature. Never guess at APIs — the documentation is the single source of truth.
- Use broad, simple queries that match the documentation section headings below.
- Do not add package names to queries — package information is shared automatically. Use
test agent fake, notlaravel ai test agent fake. - Run multiple queries at once — the most relevant results are returned first.
Documentation Sections
Use these section headings as query terms for accurate results:
- Introduction, Installation, Configuration, Provider Support
- Agents: Prompting, Conversation Context, Structured Output, Attachments, Streaming, Broadcasting, Queueing, Tools, Provider Tools, Middleware, Anonymous Agents, Agent Configuration
- Images
- Audio (TTS)
- Transcription (STT)
- Embeddings: Querying Embeddings, Caching Embeddings
- Reranking
- Files
- Vector Stores: Adding Files to Stores
- Failover
- Testing: Agents, Images, Audio, Transcriptions, Embeddings, Reranking, Files, Vector Stores
- Events
Decision Workflow
Determine the right entry point before writing code:
Text generation or chat? → Agent class with Promptable trait Chat with conversation history? → Agent + Conversational interface (manual) or RemembersConversations trait (automatic) Structured JSON output? → Agent + HasStructuredOutput interface Image generation? → Image::of()->generate() Audio synthesis? → Audio::of()->generate() Transcription? → Transcription::fromPath()->generate() Embeddings? → Embeddings::for()->generate() Reranking? → Reranking::of()->rerank() File storage? → Document::fromPath()->put() Vector stores? → Stores::create()
Basic Usage Examples
Agents
Conversation Context
Manual conversation history via the Conversational interface:
Automatic conversation persistence via the RemembersConversations trait:
Structured Output
Images
Audio
Transcription
Embeddings
Reranking
Files and Vector Stores
Agent Configuration
PHP Attributes
The #[UseCheapestModel] and #[UseSmartestModel] attributes are also available for automatic model selection.
Use #[RepairToolCalls] to let an agent recover when a model calls an unknown local tool. The failed call is returned to the model with the available local tool names, and the implicit step budget includes one repair step. Explicit #[MaxSteps] limits remain unchanged.
The #[WithoutBroadcasting] attribute stops the given stream event types from broadcasting (e.g. data-heavy ToolResult payloads that exceed the WebSocket frame limit). The events are still streamed and persisted; they just never hit the channel:
Tools
Implement the HasTools interface and scaffold tools with php artisan make:tool:
Provider Tools
MCP Servers
Register the server once, then return its tools from tools(). The SDK automatically wraps each Laravel\Mcp\Client\Primitives\Tool and presents it to the model as mcp_tools_<name>. Return your own Laravel\Mcp\Server\Tool instances in the same way and they retain their names and run in-process.
The client connects on its first call, so call connect() only when you need to control the timing. Use Client::local('npx', ['-y', 'some-server']) for servers that run over stdio.
Conversation Memory
Failover
Testing and Faking
Each capability supports fake() with assertions:
Key Patterns
- Namespace:
Laravel\Ai\ - Package:
composer require laravel/ai - Agent pattern: Implement the
Agentinterface and use thePromptabletrait - Optional interfaces:
HasTools,HasMiddleware,HasStructuredOutput,Conversational - Entry-point classes:
Image,Audio,Transcription,Embeddings,Reranking,Stores - Provider enum:
Laravel\Ai\Enums\Lab(prefer over plain strings) - Artisan commands:
php artisan make:agent,php artisan make:tool - Global helper:
agent()for anonymous agents
OpenAI-Compatible Provider
Point the SDK at any OpenAI-compatible endpoint (LM Studio, vLLM, Together, etc.) with the config-driven openai-compatible driver. Define named instances in config/ai.php, no code required:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking_api_app/.agents/skills/ai-sdk-development/SKILL.md
Popularity
- Repository stars
- 151
- Repository forks
- 33
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/berta-cms/berta/ai-sdk-development)