Filament CMS with Laravel AI SDK Actions

Filament 4

Filament CMS with actions in Post Edit page that use AI capabilities: create a tweet, suggest title options, translate post text, generate image thumbnail.

filament-laravel-ai-sdk-cms

Get the Source Code:

How it works

The system is built around AI Agents that plug into Filament actions. When a user edits a post, they can trigger AI-powered actions from the toolbar:

app/Filament/Actions/SuggestTitleAction.php

$context = filled($record->title)
? "Current title: {$record->title}\n\nPost body:\n{$record->body}"
: "Post body:\n{$record->body}";
 
$response = (new TitleSuggesterAgent(customInstructions: $customPrompt))->prompt(
$context,
provider: static::resolveProvider($data),
model: static::resolveModel($data),
);

Each agent implements the Laravel AI SDK Agent contract and defines its own system instructions:

app/Ai/Agents/TitleSuggesterAgent.php

class TitleSuggesterAgent implements Agent
{
use Promptable;
 
public function __construct(public ?string $customInstructions = null) {}
 
public function instructions(): Stringable|string
{
if ($this->customInstructions) {
return $this->customInstructions;
}
 
return SystemPrompt::query()
->where('operation', 'title-suggester')
->value('prompt')
?? 'You are a blog title expert. Given a blog post body...';
}
}

The user picks a provider and model from a dropdown (only configured providers are shown), the agent calls the...

The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 156 Premium Examples for $99