Skip to main content
Policies are governance rules made up of a rules object plus optional conditions that scope when the policy applies. Policies are evaluated against every LLM request that flows through the MeshAI proxy, and post-hoc as evidence against OTLP-ingested agent activity that never touches the proxy.

Policy Types

Enforcement Model

Policy types are not all enforced the same way. Be precise about what each one actually does today: The kill switch (agent block/unblock) is a separate, always-inline 403 mechanism that sits outside the policy engine - see Agent Kill Switch. For agent activity ingested via OTLP (never routed through the proxy), MeshAI evaluates enabled policies post-hoc against each span and records the result to the Eval Log as evidence. This is observe-only: it populates the audit/evidence trail for OTel-native tenants but cannot block or require approval for an action that has already happened.

Conditions

Every policy accepts an optional conditions object that scopes when it applies. Conditions are evaluated with AND semantics - every key present must match. If a key is omitted (or null), that dimension imposes no constraint. If conditions is omitted entirely, the policy applies to all agents, teams, and environments.
An unclassified agent (no risk classification on record) never matches a risk_levels-scoped policy, even if the list is broad. Classify an agent first if you need risk-scoped policies to apply to it.

Create a Policy

rules is a required, non-empty object whose shape depends on policy_type (see the examples below). priority is an integer from 1 to 1000 (default 100) - lower numbers are evaluated first, and the first matching policy that fails stops evaluation.

Policy Examples

Block a Provider

Require Approval (HITL)

Budget Limit

budget_limit policies are recorded by the policy engine as evidence, but the actual spend cap is enforced separately at the proxy key / team level (see Usage Limits).

Rate Limit

Require Human Review

List Policies

Update a Policy

Delete a Policy

What Happens When a Policy Is Violated

When a proxy request violates an inline-enforced policy (model_allowlist, block_provider, require_approval), the agent receives a 403:
require_approval violations receive a distinct body - see HITL Approvals. Each policy create, update, and delete emits an audit event (policy.created, policy.updated, policy.deleted). There is no policy.violated audit event today - a rejected request is reflected in the proxy’s 403 response and, where applicable, in GET /policy-evaluations, not as a separate audit-trail entry.