A demo agent that answers questions is easy. A production agent that reads email, calls APIs, writes records, and asks for refunds is a different system. It can loop through tools, repeat writes, act on prompt injection, and quietly burn API credits. Below are 11 failures I check for before an agent touches production, each with the bad pattern, consequence, fix, and acceptance test.

1. Starting with overbroad permissions
Wrong: the agent receives one admin API key for CRM, billing, email, and docs.
Consequence: one mistaken plan can delete records, export customer data, or send emails from a trusted identity.
Fix: issue scoped credentials per tool; use read-only keys for research; separate dev, staging, and prod; deny by default; grant permissions by task.
Acceptance: red-team every tool with an out-of-scope request. The agent must refuse or route to a human; audit logs show actor, scope, and resource.

2. No hard task boundary
Wrong: the system prompt says “help the customer with anything.”
Consequence: the agent improvises, uses unrelated tools, and creates support cases users never asked for.
Fix: define allowed intents, forbidden intents, inputs required, and exit conditions. For example, “classify support email, draft reply, create ticket only after user confirmation.”
Acceptance: 100% of out-of-scope eval cases end in clarification or handoff; no tool call occurs without a matched intent.
3. Treating generated text like verified data
Wrong: the agent fills order IDs, emails, prices, or account status from memory.
Consequence: hallucinated identifiers cause wrong refunds, duplicate accounts, and embarrassing customer messages.
Fix: require tool evidence for every external fact. Store source tool, timestamp, record ID, and confidence. If evidence is missing, ask or escalate.
Acceptance: sampled production runs show zero customer-facing facts without a source; field-level validation rejects malformed IDs before writes.
4. No human review for sensitive actions
Wrong: the agent can email customers, issue refunds, change subscriptions, or modify pipelines automatically.
Consequence: one bad inference becomes a customer-facing incident, not a draft.
Fix: use an approval matrix.
| Action | Policy | Reviewer |
|---|---|---|
| Read public docs | Auto-approve | None |
| Create internal draft | Auto-approve | None |
| Create CRM ticket | Approve if confidence ≥ 0.9 | Queue owner if lower |
| Send external email | Human approval | Account owner |
| Refund or delete data | Human approval + second check | Support lead |
Acceptance: sensitive actions have approval records; direct execution without approval fails in staging.
5. Missing budget and loop controls
Wrong: the agent retries indefinitely and chains searches, summaries, and subagents.
Consequence: a confusing request can consume hundreds of tool calls and inflate the monthly API bill.
Fix: set per-run limits before launch. Practical starting thresholds: max 50k input tokens and 8k output tokens per run; max 12 tool calls; max 2 retries; 30 seconds per tool call; 5 minutes total runtime. Alert at 70% of daily budget, then pause non-critical agents at 100%.
Acceptance: forced-loop tests stop at the limit, produce a handoff, and emit a budget_exceeded event. Daily cost variance over 20% triggers an alert.
6. Logging prompts without logging decisions
Wrong: teams save chat messages but not tool inputs, outputs, approvals, retries, or trace IDs.
Consequence: when a customer says “why did it cancel my order?” nobody can reconstruct the chain.
Fix: emit one trace per run with spans for model calls, tools, validators, approvals, and writes. A useful log event:
{"trace_id":"tr_8f21","run_id":"run_1042","agent":"support_agent_v3","intent":"refund_request","tool":"billing.refund","idempotency_key":"ord_55143_refund_v1","input_hash":"sha256:...","status":"awaiting_approval","attempt":1,"tokens_in":18204,"tokens_out":612,"cost_usd":0.041,"latency_ms":842}
Acceptance: given a customer complaint, engineering can reconstruct the full run in under 10 minutes without opening production databases manually.
7. Ignoring stale tool output
Wrong: the agent reads inventory, waits through a long draft, then writes an order using old data.
Consequence: it promises unavailable stock, uses expired prices, or acts on revoked permissions.
Fix: attach timestamps and TTLs to tool output. Re-read before writes when data is older than 60 seconds for operational state or 5 minutes for billing state.
Acceptance: stale-data tests force a refresh; writes using expired observations are blocked.
8. Field mapping errors between models and APIs
Wrong: the model produces free-form JSON and the integration passes it directly to the API.
Consequence: customer_email becomes emailAddress, cents become dollars, or a comment lands in the priority field.
Fix: validate against a strict schema, use explicit mapping, normalize enums, and test malformed payloads. Never ask the model to invent fields.
Acceptance: contract tests cover required fields, nulls, enum values, currency units, and extra unknown fields; invalid payloads never reach the external API.
9. Assuming webhooks mean success
Wrong: after a write, the agent waits for a webhook but has no dead-letter queue or reconciliation job.
Consequence: a webhook silently fails; the agent tells the user the task is complete while the downstream system never updated.
Fix: require synchronous confirmation where possible, record delivery status, retry with backoff, dead-letter failed events, and reconcile pending writes every 15 minutes.
Acceptance: kill the webhook receiver in staging. The run is marked unknown, not success, and an alert fires within 5 minutes.
10. Allowing duplicate writes and non-idempotent actions
Wrong: timeout handling simply “tries again,” so the agent calls the refund, ticket, email, or provisioning endpoint twice.
Consequence: customers receive duplicate emails, tickets are created twice, inventory is decremented twice, or refunds are submitted more than once. This is often worse than the original failure because cleanup touches financial and CRM systems.
Fix: every mutating tool must require an idempotency key derived from the business action, not the retry attempt—for example, ord_55143:refund:v1 or ticket:acct_9021:billing_issue:2026-05-04. Persist the key before the call, send it in the API header or body, and make the server return the original result for repeated keys. Add a uniqueness constraint for natural keys such as external order ID plus action type. Retries should reuse the same trace and key; a new user intent gets a new key.
Acceptance: in staging, force timeout, duplicate click, and double-webhook tests. The downstream system shows exactly one write, the agent links both attempts to the same idempotency_key, and replay returns the original record instead of creating another one.
11. Failing to isolate untrusted input from high-privilege tools
Wrong: the agent treats text from external email, web pages, Slack comments, PDFs, or customer forms as instructions.
Consequence: prompt injection can tell the agent to “forward previous messages,” “approve the refund,” or “read this page and call its webhook.”
Fix: separate instructions from data. Wrap external content in labeled untrusted blocks, preserve source and sender metadata, strip active instructions during parsing, and allow only tool calls on an explicit allowlist. Sensitive actions need contextual confirmation that shows the source and proposed action. High-risk tools should not be reachable from browsing or email-reading paths.
Acceptance: injection tests using hidden webpage text, email forwarding tricks, and PDF directives never trigger writes; all blocked attempts log untrusted_instruction_detected; approvals display the true requesting user and data source.
Pre-launch checklist
| Category | Check | Suggested threshold / field |
|---|---|---|
| Permissions | Least-privilege keys, environment separation, tool allowlist | 0 admin keys in agent runtime; deny by default |
| Task boundary | Allowed intents, forbidden intents, required slots | 100% of out-of-scope evals hand off |
| Budget | Per-run token, tool, retry, timeout, and daily spend caps | 50k tokens/run, 12 tool calls, 2 retries, 30s/tool, 5m total; alert at 70% daily budget |
| Observability | Trace ID, spans, tool inputs/outputs, cost, latency, status | Trace lookup under 10 minutes; 100% writes linked to trace |
| Approval | Risk-based matrix and reviewer identity | 100% external sends/refunds/deletes approved |
| Rollback | Compensating actions, backups, feature flag, kill switch | Rollback or disable under 5 minutes |
| Evaluation | Golden tasks, injection suite, stale-data and duplicate-write tests | Mission success ≥ 95%; unsafe-action rate 0; human takeover tracked |
| Canary | Start with internal users, then low-risk traffic | 1% → 5% → 25%; hold if error rate over 2% or support escalations rise |
Measure both credits and trust
Cost controls should appear on a dashboard: cost per successful run, daily API spend, token overrun rate, retry rate, and budget-alert count. Trust needs operational metrics too: unauthorized-action rate, duplicate-write rate, human takeover rate, rollback time, approval rejection rate, support escalations caused by the agent, and a simple post-resolution rating.
Start the agent where mistakes are cheap: drafts, summaries, classifications, and internal research. Let it earn write access through evals, canary traffic, and clean traces. Production AI agents do not fail because models are imperfect; they fail when teams give an uncertain reasoning system unrestricted tools, no evidence rules, and no way to stop the damage.