PHPackages                             pixelworxio/laravel-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/laravel-ai-action

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pixelworxio/laravel-ai-action
=============================

AI-powered actions for Laravel — a clean integration layer built on laravel/ai

1.0.7(1w ago)3383↓53.8%1[2 PRs](https://github.com/pixelworxio/laravel-ai-action/pulls)1MITPHPPHP ^8.4CI passing

Since Feb 22Pushed 1w agoCompare

[ Source](https://github.com/pixelworxio/laravel-ai-action)[ Packagist](https://packagist.org/packages/pixelworxio/laravel-ai-action)[ RSS](/packages/pixelworxio-laravel-ai-action/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (38)Versions (24)Used By (1)

[![laravel-ai-action](https://camo.githubusercontent.com/a3ee73813997414d64e2fd833fc6dcfa69df1fc61f082543f1cfcc8834080292/68747470733a2f2f736f6369616c6966792e6769742e63692f706978656c776f7278696f2f6c61726176656c2d61692d616374696f6e2f696d6167653f637573746f6d5f6465736372697074696f6e3d537472756374757265642532432b7465737461626c652b41492b616374696f6e732b666f722b4c61726176656c2b2545322538302539342b6275696c742b6f6e2b6c61726176656c25324661692e26637573746f6d5f6c616e67756167653d4c61726176656c266465736372697074696f6e3d31266c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d536f6c6964267468656d653d4175746f)](https://camo.githubusercontent.com/a3ee73813997414d64e2fd833fc6dcfa69df1fc61f082543f1cfcc8834080292/68747470733a2f2f736f6369616c6966792e6769742e63692f706978656c776f7278696f2f6c61726176656c2d61692d616374696f6e2f696d6167653f637573746f6d5f6465736372697074696f6e3d537472756374757265642532432b7465737461626c652b41492b616374696f6e732b666f722b4c61726176656c2b2545322538302539342b6275696c742b6f6e2b6c61726176656c25324661692e26637573746f6d5f6c616e67756167653d4c61726176656c266465736372697074696f6e3d31266c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d536f6c6964267468656d653d4175746f)

 [![GitHub Tests Action Status](https://camo.githubusercontent.com/b5b8bcf6e8d95a3fad08557177f14d703371f30793d129ad837ee3b285031b17/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706978656c776f7278696f2f6c61726176656c2d61692d616374696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/pixelworxio/laravel-ai-action/actions/workflows/run-tests.yml) [![GitHub Stars](https://camo.githubusercontent.com/a8a00957ec5ce4f1a19415b44123baa46011bd42455736c9b0a79ceded014a66/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f706978656c776f7278696f2f6c61726176656c2d61692d616374696f6e3f7374796c653d666c61742d737175617265)](https://github.com/pixelworxio/laravel-ai-action)

---

What does this package do?
--------------------------

[](#what-does-this-package-do)

This package offers an architectural pattern that sits on top of `laravel/ai` to provide a consistent, structured, and testable way to execute AI actions in your Laravel app.

`laravel/ai``laravel-ai-action`**Abstraction level**Agents, tools, streaming primitivesSingle-responsibility action classes**Context passing**Manual`AgentContext` DTO (record, meta, user instruction)**Output handling**Raw response objectsTyped `AgentResult` with token tracking**Structured output**`StructuredAnonymousAgent``HasStructuredOutput` + `mapOutput()`**Streaming**Iterator + event handling`HasStreamingResponse` callbacks**Queue support**None built-in`RunAgentActionJob` (unique, queueable)**Testing**Mock the SDK`FakeAgentAction` + fluent assertions**Artisan scaffolding**None`php artisan make:ai-action`If you're wiring AI calls directly into controllers or service classes, you're reinventing this. `laravel-ai-action` gives every AI capability in your app a **consistent, discoverable home** — the same way `laravel/actions` does for business logic.

---

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

[](#requirements)

DependencyVersionPHP`^8.4`Laravel`^12.0 || ^13.0``laravel/ai``^0.1`---

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

[](#installation)

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

Publish the config to customise defaults:

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

---

Quick Start
-----------

[](#quick-start)

```
php artisan make:ai-action SummarizePost
```

```
// app/Ai/Actions/SummarizePost.php
final class SummarizePost implements AgentAction
{
    use InteractsWithAgent;

    public function instructions(AgentContext $context): string
    {
        return 'You are a concise technical writer. Summarize in three sentences.';
    }

    public function prompt(AgentContext $context): string
    {
        return sprintf("Summarize:\n\n%s", $context->record->body);
    }

    public function handle(AgentContext $context): AgentResult
    {
        return app(RunAgentAction::class)->execute($this, $context);
    }
}
```

```
// In a controller or job
$context = AgentContext::fromRecord($post);
$result  = $this->runner->execute(new SummarizePost(), $context);

echo $result->text;         // "This post covers..."
echo $result->inputTokens;  // 320
```

---

MCP Bridge (opt-in)
-------------------

[](#mcp-bridge-opt-in)

Expose any `AgentAction` as a [Laravel MCP](https://laravel.com/docs/13.x/mcp) tool — reachable from Claude Desktop, Cursor, and any MCP-aware client — with a few additional methods and one env flag.

```
composer require laravel/mcp
```

```
AI_ACTION_MCP_ENABLED=true
```

```
php artisan make:ai-action SummarizeInvoice --mcp
```

```
// In your AppServiceProvider::boot():
use Pixelworxio\LaravelAiAction\Mcp\Facades\AiActionMcp;

AiActionMcp::tool(\App\Ai\Actions\SummarizeInvoice::class);
```

See [**docs/mcp.md**](docs/mcp.md) for the full guide including auth scoping, annotation forwarding, auto-discovery, and custom response formatting.

---

Documentation
-------------

[](#documentation)

- [**Actions**](docs/actions.md) — creating actions, contracts, and execution modes
- [**Context**](docs/context.md) — `AgentContext` reference and usage
- [**Results**](docs/results.md) — `AgentResult` reference and usage
- [**Testing**](docs/testing.md) — `FakeAgentAction` and fluent assertions
- [**Configuration**](docs/configuration.md) — all config keys and environment variables
- [**Queue**](docs/queue.md) — background execution with `RunAgentActionJob`
- [**MCP Bridge**](docs/mcp.md) — exposing actions as MCP tools (opt-in)

---

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~17 days

Total

8

Last Release

8d 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 (72 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (49 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (47 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (1 commits)")

---

Tags

aiai-actionai-agentlaravellaravelmcpaiactions

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[eslam-reda-div/filament-copilot

A Filament plugin for AI-powered copilot features.

359.8k](/packages/eslam-reda-div-filament-copilot)

PHPackages © 2026

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