Skip to main content
Laravel applications use the Superwire\Laravel\Workflow fluent API to send workflows to the executor.

Install package

Run a workflow from a file

Run a workflow from source

Cache key

Use cacheKey() to opt into executor caching for a specific client-controlled scope. Reuse the same key to reuse matching cached agent outputs, or change the key to start a fresh cache scope.

Stream workflow events

stream() yields ExecutorEvent instances.
streamToResult() consumes the stream and returns the final WorkflowResult.

Event helpers

An ExecutorEvent exposes:
Known event kinds include workflow started, workflow planned, agent started, agent completed, tool call started, tool call completed, tool call failed, MCP call started, MCP call completed, MCP call failed, workflow completed, and workflow failed.

Validate and format

Map output into a class

mapInto() maps the final output into a PHP class. If the class has a static from() method, it is used. Otherwise, array output is passed as named constructor arguments.

Testing with fakes

Testing patterns

Validate workflow contracts in tests:
Use fake execution for deterministic application tests:
Test data guidance:
  • Keep test workflows small.
  • Use deterministic inputs.
  • Avoid live provider calls in unit tests.
  • Reserve end-to-end tests for the executor boundary.

API summary