All skills
asyrafhussin avatar

/laravel-ai-sdk

@7221662

Laravel AI SDK for building AI-powered features. Use when creating agents, generating images or audio, working with embeddings, vector search, or testing AI features. Triggers on tasks involving laravel/ai, AI agents, tool-calling, structured output, streaming, embeddings, reranking, or AI faking in tests.

Use this Skill: https://skilld.dev/gh/asyrafhussin/agent-skills/laravel-ai-sdk

This session only. Nothing lands on disk.

rulestool-provider.md

≈840 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Provider Tools

Impact: HIGH (Built-in web search, URL fetching, file search, and similarity search)

Provider tools are executed by the AI provider itself — web searching, URL fetching, and file searching. SimilaritySearch runs locally against your database for RAG.

Bad Example

// Building custom web search tool from scratch
class WebSearchTool implements Tool
{
    public function handle(Request $request): string
    {
        // Manual Google API integration — unnecessary
        $client = new \GuzzleHttp\Client();
        $response = $client->get('https://www.googleapis.com/customsearch/v1', [
            'query' => ['key' => config('services.google.key'), 'q' => $request['query']],
        ]);

        return (string) $response->getBody();
    }
}

Good Example

// WebSearch — provider searches the web for real-time info
use Laravel\Ai\Providers\Tools\WebSearch;

public function tools(): iterable
{
    return [
        new WebSearch,
    ];
}

// With limits and domain restrictions
(new WebSearch)->max(5)->allow(['laravel.com', 'php.net']);

// With location context
(new WebSearch)->location(city: 'New York', region: 'NY', country: 'US');
// WebFetch — provider reads web page contents
use Laravel\Ai\Providers\Tools\WebFetch;

public function tools(): iterable
{
    return [
        (new WebFetch)->max(3)->allow(['docs.laravel.com']),
    ];
}
// FileSearch — search files in vector stores (RAG)
use Laravel\Ai\Providers\Tools\FileSearch;

public function tools(): iterable
{
    return [
        new FileSearch(stores: ['store_1', 'store_2']),
    ];
}

// With metadata filters
use Laravel\Ai\Providers\Tools\FileSearchQuery;

new FileSearch(stores: ['store_id'], where: fn (FileSearchQuery $query) =>
    $query->where('author', 'Taylor Otwell')
        ->whereNot('status', 'draft')
        ->whereIn('category', ['news', 'updates'])
);
// SimilaritySearch — search your own database with vector embeddings
use App\Models\Document;
use Laravel\Ai\Tools\SimilaritySearch;

public function tools(): iterable
{
    return [
        SimilaritySearch::usingModel(Document::class, 'embedding'),
    ];
}

// With similarity threshold and query constraints
SimilaritySearch::usingModel(
    model: Document::class,
    column: 'embedding',
    minSimilarity: 0.7,
    limit: 10,
    query: fn ($query) => $query->where('published', true),
);

// Custom closure for full control
new SimilaritySearch(using: function (string $query) {
    return Document::query()
        ->where('user_id', $this->user->id)
        ->whereVectorSimilarTo('embedding', $query)
        ->limit(10)
        ->get();
});

Why

  • Zero setup: WebSearch and WebFetch are provider-native — no API keys or configuration
  • Domain safety: Restrict web search and fetch to trusted domains
  • RAG-ready: FileSearch + SimilaritySearch enable retrieval-augmented generation
  • Composable: Combine provider tools with custom tools on the same agent

Reference: Laravel AI SDK — Provider Tools

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk MEDIUM
  • Gen Agent Trust Hub16d

    The skill provides a comprehensive guide for the Laravel AI SDK but contains deceptive metadata claiming authorship by the 'Laravel Community' despite being associated with the user 'asyrafhussin'. It also presents an indirect prompt injection surface by documenting patterns for ingesting untrusted data (such as transcripts and external URLs) while granting agents capabilities like file system storage and network access.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7221662. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago
Other metadata
metadata
{
  "author": "Laravel Community",
  "version": "1.0.0",
  "laravelVersion": "13.x",
  "phpVersion": "8.3+"
}

README badge

README badge for asyrafhussin/agent-skills/laravel-ai-sdk