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.2(2mo ago)3136↓25%[2 PRs](https://github.com/pixelworxio/laravel-ai-action/pulls)1MITPHPPHP ^8.4CI passing

Since Feb 22Pushed 2mo agoCompare

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

READMEChangelog (3)Dependencies (12)Versions (7)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``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
```

---

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`

---

Changelog
---------

[](#changelog)

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

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance85

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.7% 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

79d 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 (58 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

aiai-actionai-agentlaravellaravelaiactions

###  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

[maestroerror/laragent

Power of AI Agents in your Laravel project

630106.4k](/packages/maestroerror-laragent)[mateffy/laravel-codebase-mcp

An MCP server to give Cursor, Aider, etc. the ability to introspect your Laravel codebase directly, by querying for your models, views, routes and classes without raw file search.

201.1k](/packages/mateffy-laravel-codebase-mcp)

PHPackages © 2026

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