PHPackages                             pixelworxio/filament-ai-action - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pixelworxio/filament-ai-action

ActiveFilament-plugin[Utility &amp; Helpers](/categories/utility)

pixelworxio/filament-ai-action
==============================

AI-powered actions for Filament v5 — streaming modal, structured output, intelligent table actions

1.0.2(2mo ago)2108↓30%[2 PRs](https://github.com/pixelworxio/filament-ai-action/pulls)MITPHPPHP ^8.4CI passing

Since Feb 23Pushed 1mo agoCompare

[ Source](https://github.com/pixelworxio/filament-ai-action)[ Packagist](https://packagist.org/packages/pixelworxio/filament-ai-action)[ GitHub Sponsors](https://github.com/Pixelworxio)[ RSS](/packages/pixelworxio-filament-ai-action/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (12)Versions (7)Used By (0)

[![Livewire Workflows Banner](https://raw.githubusercontent.com/pixelworxio/filament-ai-action/main/art/filament-ai-action.png)](https://raw.githubusercontent.com/pixelworxio/filament-ai-action/main/art/filament-ai-action.png)

 [![GitHub Tests Action Status](https://camo.githubusercontent.com/ffc13b3848e131c536b4663d8058c37582b9efa24ffe246eab3a03c7d900e3f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706978656c776f7278696f2f66696c616d656e742d61692d616374696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/pixelworxio/filament-ai-action/actions/workflows/run-tests.yml) [![GitHub Stars](https://camo.githubusercontent.com/2ccedc0331e404243a13362338f1947d73c9da3f69f2c32ce15c8de6ba66a83c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f706978656c776f7278696f2f66696c616d656e742d61692d616374696f6e3f7374796c653d666c61742d737175617265)](https://github.com/pixelworxio/filament-ai-action)

AI-powered actions for Filament v5 — streaming modal, structured output, and intelligent table actions.

---

Requirements
------------

[](#requirements)

- PHP ^8.4
- Laravel ^12.0
- Filament ^5.0
- pixelworxio/laravel-ai-action ^1.0

---

Installation
------------

[](#installation)

```
composer require pixelworxio/filament-ai-action
```

Then register the plugin in your panel provider:

```
use Pixelworxio\FilamentAiAction\FilamentAiActionPlugin;

->plugins([
    FilamentAiActionPlugin::make(),
])
```

---

AiAction
--------

[](#aiaction)

`AiAction` extends `Filament\Actions\Action` and exposes seven fluent configuration methods.

### agent()

[](#agent)

Set the agent class to run:

```
use Pixelworxio\FilamentAiAction\AiAction;

AiAction::make()
    ->agent(SummaryAgent::class)
```

### stream()

[](#stream)

Enable incremental text rendering in the modal:

```
AiAction::make()
    ->agent(SummaryAgent::class)
    ->stream()
```

### withUserInstruction()

[](#withuserinstruction)

Show a free-text input in the modal before running the agent. The instruction is attached to the `AgentContext` as metadata:

```
AiAction::make()
    ->agent(SummaryAgent::class)
    ->withUserInstruction('What would you like to know about this record?')
```

### persistResultTo()

[](#persistresultto)

Write the agent result to an Eloquent model column after successful execution. Structured results are JSON-encoded automatically:

```
AiAction::make()
    ->agent(SummaryAgent::class)
    ->persistResultTo('ai_summary')
```

### queued()

[](#queued)

Dispatch the agent as a background job instead of running inline. Accepts an optional queue name:

```
AiAction::make()
    ->agent(SummaryAgent::class)
    ->queued('high')
```

### usingProvider()

[](#usingprovider)

Override the AI provider and model for this action only, ignoring the package-level defaults:

```
AiAction::make()
    ->agent(SummaryAgent::class)
    ->usingProvider('openai', 'gpt-4o')
```

### withContext()

[](#withcontext)

Enrich the `AgentContext` before the agent runs. The callback receives the built context and the Eloquent record:

```
use Pixelworxio\LaravelAiAction\DTOs\AgentContext;

AiAction::make()
    ->agent(SummaryAgent::class)
    ->withContext(function (AgentContext $ctx, Model $record): AgentContext {
        return $ctx->withMeta('tenant_id', $record->tenant_id);
    })
```

---

AiBulkAction
------------

[](#aibulkaction)

`AiBulkAction` extends `Filament\Tables\Actions\BulkAction` and uses the same fluent API. When queued, one `RunAgentActionJob` is dispatched per selected record.

```
use Pixelworxio\FilamentAiAction\AiBulkAction;

AiBulkAction::make()
    ->agent(SummaryAgent::class)
    ->persistResultTo('ai_summary')
    ->queued()
    ->deselectRecordsAfterCompletion()
```

---

AgentResultEntry
----------------

[](#agentresultentry)

Render a persisted AI result inside a Filament infolist. Automatically detects whether the stored value is JSON (structured) or plain text:

```
use Pixelworxio\FilamentAiAction\Infolists\AgentResultEntry;

AgentResultEntry::make('ai_summary')
    ->label('AI Summary')
    ->markdown()
    ->withRefreshAction()
```

- `->markdown()` — passes the stored value through `Str::markdown()` before rendering.
- `->withRefreshAction()` — embeds an `AiAction` button below the result to re-run and re-persist.

---

AiActionWidget
--------------

[](#aiactionwidget)

Embed an AI agent result directly on a Filament dashboard panel without a modal:

```
use Pixelworxio\FilamentAiAction\Widgets\AiActionWidget;

// In your panel provider's getWidgets():
protected function getWidgets(): array
{
    return [
        AiActionWidget::agent(DashboardInsightAgent::class)
            ->contextBuilder(fn (): AgentContext => AgentContext::fromRecords(
                Post::latest()->limit(10)->get()->all()
            )),
    ];
}
```

The widget respects Filament's `$columnSpan` property and renders inline using the same `streaming-text` or `structured-output` components.

---

Streaming
---------

[](#streaming)

When `->stream()` is enabled on `AiAction`, the `AgentResponseModal` Livewire component pushes response text to the browser in chunks using Livewire v4's `stream()` helper. A blinking cursor is shown while the response is incomplete. Use streaming for long responses where you want to show the user progress rather than waiting for a final result.

```
AiAction::make()
    ->agent(LongFormWriterAgent::class)
    ->stream()
```

---

Structured Output
-----------------

[](#structured-output)

When an agent implements `HasStructuredOutput` from `pixelworxio/laravel-ai-action`, the modal and infolist entry render the result as a formatted definition list rather than plain text. Keys are converted from `snake_case` to Title Case. Array values are rendered as bulleted lists; integers and strings are rendered inline.

To store a structured result, use `->persistResultTo()` — the value is JSON-encoded automatically. `AgentResultEntry` detects the JSON string and renders the structured view.

---

Testing
-------

[](#testing)

Use `FakeAgentAction` from the core package to test Filament actions without making real AI provider calls:

```
use Pixelworxio\LaravelAiAction\Testing\FakeAgentAction;

beforeEach(fn () => FakeAgentAction::reset());

it('persists the agent result to the model column', function (): void {
    FakeAgentAction::fakeResponse(SummaryAgent::class, 'This is the summary.');

    $record = Post::factory()->create();

    $action = AiAction::make('ai')
        ->agent(SummaryAgent::class)
        ->persistResultTo('ai_summary');

    $action->record($record);

    $reflection = new ReflectionMethod($action, 'runAgent');
    $reflection->setAccessible(true);
    $reflection->invoke($action);

    expect($record->fresh()->ai_summary)->toBe('This is the summary.');
    FakeAgentAction::assertAgentCalled(SummaryAgent::class, 1);
});
```

---

Config Reference
----------------

[](#config-reference)

Publish the config file:

```
php artisan vendor:publish --tag=filament-ai-action-config
```

KeyEnv VariableDefaultDescription`default_label``FILAMENT_AI_ACTION_LABEL``'Ask AI'`Default button label for `AiAction` and `AiBulkAction``show_usage``FILAMENT_AI_ACTION_SHOW_USAGE``false`Show input/output token counts in the modal footer`modal_size``FILAMENT_AI_ACTION_MODAL_SIZE``'xl'`Filament modal width (`sm`, `md`, `lg`, `xl`, `2xl`, etc.)`allow_copy``FILAMENT_AI_ACTION_ALLOW_COPY``true`Show a copy-to-clipboard button when the response is complete---

Publishing Assets
-----------------

[](#publishing-assets)

Publish the config file:

```
php artisan vendor:publish --tag=filament-ai-action-config
```

Publish the Blade views to customise the modal and components:

```
php artisan vendor:publish --tag=filament-ai-action-views
```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance88

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

78d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/195972705?v=4)[Pixelworx](/maintainers/Pixelworxio)[@pixelworxio](https://github.com/pixelworxio)

---

Top Contributors

[![whoisthisstud](https://avatars.githubusercontent.com/u/44807533?v=4)](https://github.com/whoisthisstud "whoisthisstud (51 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")

---

Tags

aiai-actionfilamentfilament-packagefilamentphplaravelaimodalactionsfilamentstructured outputtable actions

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/pixelworxio-filament-ai-action/health.svg)

```
[![Health](https://phpackages.com/badges/pixelworxio-filament-ai-action/health.svg)](https://phpackages.com/packages/pixelworxio-filament-ai-action)
```

###  Alternatives

[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[jibaymcs/filament-tour

Bring the power of DriverJs to your Filament panels and start a tour !

12247.8k](/packages/jibaymcs-filament-tour)[aymanalhattami/filament-context-menu

context menu (right click menu) for filament

9838.0k](/packages/aymanalhattami-filament-context-menu)[tapp/filament-google-autocomplete-field

Filament plugin that provides a Google Autocomplete field

3098.1k](/packages/tapp-filament-google-autocomplete-field)[defstudio/filament-searchable-input

A searchable autocomplete input for Filament forms

3212.4k](/packages/defstudio-filament-searchable-input)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
