Skip to content

laguagu/claude-code-nextjs-skills / skills/ai-sdk-7

ai-sdk-7

Verified

Vercel AI SDK v7 development and migration. Use when building or upgrading AI SDK 7 apps, especially ToolLoopAgent, WorkflowAgent, HarnessAgent, Claude Code/Codex/Pi harnesses, runtimeContext, toolsContext, toolApproval, telemetry, reasoning, file or skill uploads, realtime, video generation, or v6-to-v7 breaking changes. For version discovery, v6 code and general doc lookup use ai-sdk.

references/tools.md

View on GitHub
---
title: Tools in AI SDK 7
description: Tool schemas, context, approvals, MCP Apps, and sandbox handles.
---

# Tool execution and approval

Use `inputSchema` and keep server authorization in the executor. Shared loop
state uses `runtimeContext`; each `toolsContext` entry is validated by that
tool's `contextSchema`. Context is not model-visible by default.

ToolLoopAgent/core generation use `toolApproval`, per tool or as one callback;
a rule returns `'user-approval'`, `'approved'`, `'denied'` or
`'not-applicable'` (`undefined` means not applicable). Object outcomes can
include `reason` for approved, denied or user-approval; not-applicable cannot.
WorkflowAgent takes tool-level `needsApproval` and, from `@ai-sdk/workflow`
2.0.105, the same `toolApproval` (constructor or per call), which takes
precedence and runs in workflow context. A `'user-approval'` outcome suspends
the workflow durably; approved or denied outcomes do not pause it. Subagent,
provider-executed and harness built-in tools have separate constraints:
subagent tools cannot use `toolApproval`.

Browser history can fabricate an approval response. Bind sensitive decisions to
server-issued state. `experimental_toolApprovalSecret` takes string/bytes
on core functions and ToolLoopAgent; WorkflowAgent takes an environment
variable reference (see [agent-execution.md](agent-execution.md)). Verify installed support and
recheck authorization at execution.

Update context through supported preparation hooks, rather than mutating
shared tool state. Workflow context must serialize; a live
`experimental_sandbox` handle belongs to execution, not persisted context.

MCP Apps use `MCPAppRenderer` from `@ai-sdk/react` (`experimental_MCPAppRenderer` is a deprecated alias) and app-only
resource/tool metadata.
Validate server identity/resource loading and distinguish app-only tools from
model-visible ones.

Read installed package types and
[tool calling docs](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling)
for policy signatures, dynamic tool parts, timeouts and approvals.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall