Agentic Engineering: Policy-First LLM Routing Manual

Disclosure: This article may contain affiliate links. We may earn a commission at no extra cost to you.

7 min read

You move from “prompt-based trust” to provable, auditable enforcement where every LLM/tool action is policy-decided, traceable, and fail-closed for regulated data.

TL;DR

  • Decompose each use case into 8–12 word binary acceptance criteria and wire them into eval gates.
  • Put a deterministic pre-call policy gate in front of every LLM/provider call and every tool invocation—no exceptions.
  • Centralize policy-as-code but decentralize execution by risk tier so teams ship without creating audit gaps.
  • Fail-closed for regulated classes with ticketed break-glass (TTL ≤ 24h) to avoid “availability-driven” compliance violations.
  • Track 100% decision IDs + trace IDs, 0 cross-region violations, ≥ 99.5% classification coverage, and redaction recall ≥ 99% (release-blocking).
  • Asset included: Control Plane Readiness Checklist + Policy Gate Decision Matrix (routing, tools, residency, redaction, break-glass).

Core Model: The Deterministic AI Control Plane (Policy Gate + Identity + ACL-Aware RAG + Validator + Observability)

Treat the “core model” as replaceable. Treat the control plane as non-negotiable. Most enterprise AI incidents I’ve seen weren’t model failures—they were routing, identity, and logging failures that made the blast radius unknowable and the audit trail unusable.

What “Deterministic AI Control Plane” means (in practice)

  • Policy Gate (pre-call, deterministic): Evaluate every LLM/provider call and every tool invocation before execution. Enforce classification, residency, redaction, and tool entitlements outside the prompt.
  • Identity (user + workload): Bind every request to an authenticated user identity (OIDC/OAuth) and a workload identity (service-to-service). No anonymous agents.
  • ACL-aware RAG: Retrieve only what the caller is entitled to see. Apply document- and row-level ACLs at query time, not after the model answers.
  • Validator: Reject or quarantine outputs that fail grounding, safety, or formatting checks. Validators are rules and tests, not “please behave” prompt text.
  • Observability: Produce immutable decision logs and traces that let ops answer: who asked, what was accessed, what was sent, what was blocked, and why.

Reference flow (one concrete scenario)

A finance analyst asks an agent to “summarize Q2 margin drivers” and “open a Jira ticket for anomalies.”
– Policy gate classifies the request as Internal, routes to an approved region/provider, redacts account numbers, and checks entitlements for Jira create.
– ACL-aware RAG retrieves only the analyst’s permitted cost-center docs.
– Validator blocks the response if it cites sources the analyst couldn’t access or if the ticket payload contains restricted fields.

Operational thresholds (advisory defaults; calibrate to your environment)

  • Require 100% of LLM/tool invocations to carry a policy decision ID + trace ID (block if missing). This is the simplest “no shadow routing” control.
  • Set p95 policy evaluation latency ≤ 25 ms as a starting SLO (our operational heuristic; tune to your network and policy complexity).
  • Enforce fail-closed for regulated classes; allow break-glass TTL ≤ 24 hours (advisory default) with ticketed justification and review.

Actionable decision criterion: If you can’t prove—via logs—that every model/tool action was authorized before it ran, you don’t have a production platform. You have a demo that’s stuck in purgatory.

The deterministic control plane as five linked stages — Identity, Policy Gate, ACL-aware RAG, Validator, and Observability — each with the rule it enforces: deny unknown identities, evaluate every call at p95 under 25ms, zero cross-ACL retrieval, block ungrounded outputs, and 100% decision-ID coverage.
Figure 1: Core model — identity + deterministic policy gate + ACL-aware retrieval + validation + non-negotiable observability, enforced before execution, not in prompts.

Patterns vs Anti-Patterns: Policy-First Routing, Fail-Closed Defaults, and Tool Entitlements vs Prompt-Based “Controls”

The throughline: prompts are non-deterministic — they drift with model updates and fail under jailbreaks. A policy gate produces an auditable allow/deny decision independent of model behavior, makes tool misuse measurable, and keeps data inside your boundary before it leaves rather than scrubbing outputs after the fact. Govern break-glass the same way: time-bound exceptions with ticket, TTL, and auto-expiry, kept under an advisory default of <2% of requests and TTL ≤24 hours (starting heuristics; calibrate to your risk tier).

