- POLICY
- FILTER
- ACCESS
- HUMAN
Short answer
How can my AI generate query plans using Cerbos?
Your agent uses the plan_resources tool to translate Cerbos policies into Abstract Syntax Tree (AST) query plans. This allows the agent to apply authorization logic directly to database queries, ensuring it only retrieves permitted records. You get a filtered view of your data that respects your current security rules.
The outcomes
Where your data logic lands
The AI uses your policies to shape how it interacts with your data.
POLICY
Policy translation
The agent reads your Cerbos policies and converts them into structured AST plans. This ensures the AI understands exactly what data is off-limits.
FILTER
Query generation
The AI generates specific filters based on those plans. This prevents the agent from even requesting unauthorized rows from your database.
ACCESS
Secure retrieval
Your agent executes queries that are pre-filtered by the authorization logic. You get the results you need without risking data leaks.
HUMAN
Policy oversight
You maintain full control over the Cerbos policies themselves. The AI can only follow the rules you have already defined and deployed.
The workflow
What your AI does when the request arrives.
The agent bridges the gap between security rules and database execution.
Analyze policies
The agent looks at your Cerbos authorization rules to understand the constraints for a specific resource or user.
plan_resourcesBuild the AST
The agent converts those rules into an Abstract Syntax Tree that a database can interpret as a filter.
plan_resourcesApply filters
The agent uses the generated plan to restrict the scope of its data requests.
plan_resourcesVerify constraints
The agent confirms the query plan aligns with the requested resource permissions before execution.
plan_resources
Try it
Copy these to start.
Use these prompts to trigger the planning process.
Starting points
Swap out the bracketed text for your specific resource names or user IDs.
Cerbos Connector
You're all set. Choose your MCP client and follow the setup instructions.
https://edge.vinkius.com/vk_preview_y0c5dNo7ENj8oh5gsdkYK0hZAMSRgY44sro1JyED/mcpClaude Desktop
Follow the steps below to connect in seconds.
- 1In Claude Desktop, open Settings → Connectors.
- 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
- 3Click Add and start a new chat — Cerbos capabilities are ready to use.
{
"mcpServers": {
"cerbos-mcp": {
"url": "https://edge.vinkius.com/vk_preview_y0c5dNo7ENj8oh5gsdkYK0hZAMSRgY44sro1JyED/mcp"
}
}
}Generate a query plan for the 'orders' resource based on my current Cerbos policies.
Create an AST filter for user 'user_123' so I can see only their permitted records.
Show me the query plan that would be used to filter 'customer_data' for an admin role.
Plan a resource query for 'inventory_items' that respects my existing authorization logic.
Claude
ChatGPT
Cursor
VS Code
Windsurf
Claude Code
JetBrains
Cline
Start here
Connect Cerbos once, then ask.
Link your Cerbos instance to Vinkius with one click. Your credentials stay encrypted, and you can immediately start asking your agent to plan secure queries.
Connect Cerbos to your AIFAQ
How this task behaves
- 01
Does the AI change my Cerbos policies?
No. The AI only reads your policies to generate query plans. It cannot modify, delete, or create new authorization rules in Cerbos.
- 02
Can the AI bypass my security rules?
No. The AI uses the plan_resources tool to ensure its queries are strictly limited by the policies you have already set.
- 03
What is an AST-based query plan?
It is a structured representation of a query that uses your authorization logic to filter database results at the source.
- 04
Do I need to manually write SQL filters?
No. The agent handles the translation from Cerbos policies to the query plan automatically.
- 05
Can the AI access data that isn't in my database?
No. The AI only generates plans for the resources and data defined within your connected environment.
More questions about Cerbos? See everything the Cerbos Connector can do
Connect Cerbos to Claude, Cursor, ChatGPT & more
