Open Source / laravel-swarm

Multi-agent orchestration as a Laravel primitive.

Define a swarm once. Run it synchronously, on a queue, as a live stream, or as a checkpointed durable workflow that survives deploys, restarts, and the human-review pauses real operations need.

Install

composer require builtbyberry/laravel-swarm

At a glance

v0.x · MIT

Requires — PHP 8.5+ · Laravel 13+

Built on — laravel/ai ^0.6

Topologies — Sequential · Parallel · Hierarchical

Execution — Sync · Queued · Streamed · Durable

Namespace — BuiltByBerry\LaravelSwarm

In practice

A swarm is a class. You run it like anything else.

Declare the agents and the topology, then call it. It returns a typed response — synchronously here, or queued, streamed, or durable when the work needs it. The full API, every topology, and the working examples live in the docs.

ContentPipeline.php
#[Topology(TopologyEnum::Sequential)]
class ContentPipeline implements Swarm
{
    use Runnable;

    public function agents(): array
    {
        return [
            new ArticlePlanner,
            new ArticleWriter,
            new ArticleEditor,
        ];
    }
}

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

echo $response->output;

Why it exists

Agentic work belongs in the application that already runs the business.

Most agent frameworks ask your team to stand up a parallel Python service, a parallel queue, a parallel observability stack, and a parallel deploy pipeline — then ask you to trust it with production work.

Swarm puts orchestration where your data, auth, queues, broadcasts, and audit trail already live.

01

Native, not a sidecar

Eloquent, queues, Reverb, Telescope, your existing auth. Agents are just Laravel.

02

Durable by default

Checkpointed execution survives deploys, restarts, and the human-review pauses real operations need.

03

Auditable end-to-end

Every tool call, every step, every retry — in the same database your reports already pull from.

What you build with it

The kind of work spreadsheets and Zapier give up on.

Workflow execution

Multi-step agentic operations

Onboarding, ticket triage, document drafting, deal qualification. Agents draft, route, and reconcile. Humans approve exceptions only.

Embedded judgment

Agent steps inside existing systems

Drop an agent into the request lifecycle of your admin app or internal tool. Same auth, same audit log, no new infrastructure.

Long-running processes

Durable workflows with human review

Processes that span days, pause for human approval, retry on failure, and resume across deploys without losing state.

Companion package

Want to see the runs? Add the Filament panel.

laravel-swarm-filament is a free, read-only Filament panel that turns every swarm run into a topology-aware flow graph — click any step for its inputs, outputs, tokens, timing, and memory. It reads what Swarm persists; it never mutates a run.

Companion package

Want an AI client to read the runs? Add the MCP server.

laravel-swarm-mcp is a free, read-only Model Context Protocol server that exposes run history, durable-run state, and audit health as MCP resources — so Claude, Cursor, or any MCP client can inspect what your agents did. Zero tools; it reads what Swarm persists and never mutates a run.

The deep dive lives on swarm.builtbyberry.com

Topologies, durable execution, the trust surface, testing, 17 working examples.

Swarm has its own home. Architecture, the full API, every code sample, and the running guide all live there. This page is the door.

How we use it

Swarm is how we work, not what we sell.

Every operational AI engagement Built by Berry ships runs on this framework. We use it ourselves, in client production, on real operations. The package is the proof — the engagements are the offer.