Skip to main content
Copy and adapt these patterns for your own Devctrl policies. Each example includes the scenario, the CEL expression, and what it allows and blocks.
Tool names are namespaced as serverName__toolName (e.g., github__list_issues) to avoid collisions between MCP servers. The examples below use short names for readability — replace them with your actual namespaced tool names.

Restrict tools by team

Only the engineering team can use deployment tools.
This rule alone is restrictive — it only allows engineering agents. Combine it with other rules for a complete policy. For example, add a separate allow rule for support tools.

Allow specific tools per task

Different tasks get access to different tools.

Scope data to current task context

The agent can only access the customer referenced in the current task.
This is the core of TBAC — access scoped to exactly what the task needs.

Block dangerous operations

Prevent destructive operations regardless of who’s calling.
Deny rules take priority over allow rules. A request blocked by a deny rule stays blocked, even if an allow rule would permit it.

Combine identity and task checks

Support agents can only use support tools, and only for their assigned customer.
This single expression enforces three things:
  1. Only support team agents
  2. Only approved support tools
  3. Only the customer in the current task

Read-only access for analysts

Data analysts can query but never modify.
Any tool that starts with get_, list_, or query_ is allowed. Tools like create_, update_, delete_ are blocked.

Multi-agent collaboration

Different agents in the same project get different access levels. Policy 1 — Deny rule (block billing for non-finance):
Policy 2 — Allow rule (allow everything else for authenticated agents):

Environment-based restrictions

Only allow production tools for production-labeled agents.
This lets staging agents use staging tools freely, but requires a production label to touch production resources.

Next steps

CEL reference

Full syntax reference for CEL expressions.

RBAC vs TBAC

Understand why task-based access control matters for AI agents.