What This Checklist Covers
This checklist is organized by architectural layer rather than by generic AI risk category, because Vercel AI SDK and Next.js implementations fail in specific, structural ways. The AI SDK's tools parameter in generateText and streamText lets developers define functions with a description, an input schema, and an execute function that runs when the model requests it. That execute function runs with the same privileges as the surrounding application code. The SDK does not perform authorization checks, rate limiting, or sandboxing by default. Next.js contributes its own boundary conditions: Server Actions are exposed as public HTTP endpoints regardless of how they are called in application code, and Route Handlers running on Edge versus Node.js runtimes have different available security libraries. Reviewing an agent implementation means checking each of these boundaries independently, not assuming that passing a schema validation step is sufficient.
Model Provider and Credential Handling
Model provider API keys and any downstream service credentials used inside tool execute functions should be scoped server-side only. The AI SDK's client-server split does not automatically prevent key exposure; misconfiguration, such as passing provider clients into client components, can still leak credentials. Structured output generation through generateObject or streamObject validates model output against a provided schema, but this covers shape and type conformance only. It does not verify that the values are semantically correct or that the requesting user is authorized to receive or act on that output. Teams should treat schema validation as a baseline control and pair it with explicit authorization logic wherever tool output triggers a state-changing action, such as a database write, external API call, or financial transaction.
Schema validation is not authorization
A tool call can be structurally valid and still be an action the requesting user should not be permitted to perform. Treat these as two separate checks, not one.
Deployment and Runtime Auditability
Neither the AI SDK nor Next.js provides centralized audit logging of tool calls across a deployment. This is an application or platform-layer responsibility. In practice, this means a team can pass every item on a static code checklist and still lack visibility into which tool calls executed in production, with what arguments, on whose behalf, and with what outcome. OWASP's Top 10 for Large Language Model Applications identifies excessive agency, insecure output handling, and insufficient input validation as risk categories directly applicable to tool-calling architectures like this one. Static code review and schema validation address a portion of these risks. They do not address runtime enforcement: intercepting a tool call before execution, applying a least-privilege policy at that moment, and recording the decision for later audit. This is the point where code-level controls reach their limit and runtime governance tooling becomes necessary, particularly for regulated environments where tool-call history must be reconstructable after the fact.
Baseline Practices Before Production
- Treat every Server Action and Route Handler that an agent can trigger as a public endpoint requiring its own authentication check
- Scope each tool to the minimum data and system access its task requires, and document that scope explicitly per tool definition
- Separate structural validation (schema conformance) from authorization validation (permission to perform the action) as two distinct checks
- Assign distinct, narrowly scoped credentials per tool rather than a single shared service credential across all agent tool calls
- Sanitize and validate streamed tool-call arguments before they are rendered to users or passed into execution
- Establish a runtime logging mechanism for tool calls independent of the SDK, since none is provided by default