Skip to content
Laravel package · 0.9.0-beta.10

Write each Laravel operation once.

One Action class answers your web forms, JSON, Artisan, the queue, TypeScript, laravel/ai agents and MCP clients, each through the same checked pipeline.

composer require agentic-actions/laravel:^0.9@beta
01 · One action

One action, every caller

Mark the class #[Expose] for the route, agents and MCP; Artisan and the queue reach it either way.

  • Web form and JSON/actions/create-post
  • Artisanactions:run create-post
  • The queueCreatePost::dispatch()
app/Actions/CreatePost.php
php
#[Expose]
final class CreatePost extends Action
{
    protected ?Effect $effect = Effect::Write;

    public function schema(JsonSchema $schema): array { … }
    public function authorize(ActionContext $context): bool { … }
    public function handle(ActionContext $context, ValidatedInput $input) { … }
}
  • TypeScriptcreatePost()
  • A laravel/ai agenta tool in its toolset
  • MCP clientsthe create-post tool
One action, every caller
02 · The pipeline

Every call takes the same steps

Whoever calls, the same checks run. A step before authorize() that says no answers “not found”, so a caller cannot tell a hidden action from a missing one.

  1. exposure#[Expose] lets the caller in
  2. token abilitiesactions:write for a Write
  3. tenant membershipthe person is in the team
    not a member: 404
  4. authorize()before the input, after validation, or both
  5. validationschema() as rules
  6. handle()does the work
  7. output allowlistonly declared keys leave
The pipeline
03 · Around the pipeline

Built for a person working with an agent

  • The copilot

    An agent works on the page. Each action call shows as a live row, and the page reloads what the write touched.

    Copilot
    Person:
    Draft a post about the spring meetup.
    Looked it updone
    Saving…running
    Agent:
    Saving it as a draft for you.
  • Confirmations

    A Destructive or External call waits until the person confirms it, on a card the server builds.

    Copilot
    Person:
    Delete my old meetup draft.
    Waiting for your confirmation

    Delete this post? This cannot be undone.

    Post
    Spring meetup
    Status
    draft
    DeclineConfirm
  • Tenants

    Every tenant-scoped call runs inside one team. A stranger gets the same 404 as a team that does not exist.

    example.com/teams/design/posts
    Team
    Designcurrent
    Research
    /​teams/​design/​actions/​create-posta memberruns
    /​teams/​sales/​actions/​create-postnot a member404
  • MCP and OAuth

    Clients connect with a person's token or sign in with OAuth, and reach Read and Write actions only.

  • Tables and charts

    A Read action's rows reach the person as a table. The numbers come from your query; the model reads a short copy.

    Copilot
    Looked it updone
    AuthorPostsWords
    Sam129,400
    Alex86,100
    Robin52,800
    Agent:
    Sam wrote the most words this month.
  • Testing

    Fake every action, assert what ran, and pin what each toolset holds, so a widened toolset fails a test.

    Terminal
    $ vendor/bin/pest
    $fake​->assertRan(CreatePost::class)
    $fake​->assertNotRan(PublishPost::class)
    assertToolset('default', ['create-post'])
    3 passed

Start with one action.

Install the package, write CreatePost, and call it from a form, the CLI and an agent.

composer require agentic-actions/laravel:^0.9@beta

Released under the MIT License.