Five control-plane patterns paired against the prompt-era anti-pattern each replaces, with the metric to hold: policy-first routing vs prompt-based controls (auditable allow/deny); fail-closed defaults vs fail-open (hard stop); tool entitlements vs tool access via prompt (deny-by-default); single control plane vs shadow routing (100% decision IDs); pre-call redaction + residency vs post-hoc filtering (0 region violations).
Figure 2: What scales safely vs what creates untraceable risk — five patterns and the anti-pattern each one replaces.

Actionable decision criterion: if you cannot enforce 100% of LLM/tool invocations to carry a policy decision ID + trace ID (operational floor; tune latency budgets and rollout plan to your environment), you are not ready for agentic tools in production.

Implementation Playbook: Preconditions, Build Steps, Verification Gates, and Rollback Paths

Two preconditions block rollout if missing: a data taxonomy (Public/Internal/Restricted/Regulated) mapped to allowed regions and providers with unclassified treated as Regulated, plus identity (OIDC/OAuth users, workload identity for services, ABAC entitlements) and a tool inventory where unknown tools are deny-by-default — all of it standardized so every LLM and tool call carries a decision ID and trace ID. The build then runs in five steps, in order, because governance can’t be parallelized. Figure 3 maps both phases and the verification gate on each step.

A phase-banded rollout. Preconditions: data classes plus identity plus tool inventory, then standardized end-to-end telemetry. Build: decompose intent into binary acceptance criteria, implement a deterministic pre-call policy gate, unify tool entitlements. Harden: add ACL-aware RAG plus an output validator, operationalize policy-as-code. Each step lists its verification gate.
Figure 3: The phased rollout — Preconditions, Build, Harden — with a verification gate on every step.

Release-blocking gates

Three thresholds are bright-line release blockers unless explicitly waived: 0 cross-region or residency violations (hard stop), 100% decision-ID coverage on LLM and tool calls (no shadow routing), and break-glass TTL ≤ 24 hours with an attached ticket and post-incident review.

Rollback paths (plan before first pilot, not after first incident)

Three switches must exist at launch. Policy rollback: revert to the last known-good policy version and replay recent traces to confirm restored behavior. Safe degradation: for low-risk classes, route to an approved local model or disable tools; for regulated classes, fail closed. Break-glass: a time-bound override with automatic expiry, scoped entitlements, and a mandatory after-action review. AI doesn’t fail in production — it fails in planning, and rollback is part of planning.

Top-down decision flow for a deterministic pre-call policy gate: classify data, enforce residency, verify tool entitlements, apply redaction, and either allow execution, quarantine unknowns, or deny; failed redaction can route to a break-glass ticket with time-limited approval.
Figure 4: Deterministic gate logic at runtime: classify → residency → entitlements → redaction → allow/deny, with quarantine and ticketed break-glass.

Metrics & Instrumentation: SLOs, Thresholds, and Review Cadence

Treat metrics as enforcement, not reporting. If you can’t prove every routed decision and every exception, you don’t have governance — you have anecdotes. The thresholds below are advisory defaults; calibrate to your network, identity stack, and risk tier.

Core SLOs

Three control-plane SLOs carry the load (Figure 5). Alert on any 5-minute window below 100% decision-ID coverage — shadow routing is an incident, not a backlog item. Alert on p95 latency > 25ms for 15 minutes, or on p99 spikes correlated with auth, OPA, or cache misses. Alert when exception rate hits ≥2% for a rolling day, or any single team or product above 3%, which signals policy mismatch or missing entitlements.

Three control-plane SLO cards: decision-ID coverage at or above 100% of LLM and tool calls; policy-evaluation latency p95 at or below 25ms; exception rate at or below 2% of total requests.
Figure 5: The three control-plane SLOs and their alert directions — decision-ID coverage, policy-eval latency, and exception rate.

What the health thresholds actually mean

A missing decision ID means assume bypass. Block egress to provider endpoints except through the gateway, and investigate as a control failure rather than app behavior. A latency regression means assume teams will route around you — publish a latency budget by stage (auth, classification, residency, redaction, tool check) and enforce “no direct SDK calls” as a build-time rule, not a policy memo. Exceptions trending up means policy design debt — don’t normalize break-glass; redesign rules, entitlements, or data classification.

