Policies are an Enterprise-only feature. They are available on the AI Router only and cannot be used in combination with Agents.
How policies work
Policies sit at the top of the routing hierarchy:- When a policy with a model configured is matched, Routing Rules are bypassed.
- If the policy has no model configured, the router falls back to Routing Rules and applies the highest-priority matching rule.
- Any Guardrail Rules that match the request are still evaluated and enforced, regardless of which policy is active.
Visibility
- Global policies: visible to workspace administrators only.
- Project policies: visible to all members of the scoped project.
Creating a policy
From the Policies list, click Add New Policy. A panel opens on the right with the following fields.
General
| Field | Description |
|---|---|
| Policy Name | A display name for the policy. Used as the identifier when invoking the policy in code. |
| Description | Optional context for other administrators. |
| Enable Policy | Toggle to activate or deactivate the policy without deleting it. |
| Project | Scope of the policy. Global (all projects) applies the policy workspace-wide. Selecting a specific project restricts the policy to calls made within that project, and only entities belonging to that project are evaluated. |
Providers and traffic weight
Defines which models handle traffic and how requests are distributed across them. Models sets the distribution strategy:- Fallback: Requests go to the primary model. If it fails, the next model in the list is tried.
- Weighted: Traffic is split across models by percentage weights you assign.
- Round Robin: Requests rotate evenly across all configured models.
Guardrails
Attach one or more Guardrail Rules to gate requests through the policy. Click Add guardrail to select from the guardrail rules available in the scoped project. Guardrails are condition-triggered: they are only evaluated when a request matches the conditions defined in the guardrail rule.Budget
The Budget section contains three independently toggleable limits. Each has a configurable period: Hourly, Daily, Weekly, or Monthly.| Limit | Field | Description |
|---|---|---|
| Max spend | Amount in USD | Maximum dollar spend per period. |
| Token limit | Max tokens | Maximum number of tokens consumed per period. |
| Request limit | Max requests | Maximum number of API requests per period. |
Invoking a policy
Reference a policy in your API call usingpolicy/<policy-name> as the model value. The name must match the Policy Name you set when creating the policy.
mypolicy with the name of your policy.