builtbyberry/laravel-swarm
Laravel Swarm is a package for building multi-agent AI workflows in Laravel. It lets you define agents, tools, and handoffs, then coordinate them through simple, testable PHP classes.
config/swarm.php). For v0.28.1, read UPGRADING.md first — the frozen_view retry save and memory-tool failure reporting changes affect existing runs.SWARM_MEMORY_TOOLS_AGENT_SCOPE=true and call swarmMemoryTools(agentScope: true) in your agent, or bind a custom tool with forAgent().HasSwarmMemoryTools. A simple first use case is: an agent recalls a prior entry with Recall, writes a new entry with Remember, then runs a small hierarchical plan built with RoutePlanSchema::worker() / node() / rollup().make:memory-tool. For agent-scoped tools, use --scope=agent only after confirming you have both the agent_scope config key and a forAgent() binding.Remember / Recall to an agent with forAgent(), or use swarmMemoryTools(agentScope: true). Agent memory is keyed by agent class, so it is shared across runs and tenants of that class — do not treat it as per-run storage.Remember stores under any propagation policy. A bound Recall only returns the entry when the policy includes the agent scope. Configure the propagation policy with that asymmetry in mind.nativeResult->tools and SwarmToolResult events as authoritative. Declined Remember writes (empty key, reserved swarm: prefix, unknown scope, unaddressable scope) now report as failed. Capture-policy Skip also reports as failed and tells the model not to retry. The run continues so the model can correct or retry where allowed.frozen_view retries: Under the default replay mode, a Run-scope SwarmMemory put/forget made through the replay view, including Remember, is saved after the retried step’s invocation, guardrails, and step recording succeed — before the durable checkpoint. Later steps can read the value. A retry that fails before that point saves nothing.RoutePlanSchema::worker() for worker nodes. with_outputs is now required (may be empty), and next is required but nullable. rollup() / node() plans may use with_outputs as a list of node ids or as an alias map. Plain worker branches may omit next when it names the join of every parallel group that owns the branch; the planner treats it as redundant.next names its group’s join no longer throws. A model constrained by worker() may return next: null.make:memory-tool --scope=agent stubs warn that a forAgent() binding and the agent_scope key are required, and they no longer generate an agent() override. Existing generated classes that override agent() still work, but remove the null-returning placeholder before binding with forAgent().frozen_view retry writes are now saved by default and there is no switch. The save is not atomic. A successful retry now emits ordinary memory events, and a write the capture policy skips at save time fails the step. If you depend on the old discard behavior, read UPGRADING.md before upgrading.Remember writes and capture-policy Skip writes previously looked successful; they now appear as failed in nativeResult->tools and as unsuccessful SwarmToolResult events. Applications building metrics on those results will see a shift even though storage behavior is unchanged.SwarmMemory::put() and MemoryStore::put() can return a prospective entry that was not persisted. Do not rely on its outcome metadata. Use the MemoryWriteSkipped event as the supported application signal for skipped writes.swarm.memory.tools.agent_scope config key (SWARM_MEMORY_TOOLS_AGENT_SCOPE, default false) and a forAgent() binding (or swarmMemoryTools(agentScope: true)) are both required. With either missing, tools behave as in v0.28.0 apart from failure reporting.agent() is not governed by the agent_scope key, and an agent() override wins over a forAgent() binding. Remove old generated agent() placeholders before binding with forAgent().RoutePlanSchema::worker() now declares with_outputs as required and changes next from string to string-or-null. The planner still accepts worker nodes that omit next, so scripted coordinators and PHP-authored plans usually need no change. Static plans may use the list form for with_outputs.nativeResult->tools and the SwarmToolResult event. For a skipped write, the model sees The entry [key] was not stored. Do not retry this write. The policy’s reason is not shown to the model.forAgent(). MemoryCapturePolicy controls skips and now surfaces skipped writes as failures for tool calls. RoutePlanSchema helpers and the hierarchical planner remain the main integration surface for plan validation.How can I help you explore Laravel packages today?