Governance

Securing AI Agents in Production

There is a pattern to how AI agent deployments fail in production. Teams ship the agent with a guardrail layer, a structured logging pipeline, and an evaluation suite that passed before release. The first quarter goes smoothly. Then, somewhere between month four and month nine, an irreversible action reaches an external system that should have refused it. A payment. A configuration change. A data export. A customer message that should not have gone out. The post-incident review concludes that the controls were present but did not fire at the point the decision mattered.

Key concepts

The reason is structural. "Guardrails plus logging" is a detection posture, not a prevention posture. For irreversible actions, detection is not a control - it is a notification after the fact. Securing AI agents in production means putting a deterministic decision in front of every action that touches an external system, and making that decision structurally binding on execution. This post is the production readiness checklist that falls out of that principle, and the failure modes each control closes.

If you are looking for the conceptual foundation, start with runtime authorization for AI agents. This post is the operational view.

What "production" actually means for AI agents

A common source of confusion is that the agent was "in production" from day one because it was serving real users. That is a deployment statement, not a security statement. Production in the control sense means every code path that can commit an irreversible side effect is explicitly authorized, auditable, and fail-closed. Most AI agent deployments shipped before they reached that bar. The security work is catching up.

An agent is production-ready, in the control sense, when all of the following are true:

If any of those is missing, you still have a prototype in production clothing. That does not mean you should pull the plug; it means you know the order of work.

The checklist

1. Every external action is explicitly authorized

The first bit is the hardest to get right retroactively. The default posture of most agent frameworks is that the tool set is a registry and any registered tool can be called. That is fail-open by construction. The fix is to put an authorization gate between the tool-call intent and the tool dispatch. Every intent is submitted. The gate decides. The SDK only dispatches on PERMIT.

Failure mode this closes. The model emits a valid tool call that was not on anyone's threat model. A content guardrail finds nothing wrong with the string. The tool adapter dispatches it. The action commits. With the gate in place, the action does not dispatch unless a policy explicitly permitted it.

2. The decision is deterministic

Non-deterministic authorization (LLM-as-judge, heuristics, probabilistic scoring) is not authorization. It is recommendation. Real authorization is a pure function of structured inputs and a versioned policy. Same inputs, same policy, same outcome, every time. This property is what makes the decision defensible in audit and reproducible during incident review.

Failure mode this closes. The control passes on Tuesday and fails on Wednesday with the same inputs. Nobody can tell why. The auditor asks which rule fired. The answer is "the model decided" and the conversation ends poorly. With determinism, you can replay the request against the archived policy version and show exactly why the outcome was what it was. See deterministic authorization for the full contract.

3. Policies are versioned and archived

Policies change. Ruleset updates happen multiple times per week in active deployments. For the decision to be replayable, the policy version active at request time must be archived alongside the receipt. Mutating policy in place without versioning is the most common reason teams who "have an authorization layer" still fail audits.

Failure mode this closes. Someone edits a rule in March. An incident rooted in a February decision is reviewed in April. Nobody can prove what the policy said in February. With versioned archives, the decision is reconstructible to the byte.

4. Receipts are signed and retained

Enforcement and evidence are different properties. A decision that blocked an action is useful in the moment. A decision with a signed receipt bound to its policy version is useful three years later during a regulatory review. Receipts are how runtime authorization becomes auditable infrastructure rather than live control only.

Failure mode this closes. The application log rotated out after 30 days. The incident is discovered at day 45. There is no defensible record of what actually happened. Signed receipts survive log rotation, survive application rewrites, and can be checked by parties who do not trust your operational logs. See verify for the receipt verification model.

5. Fail-closed defaults, including for unknown surfaces

The worst bugs are the ones that default to execution. A policy engine that cannot reach its rule bundle, a gate that times out, a surface that was not in the registry when the rule was written - all of these must default to SILENCE, not to PERMIT. The posture is "if I do not know the answer, the answer is no." That is the definition of fail-closed AI systems.

Failure mode this closes. A policy repository is briefly unreachable. The gate returns an error. The SDK falls back to "allow on error." A window of fail-open behavior opens for an unknown number of actions. With strict fail-closed, the agent is temporarily limited to no-dispatch. That is almost always the preferable failure mode.

6. Timeouts behave like denials

A gate that does not answer within its budget should be treated as if it denied the call. Timeout-as-permit is a category of defect, not a tradeoff. If the budget is too tight, raise the budget. If the gate is the bottleneck, scale the gate. Do not buy latency by weakening the control.

