October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Build a Nuxt AI Agent That Gets Approval Before It Acts

Use AI SDK 7's invocation-level toolApproval policy to pause consequential Nuxt tool calls, present the request in Vue, and resume only after a user decision.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To make a consequential server-side tool wait for a person, set an approval policy on the AI SDK 7 streamText invocation, show the resulting approval request in the Nuxt client, and submit the user’s decision before the tool runs. For example, configure toolApproval: { deleteFile: 'user-approval' } for a file-deletion tool. The policy controls whether the call needs approval; the tool itself remains responsible for safely performing its server-side operation.

How the approval flow fits into Nuxt

The official AI SDK Nuxt quickstart uses a server API handler at server/api/chat.ts. The handler reads UI messages, converts them to model messages, calls streamText, and returns a UI message stream. In the browser, @ai-sdk/vue supplies useChat for message state and submission.

As an Amazon Associate I earn from qualifying purchases.

For a protected tool, the flow is: the model proposes a tool call; the SDK pauses it and sends an approval request to the UI; the user approves or denies; then the application continues the run. The file operation does not happen merely because the model proposed it.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Define the server-side tool. Implement the operation and validate its arguments on the server. For deletion, constrain which files are eligible and verify that the resolved path remains inside the allowed directory.
  2. Set approval on the invocation. In the server handler’s streamText options, use toolApproval: { deleteFile: 'user-approval' } for the named tool.
  3. Render the pending request. In the Vue chat interface, detect the tool-call part whose state is approval-requested. Display the requested action and the relevant arguments so the person can make an informed choice.
  4. Send the decision and continue. Use addToolApprovalResponse to submit approval or denial. The SDK documents lastAssistantMessageIsCompleteWithApprovalResponses as a way to continue automatically once the approval responses for the last assistant message are complete.

The exact component and state-handling details depend on the app’s UI and installed SDK version; the key contract is to surface the approval-requested tool part and return a decision rather than executing the operation from the approval button itself.

Put the policy on the agent invocation, not in the delete operation

AI SDK documentation describes the feature this way: “Tool execution approval lets you require user confirmation before a server-side tool runs.” (AI SDK Chatbot Tool Usage.) In current documentation, approval is configured with toolApproval on streamText. This keeps the decision about whether a call must wait in the run’s configuration, separate from the server-side tool implementation.

That separation matters when the same tool is used in different contexts. One agent run may require explicit confirmation for every deletion, while another may apply a policy that approves or denies calls automatically. The tool should still enforce its own input validation and access boundaries in either case; an approval prompt is not a substitute for secure server-side checks.

Avoid copying examples that use the tool-level needsApproval property without checking their version: current tool-usage documentation marks it deprecated. Follow the API documented for the version installed in your application.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a policy that matches the action’s risk

AI SDK 7 release notes describe user approval, automatic approve or deny, and typed policy functions that can be applied at the call or agent level. These are different ways to decide whether execution may proceed, not different file-operation implementations.

Approach When it fits What to consider
Require user approval for a named tool A consequential action should always pause for a person, such as deleting a file. Use toolApproval: { deleteFile: 'user-approval' } on the streamText invocation and give the UI enough detail to review the proposed call.
Use an approval policy function Different calls may require different outcomes based on application policy. AI SDK 7 release notes describe typed policies at the call or agent level, including automatic approval or denial. Define the policy deliberately; do not assume a human prompt appears for every call.
Add safeguards for delayed decisions An approval may arrive after a pause, restart, or other change in the run’s context. Revalidate the tool inputs and applicable policies before continuing. The release notes also describe opt-in HMAC-signed approvals that bind confirmation to the original tool inputs.

The release notes document these safeguards as capabilities; they do not mean that every example enables them automatically. For runs that must wait durably across restarts or extended delays, Vercel describes WorkflowAgent as a separate durable-execution option. Choose and configure it as part of the run architecture rather than treating it as an automatic property of a basic chat handler.

Make the approval screen meaningful and safe

An approval button is useful only if the user can understand what will happen. For a deletion request, show the specific target and action rather than a generic “Run tool?” prompt. Keep the server authoritative: re-check the supplied path, permissions, and current policy when the tool executes, and reject anything outside the allowed scope.

  • Do not treat model-generated arguments as trusted input.
  • Resolve and validate a requested file path against the permitted directory on the server; a prefix-only string comparison is not a reliable boundary check.
  • Do not let the browser perform the deletion as a side effect of clicking approve. The client should submit the approval response; the server-side tool performs the operation only after the SDK resumes execution.
  • For approvals that may be delayed, use the release-documented revalidation and optional signed-approval mechanisms where appropriate, and ensure the application has a safe way to resume or expire the pending request.

Provider choice is separate from approval

The Nuxt quickstart currently documents Vercel AI Gateway and explains how to select other provider packages, including first-party, OpenAI-compatible, and community options. The approval policy belongs to the tool-execution configuration, so the design does not require a particular model provider. The tutorial result associated with this topic describes Claude through Amazon Bedrock, but that is an example provider choice, not a prerequisite for user approval.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Version notes for the reported demo

The tutorial’s search result reports these package versions for its recorded demo. They are demo pins only, not a claim that they remain current or that another set of package versions is compatible:

Package Reported demo version
Nuxt 4.5.2
Vue 3.5.41
ai 7.0.66
@ai-sdk/vue 4.0.66
@ai-sdk/amazon-bedrock 5.0.57
@aws-sdk/credential-providers 3.1111.0
@nuxt/ui 4.10.0
Zod 4.4.3

The exact-title tutorial page was not available to verify its code, so its reported pins and summary of a fixture-directory path-boundary check should not be mistaken for a reviewed implementation. Consult the tutorial’s code or repository directly before relying on its specific example. The current AI SDK documentation links below describe the approval API and Nuxt integration.

Official references

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.