🔐 New: A CISO’s benchmark for authorization maturity ➔ [Download the ebook](https://solutions.cerbos.dev/authorization-maturity-model-a-cisos-benchmark)

# Authorize Vercel AI SDK tool calls with Cerbos

Enforce policy-driven authorization on AI tool invocations in Vercel AI SDK applications using Cerbos.

[Authorization for AI](/content/features-benefits-and-use-cases/ai-security/index.html)[Talk to an engineer](/content/workshop/index.html)[Agent skill for writing authZ policies](/content/blog/agent-skill-for-writing-authorization-policies/index.html)

### Tool authorization

Control which AI tools each user or role can invoke with fine-grained Cerbos policies

### Context-aware decisions

Authorize tool calls based on user identity, roles, attributes, and request context at runtime

### Audit every tool call

Every authorization decision is logged with full context, giving you a complete audit trail of AI tool usage

## How Cerbos works with Vercel AI SDK

AI agents and tools introduce a new class of authorization challenges. They act on behalf of users, access sensitive data, and chain operations, all of which need fine-grained access control.

Cerbos provides policy-driven authorization that controls what AI systems can do, which data they can access, and on whose behalf. Policies are written in human-readable YAML and evaluated at request time.

With Cerbos and Vercel AI SDK, you get guardrails that scale with your AI adoption, centrally managed policies, full audit trails, and sub-millisecond decision times that don't slow down agent workflows.

[Policy-as-codeHuman-readable YAML policies managed like source code](/content/features-benefits-and-use-cases/human-readable-authorization/index.html) [Scalable PDPStateless policy decision point with sub-millisecond latency](/content/features-benefits-and-use-cases/scalability/index.html) [Centralized managementManage, test, and deploy policies from a single control plane](/content/features-benefits-and-use-cases/centralized-management/index.html)

### How Cerbos authorizes Vercel AI SDK tool calls

1. **Define policies for tool access**, Write YAML policies that specify which tools each user or role can invoke based on identity, attributes, and context.
2. **Application requests authorization before each tool call**, Before the AI model invokes a tool, the application sends the user context, tool name, and target resource to the Cerbos PDP.
3. **Cerbos evaluates the request against policies**, The PDP applies fine-grained rules considering the user's identity, role, and any additional attributes you provide.
4. **Tool call proceeds or is blocked**, Cerbos returns an allow or deny decision. The application enforces it, with every decision logged for audit.

## FAQ

### How does Cerbos authorize Vercel AI SDK tool calls?

Before the AI model invokes a tool, the application sends the user context, tool name, and target resource to the Cerbos PDP. Cerbos evaluates fine-grained policies and returns an allow or deny decision.

### Can I restrict tool access per user or role?

Yes. Cerbos policies are attribute-based, so you can restrict tool access by role, subscription tier, organization, or any other context you provide. Policies are written in YAML and managed outside your application code.

### Does this work with streaming responses?

Yes. Authorization is evaluated before tool execution, so it works with both streaming and non-streaming Vercel AI SDK response patterns.

## Cerbos + Vercel AI SDK

- Cerbos policies govern AI agent tool access and data visibility
- Full audit trail for every AI tool call and data access
- Per-user permissions enforced across autonomous agent workflows
- Sub-millisecond policy evaluation with no agent pipeline overhead

[Book a free policy workshop](/content/workshop/index.html) [Try the Playground](/content/features-benefits-and-use-cases/cerbos-playground/index.html)
