Laravel AI SDK: Human Approval and Safe Tool Failures A developer built a human-in-the-loop approval layer into the Laravel AI SDK, letting support agents run read-only tools freely while pausing sensitive actions like large refunds for a manager's sign-off. The v0.10.0 release adds an opt-in Approvable contract, an approval_state column on conversation messages, and a storeApprovalResults() method that custom ConversationStore implementations must provide. Approval gates are enforced in code rather than the system prompt, so they hold even when a model is manipulated or hallucinates an order ID. An AI agent that only reads data is easy to trust. An agent that can refund a payment, delete a record or email a customer is a different story. Two things make that kind of agent safe to ship with the Laravel AI SDK: In this post we’ll build a support agent that can look up orders freely but needs a manager’s approval before a large refund, handles refusals gracefully, and is covered by tests. Why not tell the model “be careful with refunds” in the system prompt? Because a prompt is a suggestion, not a guarantee. Models misread context, get manipulated by text inside user messages, and occasionally hallucinate an order ID. An approval gate is enforced in code, so it holds no matter what the model was talked into. The model still decides what it wants to do. Your code decides whether it happens. Approval is per tool and opt-in : read-only tools keep running instantly. Approval needs persisted conversation history, because a paused agent resumes from stored state: composer require laravel/ai php artisan migrate Configure your provider key in config/ai.php . Upgrading an older install? Human-in-the-loop arrived in v0.10.0 and added a nullable approval state column to the conversation messages table; custom ConversationStore implementations must provide storeApprovalResults . Implement Approvable and use InteractsWithApprovals . Define needsApproval so small refunds run immediately and large ones pause with a reason the reviewer will see: php use Laravel\Ai\Approvals\Approval; use Laravel\Ai\Concerns\InteractsWithApprovals; use Laravel\Ai\Contracts\Approvable; use Laravel\Ai\Contracts\Tool; class IssueRefund implements Approvable, Tool { use InteractsWithApprovals; public function handle Request $request : Stringable|string { $order = Order::findOrFail $request 'order id' ; if $order- delivered at- lt now - subDays 30 { throw new RuntimeException "Order {$order- id} can no longer be refunded: it's outside the 30-day window." ; } $order- refund $request 'amount' ; return "Refunded {$request 'amount' } on order {$order- id}."; } protected function needsApproval Request $request : Approval|bool { return $request 'amount' <= 100 ? false : Approval::required 'Refunds over $100 need a manager.' ; } // description and schema as for any tool } The agent must be Conversational with persisted history, which RemembersConversations handles: php use Laravel\Ai\Concerns\RemembersConversations; use Laravel\Ai\Contracts\Agent; use Laravel\Ai\Contracts\Conversational; use Laravel\Ai\Promptable; class SupportAgent implements Agent, Conversational { use Promptable, RemembersConversations; public function tools : iterable { return new LookUpOrder - withoutApproval , new IssueRefund, ; } } Want every refund reviewed? Use new IssueRefund - requireApproval 'Every refund gets reviewed.' . php $response = new SupportAgent - forUser $customer - prompt 'My headphones on order 4192 arrived broken. I want my $249 back.' ; if $response- hasPendingApprovals { foreach $response- pendingApprovals as $approval { PendingRefund::create 'conversation id' = $response- conversationId, 'tool call id' = $approval- id, 'tool' = $approval- tool, 'arguments' = $approval- arguments, 'reason' = $approval- reason, ; } } Each pending approval carries the tool call ID, tool name, the arguments the model chose, and your reason. That table is your approval queue. A manager needs to see what the agent wants to do and why: @foreach $pendingRefunds as $refund