
Production failure controls
- Use timeouts on every external call.
- Retry only known transient failures.
- Use exponential backoff and jitter where appropriate.
- Require idempotency keys for retryable side effects.
- Detect duplicate tool calls, repeated arguments, no-state-change loops, and cyclic handoffs.
- Use circuit breakers for failing providers and tools.
- Define degraded modes that reduce capability without increasing authority.
- Preserve checkpoints before high-impact operations.
- Use compensating actions when true rollback is impossible.
- Route unrecoverable work to a manual queue with complete evidence.
- Preserve a dead-letter record for failed asynchronous tasks.
- Provide an agent-level and tool-level kill switch.
- Test dependency outages, partial failures, cancellation, approval timeout, and resume behavior.
For code execution, file manipulation, browser automation, or package installation, use an isolated execution boundary. Keep the trusted harness, credentials, billing controls, audit records, and recovery state outside the sandbox. Mount only the files and data the task requires, restrict network egress, and inspect generated artifacts before promotion.
Identity Must Explain Who Is Acting
These are not secondary concerns to add after the prompt is tuned. They are the system around the model.
Tool access is where an agent moves from generating language to changing the environment.
- Requester identity: The person, application, scheduled event, or upstream service that initiated the work.
- Agent workload identity: The non-human identity used by the runtime to authenticate to approved services.
- Delegated resource identity: The user-scoped or application-scoped authority presented to a downstream tool or data source.
The response should depend on the failure class.
A production agent commonly operates with at least three identities:
Production identity controls
- Require authenticated requester context for user-driven workflows.
- Give each production agent or agent class a managed workload identity.
- Use short-lived tokens or runtime-injected credentials instead of static secrets in prompts or configuration files.
- Scope tokens to the intended resource, audience, tenant, environment, and operation.
- Preserve downstream authorization. An agent must not bypass the permissions the resource would enforce for a normal application.
- Separate read, write, privileged, and administrative scopes.
- Record the requester, agent identity, tool identity, granted scopes, policy decision, and outcome in the audit trail.
- Build onboarding, access review, credential rotation, revocation, offboarding, and emergency disablement into the lifecycle.
- Prohibit production use of developer identities and personal access tokens.
The practical path is to narrow the workflow, define the production contract, instrument the complete run, build the regression suite, test failure and shutdown, launch with limited authority, and expand only when the evidence justifies it.
State Must Be Designed, Not Accumulated
Agent cost is a workflow property, not a single model-call property.
Prompt instructions are not security controls.
- conversation history
- workflow position
- completed and pending steps
- tool results
- retrieved evidence
- approval requests and decisions
- temporary artifacts
- durable memory
- retry counters
- budget consumption
- prompt, model, tool, and policy versions
What can go wrong is equally important. A threshold can be too strict and block legitimate work. A budget can interrupt a valid investigation. A retry limit can be unsafe for one tool and too conservative for another. A broad approval rule can overwhelm reviewers until they approve mechanically.
Separate the state types
| State type | Purpose | Production control |
|---|---|---|
| Conversation state | Maintains user interaction continuity | Compact history, tenant isolation, retention, deletion, and content filtering |
| Workflow state | Tracks current step and completed work | Typed schema, atomic updates, checkpoints, concurrency control, and resume semantics |
| Durable memory | Reuses approved facts or lessons | Provenance, confidence, owner, review date, expiration, and poisoning controls |
| Evidence state | Preserves sources and tool results | Immutable references, access control, integrity checks, and retention policy |
| Approval state | Records pending and completed decisions | Approver identity, evidence shown, decision, timestamp, scope, and expiration |
| Artifact state | Stores generated files or changes | Sandbox isolation, malware scanning, content review, promotion path, and cleanup |
A production approval record should contain:
Automate only the actions that have strong evaluation evidence, low consequence, narrow scope, and reliable recovery. Keep high-impact paths approval-gated until the organization has enough production evidence to justify a different decision.
An agent crosses several operating domains, so ownership must be distributed without becoming ambiguous.
OWASP’s agentic security work highlights risks such as goal hijacking, tool misuse, identity and privilege abuse, memory poisoning, insecure communication, cascading failures, trust exploitation, and rogue behavior. The practical implication is that security cannot be confined to an input filter.
Trace evaluations should inspect the path, not only the answer. A final response may look correct even when the agent called the wrong system, retried unnecessarily, crossed an authorization boundary, or consumed an unreasonable amount of context.
- Read: Retrieve approved information without changing a system.
- Propose: Produce a draft, plan, query, configuration, or recommendation for review.
- Change: Modify a record or system in a bounded and reversible way.
- High impact: Trigger financial, customer-facing, privileged, destructive, external, or difficult-to-reverse effects.
A production agent should be treated as a governed workflow, not as a model endpoint with extra features.
Also plan for capacity. Enforce per-tenant concurrency, queue limits, rate limits, and backpressure so one runaway workflow cannot exhaust model quotas, tool APIs, databases, or operator review capacity.
A prototype proves possibility. Production readiness proves controlled repeatability.
A practical classification is:
Evaluations Must Measure the Workflow
Increase traffic, tenants, workflows, tools, and authority separately. A safe agent for one business process is not automatically approved for another. Each expansion changes the data, identity, tool, failure, cost, and ownership model.
Enable a small amount of production traffic with every state-changing action behind approval. Define rollback triggers before launch, including policy violation, wrong-tool selection, security event, latency regression, cost regression, duplicate side effect, or operator overload.
Build a layered evaluation system
Model routing, prompt-prefix caching, application caching, context compaction, retrieval filtering, output contracts, duplicate-call detection, and stopping rules should be part of the runtime, not optional developer habits.
A checklist becomes valuable when the pipeline can evaluate it.
Production gate: The team has executed failure-injection tests and demonstrated bounded retries, no duplicated side effects, safe containment, operator alerting, and successful recovery or manual handoff.
The practical shift is from a prompt-and-model prototype to a governed execution system. Treat identity, state, tools, policy, observability, evaluation, recovery, and ownership as separate control planes. Put measurable release gates around each one. Start with a narrow workflow, run it in shadow or read-only mode, canary the first production traffic, and expand authority only after the evidence shows that the system is reliable enough to deserve it.
Prototype state often begins as a transcript. Production state is broader and more dangerous.
Example release thresholds
The operational handoff should include architecture, inventory, release history, evaluation results, dashboards, runbooks, escalation contacts, known limitations, exception records, recovery procedures, and shutdown instructions.
| Evaluation dimension | Example release gate |
|---|---|
| Task success | Meets the agreed success rate on a representative holdout set |
| Critical policy violations | Zero in the critical security and authorization suite |
| High-impact wrong-tool calls | Zero before production authority is enabled |
| Evidence quality | Required sources or records are present and relevant |
| Approval compliance | Every approval-required action pauses before execution |
| Recovery | Injected transient failures recover without duplicated side effects |
| Latency | Meets the service objective at median and high percentiles |
| Cost | Stays within the per-successful-task budget distribution |
| Regression | No protected capability drops below its release threshold |
Most AI agent prototypes are optimized to answer one question:
A run can fail because the model returned an invalid structure, retrieval was stale, state was corrupted, the tool timed out, an approval expired, a dependency was unavailable, the budget was exhausted, or the policy engine blocked the requested action.
Observability Must Reconstruct Every Run
Production gate: A reviewer can trace any tool call from the business request to the requester, agent workload, authorization decision, downstream resource, and final outcome.
Do not grant full production authority on the first release.
Trace the control path
Production evaluations need to score the complete workflow.
- model calls
- retrieval and reranking
- memory reads and writes
- tool selection and execution
- policy and guardrail decisions
- approval requests and responses
- handoffs to specialist agents
- retries and fallbacks
- artifact creation
- final validation
TL;DR
Expose results to a small internal user group while keeping tools read-only or recommend-only. Measure user corrections, evidence quality, time saved, escalation, and trust. Validate that identity and data filters hold under real user diversity.
- end-to-end latency
- model and tool latency
- input, cached, reasoning, and output usage when available
- model calls per run
- tool calls and retries per run
- approval wait time
- denial and guardrail rates
- task success and human override rates
- cost per successful task
- state-resume failures
- circuit-breaker activation
The release question should never be, “Does the demo still work?”
Adversarial evaluations should include direct and indirect prompt injection, tool poisoning, malicious retrieved content, memory poisoning, conflicting instructions, secret-exfiltration attempts, privilege escalation, denial-of-wallet patterns, and cascading tool failures.
Policy values need evaluation, operational feedback, and periodic review. The purpose is not to freeze the system. It is to make changes explicit, testable, reviewable, and reversible.
Security Must Be Enforced at Runtime
The diagram below shows the boundary to preserve. The model can recommend the next action, but trusted infrastructure must own identity, authorization, state, policy, approvals, telemetry, recovery, and release control.
A disciplined rollout expands both traffic and authority in stages.
- user input
- retrieved documents and web content
- memory
- model output
- tool metadata
- tool arguments and results
- inter-agent messages
- sandbox execution
- network egress
- state stores
- logs and traces
- operator and administrative interfaces
The model is only one component. Production trust comes from the controls around it: identity that explains who is acting, state that can be resumed safely, tools with bounded authority, evaluations that measure the workflow, observability that reconstructs every run, security that is enforced at runtime, budgets that stop runaway execution, approvals that preserve decision rights, recovery that prevents repeated damage, and ownership that survives the original builder.
Required runtime controls
- Treat external content as data, not as policy or authority.
- Keep system policy outside retrieved documents and tool results.
- Apply authorization before retrieval and before tool execution.
- Validate tool inputs and outputs against schemas and business rules.
- Restrict network egress to approved destinations.
- Scan prompts, state, files, repositories, logs, and artifacts for secrets.
- Redact or tokenize sensitive fields before model and telemetry paths where appropriate.
- Encrypt state, evidence, credentials, and telemetry in transit and at rest.
- Verify dependencies, tool publishers, packages, and runtime images.
- Separate development, test, and production identities, data, tools, and state.
- Rate-limit expensive or privileged capabilities.
- Preserve immutable audit events for sensitive decisions and actions.
- Test the shutdown path and credential revocation path.
Identity is the first production gate because every later control depends on it.
Treating all of that as one growing prompt is expensive, difficult to secure, and almost impossible to recover reliably.
Cost Controls Must Exist Before Scale
Agent failures are not all model failures.
An agent may need to preserve:
version: 1
agent:
name: incident-triage-agent
owner: ai-platform-operations
business_owner: infrastructure-operations
risk_tier: medium
production_authority: recommend_only
identity:
requester_context_required: true
workload_identity: managed
short_lived_credentials: true
allowed_environments:
– production
prohibited_credentials:
– shared_api_key
– developer_identity
state:
authoritative_store: workflow-state-service
schema_version: 3
checkpoint_before_side_effect: true
resume_requires_version_compatibility: true
conversation_retention_days: 30
approval_retention_days: 365
durable_memory_requires_owner: true
durable_memory_requires_expiration: true
tools:
– name: search_monitoring_events
mode: read
approval: none
timeout_seconds: 10
max_retries: 1
– name: draft_incident_update
mode: propose
approval: none
timeout_seconds: 15
max_retries: 1
– name: execute_remediation
mode: change
approval: required
idempotency_key_required: true
timeout_seconds: 60
max_retries: 0
evaluations:
release_dataset: incident-triage-regression-v7
minimum_task_success: 0.95
maximum_critical_policy_violations: 0
maximum_wrong_high_impact_tool_calls: 0
require_failure_injection_suite: true
require_trace_grading: true
observability:
trace_complete_run: true
record_model_and_tool_versions: true
record_policy_and_approval_events: true
capture_prompt_content: false
capture_tool_content: false
audit_high_impact_actions: true
cost:
max_model_calls: 5
max_tool_calls: 6
max_retries_total: 2
max_elapsed_seconds: 120
max_parallel_branches: 2
enforce_cost_per_successful_task_budget: true
failure_handling:
circuit_breaker_enabled: true
duplicate_tool_call_detection: true
no_state_change_limit: 2
manual_queue_on_unrecoverable_failure: true
agent_kill_switch: true
tool_kill_switch: true
release:
require_security_approval: true
require_service_owner_approval: true
require_canary: true
canary_traffic_percent: 5
rollback_on_policy_violation: true
rollback_on_cost_regression_percent: 20
evidence_retention_days: 365
A production threat model should cover the complete agent path:
A production agent must also answer harder questions. Which identity is calling the tool? Can it access only the records that the requester is authorized to see? What happens when the workflow pauses for approval? Can the same run resume without duplicating a side effect? Can an operator reconstruct the model calls, retrieval events, policy decisions, tool calls, retries, and final outcome? Is there a budget for the complete run? Who receives the alert at 2:00 a.m.? Who has the authority to disable the agent?
Production gate: Approval-required actions cannot execute through an alternate tool path, retry path, handoff, or resumed session without a valid approval record.
The most dangerous production path is not a failed prototype. It is a successful prototype that quietly becomes a business dependency before these controls exist.
Approvals Must Be Part of the State Machine
Approval should depend on consequence, reversibility, authority, confidence, and policy.
Taking an AI agent from prototype to production is not mainly a prompt-engineering exercise. It is a systems-engineering and operating-model exercise.
| Action class | Default handling |
|---|---|
| Read approved data | Automatic when identity and policy checks pass |
| Draft or recommend | Automatic, clearly labeled as proposed output |
| Reversible bounded change | Automatic only when policy and evaluation evidence support it; otherwise approval |
| Customer-facing or external communication | Approval or constrained template policy |
| Financial, privileged, destructive, or difficult-to-reverse action | Mandatory approval, often with stronger separation of duties |
| Change outside the original request scope | Reject or require a new authorization decision |
Production gate: The architecture has a documented trust-boundary diagram, abuse-case suite, residual-risk owner, incident path, and evidence that runtime controls block prohibited actions even when the model requests them.
- requested action
- target resource
- requester and agent identity
- arguments or proposed change
- supporting evidence
- policy reason for approval
- estimated impact and cost
- approver identity and authority
- decision and timestamp
- expiration
- final execution result
The first production incident will expose unclear ownership faster than any architecture review.
A model benchmark does not tell you whether the agent selected the right tool, honored an approval boundary, recovered from a timeout, stayed within budget, or completed the business task.
Failure Handling Must Preserve Safety and Intent
The more authority a tool has, the less discretion the model should have around execution.
One user request may include instructions, history, retrieved context, tool schemas, tool results, retries, validation calls, reasoning, output generation, and specialist-agent handoffs. A cheap call can become an expensive run.
Production gate: The team can pause a run, inspect its authoritative state, resume it exactly once, and prove that no duplicate side effect occurred.

