Skip to content

Sponsor

Events

Tackle dispatches Laravel events around the agent lifecycle, so ordinary listeners can observe — or veto — what agents do. (For config-declared, ordered policy — including shell-command hooks and argument rewriting — see Hooks.)

EventWhenPayload
Tackle\Events\SessionStartedAn ai:code / ai:run session beginscommand, provider, model
Tackle\Events\SessionEndedThe session endscommand, token counts, estimated cost
Tackle\Events\ToolCallingBefore a tool executes — vetoabletool name, arguments
Tackle\Events\ToolCalledAfter a tool executestool name, arguments, result, duration

A ToolCalling listener that returns false blocks the call (the agent receives a refusal and reroutes); returning a string uses it as the refusal message. Anything else observes without interfering:

php
use Tackle\Events\ToolCalling;
use Tackle\Events\ToolCalled;

Event::listen(ToolCalling::class, function (ToolCalling $event) {
    if ($event->tool === 'RunShell' && now()->isWeekend()) {
        return 'No shell commands on weekends.';
    }
});

Event::listen(ToolCalled::class, function (ToolCalled $event) {
    AgentAudit::record($event->tool, $event->arguments, $event->durationMs);
});

Events fire for the tools of DefaultCodingAgent (and subclasses) and the self-healer. This is an extension layer on top of the safety guards, not a replacement — PathGuard, shell modes, and allowlists still apply first. Requires a laravel/ai version with ToolNameResolver (0.10+); on older versions the events simply don't fire.

Released under the MIT License.