Review cadence

Reviews run on three rhythms. Daily (Ops standup): decision-ID coverage, p95 policy latency, exception rate, top deny reasons. Weekly (Platform + Security): exception root-cause review, new tool registrations, bypass attempts, and policy-change failure rate in CI. Monthly (CIO and Risk): exception burn-down plan, audit-evidence sampling against random traces, and a binary decision — tighten policy or fund performance and automation. There’s no third option.

Decision criterion: if you can’t sustain 100% decision-ID coverage and keep exceptions under 2%, pause new use cases. AI doesn’t fail in production — it fails in planning, and instrumentation is where that shows up first.

Pitfalls & Edge Cases: Shadow Routing, Tool-Side Exfiltration, Misclassification Quarantine, and Fine-Tune Drift

Four failure modes recur once agentic tools have real reach: shadow routing, tool-side exfiltration, misclassification quarantine, and fine-tune drift. Figure 6 gives each one its detection signal and mitigation. Two are worth stating plainly: your LLM-security program is irrelevant if tools are unmanaged (tool-side exfiltration leaks before the model is even called), and classification coverage dropping below 99.5% is the early signal that “for availability” routing has started creating silent audit gaps. The throughline: fix upstream schemas and entitlements, not downstream prompts — every prompt-level “fix” for a control problem is debt that compounds.

Four pitfall field cards, each with Pitfall, Detection, and Mitigation: Shadow Routing, Tool-Side Exfiltration, Misclassification Quarantine, and Fine-Tune Drift.
Figure 6: The four pitfalls as field cards — each with its detection signal and mitigation.

Asset: Control Plane Readiness Checklist + Policy Gate Decision Matrix

Control Plane Readiness Checklist (copy/paste)

Definition: Control plane = identity + policy-as-code + routing + observability that governs every LLM and tool action.

Control plane readiness checklist grouped into five sections — Call Paths + Routing, Deterministic Pre-Call Policy, Data Taxonomy + Identity, Tool Permissions, and Evidence + Retention — each item a checkbox with its target: no shadow routing, 100% decision-ID coverage, fail-closed on unclassified, deny-by-default identity/tools, step-up with TTL ≤ 24h, and ≥ 90-day log retention.
Figure 7: The readiness checklist as a production gate — five control groups, each item with its target threshold.

  • [ ] Inventory call paths. Enumerate every LLM/provider SDK, proxy, and tool connector (incl. MCP, outbound HTTP).
    Gate: Block production if any path can bypass the gateway (shadow routing).

  • [ ] Enforce deterministic pre-call policy. Evaluate classification → residency → redaction → provider/model → tool entitlement before execution.
    Gate: Require 100% of LLM/tool invocations to carry a policy decision ID + trace ID (operational floor we use; calibrate to your tracing stack).

  • [ ] Define data taxonomy + mapping. Public/Internal/Restricted/Regulated mapped to allowed regions/providers.
    Gate: Treat “unclassified” as blocked/quarantined until classified (advisory default; tune by risk appetite).

  • [ ] Wire identity end-to-end. OIDC/OAuth for users; workload identity for services; ABAC attributes for entitlements.
    Gate: Deny-by-default for unknown identities and unknown tools.

  • [ ] Make tool permissions first-class. Entitle by (identity × agent × tool × action × data scope).
    Gate: High-blast-radius tools (ticketing, code exec, outbound HTTP) require step-up (HITL or break-glass).

  • [ ] Operationalize evidence. Immutable decision logs, versioned policies, and replayable traces.
    Gate: Retain logs ≥ 90 days (advisory default; align to your regulatory retention).

Policy Gate Decision Matrix (allow/deny/escalate)

Policy gate decision matrix mapping data class and tool risk to a policy action and the evidence each path must produce: Public and Internal at low risk ALLOW; Restricted at medium risk ALLOW with validator; Regulated PII/PHI and any high-risk tool ESCALATE to HITL or break-glass; and any unknown-region request DENY fail-closed with a deny reason and rule ID.
Figure 8: The Policy Gate Decision Matrix — allow, escalate, or deny by data class and tool risk, with the evidence each path must produce.

Takeaway decision criterion: If you can’t prove “no shadow routing” (decision IDs on every call) and deny-by-default tool execution, you’re not “AI-ready”—you’re one incident away from a platform ban.