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.
- 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.
- Set approval on the invocation. In the server handler’s
streamTextoptions, usetoolApproval: { deleteFile: 'user-approval' }for the named tool. - 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. - Send the decision and continue. Use
addToolApprovalResponseto submit approval or denial. The SDK documentslastAssistantMessageIsCompleteWithApprovalResponsesas 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.
#1 Best Overall
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.
Rank #2
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.
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.
Rank #4
- 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.
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:
Best Value
| 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.
Quick Recap
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.