Failure mode this closes. The gate is slow for a second. The SDK's fallback path dispatches anyway. An action that should not have happened, did. With timeout-as-deny, the action is refused. The fix is to make the gate faster, not to make the refusal softer.

7. Idempotency keys are structural

Agent planners can, and do, emit duplicate tool calls under retry, re-plan, or concurrent execution. A payment sent twice is not half as bad as a payment sent; it is twice as bad plus a reconciliation problem. Idempotency keys, enforced at the gate layer, are the only reliable deduplication boundary. The gate remembers recent decisions keyed by idempotency key and returns the same outcome for replays within the window.

Failure mode this closes. An agent retries a transfer after an ambiguous timeout. Two transfers commit. The first one already succeeded; the network just failed to return the success. With structural idempotency, the second attempt returns the first decision without re-executing.

8. Break-glass is explicit, signed, and rare

Every production system needs an operator override. The question is whether that override is a button or an undocumented path. A proper break-glass flow is a named operator identity, an explicit policy that grants override authority under narrow conditions, a receipt type that marks the call as override, and a monitoring signal that fires every time it is used. The override is a documented capability, not a hole in the control.

Failure mode this closes. An engineer deploys a "temporary bypass" to ship a fix during an incident. The bypass stays. Six months later, the bypass is the vulnerability. With a proper break-glass path, the override is auditable, time-bounded, and visible to everyone on the rota.

9. The verification surface is independent

The party that verifies receipts should not be the party that issues them. That is not a paranoia principle; it is a standard cryptographic hygiene point. The verifier needs the public key, the signature scheme, and the receipt. The verifier does not need application logs, does not need the policy bundle, and does not need to trust the agent runtime. That separation is what lets second-line risk, internal audit, and external parties check decisions without privileged access.

Failure mode this closes. "The logs say it was allowed" is a circular argument when the entity that allowed it is the same entity that wrote the logs. With an independent verifier, an external party can check the signature on the receipt and confirm the decision without trusting any of the producing components.

10. Observability separates policy from infrastructure

A dashboard that shows total gate calls is not observability; it is volume. Useful observability separates three questions: is the gate healthy, is policy evaluating correctly, and is the outcome distribution shifting in ways that indicate a behavioral change. Alerts on "gate unavailable" and "sudden increase in DENY or SILENCE rates for a given surface" are the two that pay for themselves.

Failure mode this closes. A policy regression lands on Tuesday. The denial rate for a surface jumps from 2% to 40%. Users see errors. Nobody notices until Friday. With outcome-shape monitoring, the rollback conversation happens within an hour.

A small operational pattern that avoids most of the pitfalls

Teams that have landed this usually converge on the same daily shape. Policies live in a git repository. Pull requests change them. Merges build a versioned bundle and publish it to a bundle store. Gates pull the bundle by version. Every decision the gate issues stamps the bundle version into the receipt. Every receipt is signed and appended to an immutable log. A separate verification service validates receipts on demand. Nobody edits policies on running gates.

That pattern is boring by design. Boring is what production security looks like. You will not see a conference talk about "we changed nothing for three quarters and no agent ever committed an unauthorized action," but that is the success state.

Frequently asked questions

How much work is this for a team already running agents with only guardrails?

The most expensive part is the request-shape contract. Once you have committed to a structured { actor, surface, action, target, context } request, the rest is mechanical. A first cut typically takes a small platform team one to three weeks to ship for a single surface. Scaling to additional surfaces is additive and does not require re-architecting.

Do we need to pause agent shipping while this lands?

No. The gate can run in shadow mode first: every tool call is also submitted to the gate, the decision is logged, but the gate does not yet block. This gives you weeks of real-traffic data to tune policies before you flip the gate into enforcement. Most rollouts run shadow for two to four weeks per surface.

Will this slow our agents down?

Per-call latency is low single-digit milliseconds for in-process or sidecar gates, typically tens of milliseconds for remote gates. Agents that are already making external calls at hundreds of milliseconds do not notice. See ai-execution-governance for the latency budget analysis.

Next step

If your agents are in production today and you want to know where to start, runtime authorization for AI agents is the overview and pre-execution authorization is the specific discipline this checklist implements. For the deployment shapes and a reference architecture, see architecture.

Next step

Map the controls your AI agents actually need on the actuation path before scaling up traffic.

Request a demo Review architecture Read protocol Documentation