Approve an AI SDK tool before it runs

pendingApprovals means the agent stopped. Resuming that approval needs the conversation. A one-shot prompt cannot resume it.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/laravel-ai-tool-approval-vue.md
pendingApprovals means the agent stopped. Resuming that approval needs the conversation. A one-shot prompt cannot resume it.
Do not auto-approve inside the tool to "get the demo working".
Do not call the provider from the browser to skip the wait.
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Laravel AI tool approval” call a tool that sends mail and are surprised it ran. A tool that needs a person to say yes stops on pendingApprovals. The AI SDK guide has no tools. Add one only when the approval path exists.

TL;DR

  • pendingApprovals means the agent stopped.
  • Resuming that approval needs the conversation.
  • A one-shot prompt cannot resume it.
  • Do not auto-approve inside the tool to “get the demo working”.

Who it's for: Laravel + Vue developers

Applies to: Laravel 13 · Vue 3

The fix#

The response tells you the agent is waiting. hasPendingApprovals() is the check. pendingApprovals is the list.

php
if ($response->hasPendingApprovals()) {
    return Inertia::render('notes/Approve', [
        'conversation' => $response->conversationId,
    ]);
}

Store the conversation first, the way the conversation guide does, and check ownership before you resume. The Vue page posts the decision. Every pending call needs one. Resume with continue and a Decisions object. A one-shot prompt() with no conversation cannot approve the call.

php
use Laravel\Ai\Approvals\Decision;
use Laravel\Ai\Approvals\Decisions;
use Laravel\Ai\Contracts\ConversationStore;

$store = app(ConversationStore::class);

abort_unless($store->conversationBelongsTo(
    $validated['conversation'],
    $request->user()->getMorphClass(),
    $request->user()->getKey(),
), 403);

$response = (new DraftReply)
    ->continue($validated['conversation'], as: $request->user())
    ->prompt(Decisions::from([
        $validated['call_id'] => Decision::approve(),
    ]));

What to avoid#

Gotcha

Do not auto-approve inside the tool to “get the demo working”. That deletes the reason the approval exists. Do not call the provider from the browser to skip the wait.

FAQ#

How do I approve an AI SDK tool before it runs?

pendingApprovals means the agent stopped. Resuming that approval needs the conversation. A one-shot prompt cannot resume it.

What goes wrong with Laravel AI tool approval?

Many developers call a tool that sends mail and are surprised it ran. Do not auto-approve inside the tool to "get the demo working".

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.