PHPackages                             builtbyberry/laravel-swarm - 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. builtbyberry/laravel-swarm

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

builtbyberry/laravel-swarm
==========================

Multi-agent swarm orchestration for Laravel, built on Laravel AI.

v0.9.1(2w ago)11313↓12.5%[18 issues](https://github.com/builtbyberry/laravel-swarm/issues)[2 PRs](https://github.com/builtbyberry/laravel-swarm/pulls)MITPHPPHP ^8.5

Since Apr 22Pushed 6d agoCompare

[ Source](https://github.com/builtbyberry/laravel-swarm)[ Packagist](https://packagist.org/packages/builtbyberry/laravel-swarm)[ Docs](https://swarm.builtbyberry.com)[ RSS](/packages/builtbyberry-laravel-swarm/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (19)Versions (38)Used By (0)

[![](https://camo.githubusercontent.com/4b593e83f568ddedcc3e260ad13f911d90a5b8d0bb300452d1a09ca510e29034/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230537761726d2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6275696c74627962657272792532466c61726176656c2d737761726d267061747465726e3d617a746563267374796c653d7374796c655f31266465736372697074696f6e3d4c696768747765696768742b6f726368657374726174696f6e2b7061636b6167652b666f722b636f6f7264696e6174696e672b41492b6167656e74732532432b776f726b666c6f77732532432b616e642b64697374726962757465642b7461736b2b657865637574696f6e2b77697468696e2b4c61726176656c2b6170706c69636174696f6e732b6275696c742b6f6e2b4c61726176656c2b4149266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d636f67)](https://camo.githubusercontent.com/4b593e83f568ddedcc3e260ad13f911d90a5b8d0bb300452d1a09ca510e29034/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230537761726d2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6275696c74627962657272792532466c61726176656c2d737761726d267061747465726e3d617a746563267374796c653d7374796c655f31266465736372697074696f6e3d4c696768747765696768742b6f726368657374726174696f6e2b7061636b6167652b666f722b636f6f7264696e6174696e672b41492b6167656e74732532432b776f726b666c6f77732532432b616e642b64697374726962757465642b7461736b2b657865637574696f6e2b77697468696e2b4c61726176656c2b6170706c69636174696f6e732b6275696c742b6f6e2b4c61726176656c2b4149266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d636f67)

Laravel Swarm
=============

[](#laravel-swarm)

[![Latest Version on Packagist](https://camo.githubusercontent.com/18d1d9be742c06d92a5afdbdf8d0fa983da78fdc367d12ee500c56fe4f92337d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6275696c74627962657272792f6c61726176656c2d737761726d2e737667)](https://packagist.org/packages/builtbyberry/laravel-swarm)[![Total Downloads](https://camo.githubusercontent.com/d51abfc90b695bda513dcdd684f5d8c81470d8b0630bdfed7883be3fc48f87a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6275696c74627962657272792f6c61726176656c2d737761726d2e737667)](https://packagist.org/packages/builtbyberry/laravel-swarm)[![Tests](https://github.com/builtbyberry/laravel-swarm/actions/workflows/tests.yml/badge.svg)](https://github.com/builtbyberry/laravel-swarm/actions/workflows/tests.yml)[![Nightly (Laravel dev-main)](https://github.com/builtbyberry/laravel-swarm/actions/workflows/nightly.yml/badge.svg)](https://github.com/builtbyberry/laravel-swarm/actions/workflows/nightly.yml)[![License](https://camo.githubusercontent.com/334a6faa0f66377a1cfdf742c5ced98f1d7ed559b2e29037b7480404c5e588e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6275696c74627962657272792f6c61726176656c2d737761726d2e737667)](https://packagist.org/packages/builtbyberry/laravel-swarm)[![PHP Version Require](https://camo.githubusercontent.com/423634ed1e0da7071c97bc032e954ef6e35a19aa6ef502547766f4c4f18dc34b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6275696c74627962657272792f6c61726176656c2d737761726d2f7068702e737667)](https://packagist.org/packages/builtbyberry/laravel-swarm)[![Documentation](https://camo.githubusercontent.com/4f1f48f6ca9fd55bc7d24ef16279f1c776fa3ccd5a5bc242bc3e7801a0b008c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d737761726d2e6275696c74627962657272792e636f6d2d3235363365622e737667)](https://swarm.builtbyberry.com)

> **📚 Full documentation: [swarm.builtbyberry.com](https://swarm.builtbyberry.com)**

Laravel Swarm brings reusable multi-agent orchestration to [Laravel](https://laravel.com) on top of the official [Laravel AI](https://github.com/laravel/ai) package.

Define a swarm once, return the Laravel AI agents that participate in it, and run the workflow synchronously, on a queue, as a stream, or as a checkpointed durable run.

- **Documentation:** [swarm.builtbyberry.com](https://swarm.builtbyberry.com)
- **Packagist:** `builtbyberry/laravel-swarm`
- **Namespace:** `BuiltByBerry\LaravelSwarm`
- **Repository:**
- **In-repo docs:** [docs/README.md](docs/README.md)
- **Examples:** [examples/README.md](examples/README.md)
- **Upgrading:** [UPGRADING.md](UPGRADING.md)
- **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md)

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

[](#quick-start)

```
composer require builtbyberry/laravel-swarm
php artisan swarm:install
php artisan make:swarm:swarm ContentPipeline
```

```
use App\Ai\Swarms\ContentPipeline;

$response = ContentPipeline::make()->prompt('Draft a launch post about Laravel queues.');

echo $response->output;
```

For background execution, streaming, and durable workflows, see [Choosing An Execution Mode](#choosing-an-execution-mode).

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

[](#requirements)

- PHP **8.5+**
- Laravel **13+**
- `laravel/ai` **^0.6**

This package declares `"minimum-stability": "dev"` with `"prefer-stable": true` because `laravel/ai` is still pre-1.0 and ships dev-tagged releases. Composer will not resolve a pre-stable transitive dependency from a stable consuming project, so your application's `composer.json` must also set:

```
{
    "minimum-stability": "dev",
    "prefer-stable": true
}
```

`prefer-stable` keeps Composer biased toward tagged releases — only dependencies without a stable release (today, `laravel/ai`) resolve to a `dev-` constraint. This requirement will be dropped when `laravel/ai` reaches 1.0; the package will then move to `"minimum-stability": "stable"` and consuming applications will be free to do the same.

Laravel Swarm orchestrates the same Laravel AI agents, providers, and streams as your application. Treat Composer updates to Laravel or `laravel/ai` as integration-test events: run your test suite and any queued, streamed, or durable swarm smoke paths after dependency changes. This package's [changelog](CHANGELOG.md) covers Swarm-owned changes; it does not replace verification against upstream Laravel or Laravel AI releases.

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

[](#installation)

Require the package with Composer, then run the interactive installer:

```
composer require builtbyberry/laravel-swarm
php artisan swarm:install
```

Tagged releases are available on [Packagist](https://packagist.org/packages/builtbyberry/laravel-swarm). Pin a tagged release for production applications.

`swarm:install` walks you through the full setup in one shot — it publishes `config/swarm.php`, seeds the canonical Swarm `.env` keys with safe defaults, runs the package migrations (or scaffolds `LaravelSwarm::ignoreMigrations()` for a cache-only deployment), warns when `QUEUE_CONNECTION=sync`, and offers to dispatch the targeted sub-installers in the same pass:

- [`swarm:install:durable`](docs/durable-execution.md) — scheduler entries (`swarm:relay`, `swarm:recover`, `swarm:prune`), persistence/queue checks, copy-paste worker snippets.
- [`swarm:install:audit`](docs/audit-evidence-contract.md) — bind a `SwarmAuditSink` (and optional `SwarmAuditSigner` / `ActorResolver` / `CapturePolicy`) inside `AppServiceProvider`.
- [`swarm:install:pulse`](docs/pulse.md) — register the Swarm recorders and dashboard cards (only offered when `laravel/pulse` is installed).
- [`swarm:install:examples`](docs/examples.md) — copy the runnable starter example pack into `app/Ai/`.

For CI and scripted setups, every prompt has a flag override:

```
php artisan swarm:install \
    --no-interaction \
    --persistence=database \
    --with-durable --with-audit --with-examples
```

Pass `--without-` to skip a sub-installer in non-interactive mode, `--persistence=cache` for cache-only deployments, `--skip-migrate` to defer migrations, or `--force` to overwrite an existing `config/swarm.php`.

After the install, confirm everything wired up cleanly:

```
php artisan swarm:health
php artisan swarm:health --durable
```

`--durable` also verifies the database tables required by `dispatchDurable()` and coordinated multi-worker hierarchical queueing.

Read [Getting Started](docs/getting-started.md) for the full new-user walkthrough — installer flow, post-install verification, and running your first starter swarm in under five minutes.

### Advanced setup (manual)

[](#advanced-setup-manual)

Prefer to wire things by hand? Every step `swarm:install` performs has a stable manual equivalent. See [Advanced Setup](docs/advanced-setup.md) for the full manual flow — config publish, migrations vs. `ignoreMigrations()`, scheduler entries, audit sink binding, Pulse recorder + dashboard registration, and copying the starter examples by hand.

Your First Swarm
----------------

[](#your-first-swarm)

Generate a swarm class:

```
php artisan make:swarm:swarm ContentPipeline
```

See [Generators](docs/generators.md) for the full generator surface, including `make:swarm:agent` and the `--topology` flag.

Swarms live in `App\Ai\Swarms`, implement `BuiltByBerry\LaravelSwarm\Contracts\Swarm`, use the `Runnable` trait, and return their participating Laravel AI agents from `agents()`:

```
