Most AI agents do not fail because the model is not smart enough. They fail because production automation exposes every weak boundary: broad permissions, ambiguous prompts, retry storms, missing validation, and workflows that keep running after the answer has already gone wrong. The bill grows while the business damage grows with it.

Below are 11 mistakes I look for before releasing an agent into production. Each one maps to three costs: wasted API credits, business risk, and lost user trust.
Mistake 1: Broad API Keys and Over-Permissive Tools
A support agent that only needs to read orders should not also issue refunds, change email addresses, or write to the billing system. If it can, a confused model can perform destructive actions and then spend more tokens trying to repair the result.
Prevention: use scoped credentials per environment and agent role. Split read tools from write tools. A refund tool should require a separate token with a hard amount limit, and secrets should never live in the system prompt.
Cost map: extra recovery calls consume API credits; unauthorized actions create business risk; customers lose trust when data or money changes unexpectedly.
Mistake 2: No Bound on Tool Calls or Loops
Agents often loop when a tool returns empty data, an error, or a slightly different result than the model expected. Search → read → search → summarize → search again can continue until the context window or budget is exhausted.
Prevention: enforce a max_tool_calls per run, for example 8 for support triage and 20 for research. Add loop detection for repeated tool names plus near-identical arguments. Stop the run after two duplicate calls and return a structured fallback.
Cost map: repeated model and tool calls burn credits; stale actions create operational risk; users notice slow, repetitive, or incoherent behavior.
Mistake 3: Vague Prompts That Encourage Exploration
“Help the customer with their issue” is not a production instruction. It invites broad searches, unnecessary follow-up questions, and creative use of tools. The agent may browse the knowledge base, inspect unrelated accounts, and generate several drafts before answering.
Prevention: define task, tools, refusal path, required inputs, and output contract. For example: “Use get_order only after order ID is present. If missing, ask once. Do not call refund tools. Return JSON with answer, sources, and next_action.”
Cost map: wandering prompts increase token use; off-policy actions create compliance exposure; users trust concise, grounded answers more than generic essays.
Mistake 4: Skipping Human Approval for High-Impact Actions
Refunds, account changes, contract terms, outbound emails, and publishing actions should not cross a threshold without review. Fully autonomous chains are tempting, but one bad inference can trigger many downstream calls and real-world consequences.
Prevention: add a human approval threshold. Example rules: refund over $50, changing account ownership, sending legal language, or any confidence score below 0.85 enters a review queue.
Useful queue fields include run_id, user_id, proposed_action, tool_payload, reason, evidence_snippets, risk_score, expires_at, and idempotency_key.
Cost map: review adds a small credit cost but prevents expensive autonomous chains; it reduces irreversible business risk; visible oversight preserves trust.
Mistake 5: Missing Idempotency Keys in Write Workflows
Retries are normal. Without idempotency, a timeout can cause duplicate refunds, duplicate tickets, or repeated customer emails.
A repeat refund workflow should move through a state machine such as created → validated → approval_requested → approved → payment_submitted → payment_confirmed → notified, with explicit failed and rejected states. Never allow a timed-out payment_submitted step to call the payment provider again without checking provider state first.
Prevention: generate an idempotency key from stable fields, such as:
refund:{tenant_id}:{order_id}:{refund_reason_hash}:{amount_cents}
Store the key and state transition in a transactional database. The write endpoint must reject duplicate keys instead of creating a second action.
Cost map: duplicate writes trigger follow-up support and reconciliation calls; duplicated money movement is direct business risk; customers rarely forgive repeated refunds or charges.
Mistake 6: No Per-Run Token Budget
A single user session should not be allowed to consume an unlimited budget. Long attachments, oversized tool outputs, and repeated refinement can quietly turn one support ticket into an expensive run.
Prevention: set budgets by task. A practical allocation might be:
- System and policy prompt: 10%
- Retrieved context: 35%
- Tool results: 25%
- Reasoning and planning: 15%
- Final response: 15%
If a task has a 12,000-token run cap, retrieval cannot dump 25,000 tokens into context. Truncate, summarize, or page the data.
Cost map: hard caps control credits; budget pressure prevents sloppy data access; users receive faster answers instead of delayed over-processing.
Mistake 7: Retrying Every Failure Automatically
Blind retries amplify outages. A 400 validation error will not become a success on the fifth attempt. A 429 rate limit needs backoff, not ten parallel agents hammering the same endpoint.
Prevention: separate retryable from non-retryable failures. Retry 429 and selected 5xx errors with exponential backoff and jitter. Fail fast on 400, 401, 403, and schema violations. Return structured errors such as:
{"error_type":"VALIDATION_ERROR","retryable":false,"field":"order_id","message":"Order ID must be 8–20 characters","recovery_action":"ask_user"}
Cost map: fewer wasted retries saves credits; controlled failure handling reduces downstream load; users get useful next steps instead of silent failures.
Mistake 8: Stuffing Entire Databases or Logs Into Context
It is common to see an agent fetch all open tickets, all customer notes, or a full debug log because retrieval was not selective. The model then pays attention to weak signals and costs more to reason over irrelevant text.
Prevention: require filters before tool execution: customer ID, date range, status, document type, and maximum row count. Return compact records first; fetch full detail only when needed.
Cost map: smaller contexts save credits; least-data access lowers privacy risk; focused evidence produces more accurate user responses.
Mistake 9: No Output Validation or Schema Enforcement
An agent can produce a polished answer that is structurally unusable. Downstream systems may expect {"action":"refund","amount":49.99,"currency":"USD"}, but the model returns prose, an invalid status, a negative amount, or a date the billing API cannot parse. The orchestrator then sends the output back for repair, sometimes several times.
Prevention: validate model output before execution. Use a typed schema for every machine-facing action:
actionmust be from an allowed enum.amountmust be a positive number within the tool limit.currencymust match the customer’s billing region.order_idmust match the retrieved order.- Required fields must be present; unknown fields should be rejected, not silently ignored.
Run schema validation locally before making paid model correction calls. If validation fails, return the exact field-level error once and allow one repair attempt, not an open-ended revision loop.
Cost map: validation blocks repair loops that waste credits; malformed writes cannot reach production systems; users avoid broken confirmations and inconsistent follow-up messages.
Mistake 10: Treating the Scheduler Like a Trigger Happy Button
Duplicate scheduled jobs are a silent credit burner. A workflow can run from a cron schedule, a deployment replay, a webhook, and a manual backfill at the same time. Each run retrieves context, calls the model, and possibly sends messages.
Prevention: make scheduled jobs idempotent and claim work before processing. Use a lease table or queue with job_name, due_date, owner_run_id, lease_expires_at, and status. Disable schedules during tests. Prevent overlapping runs with a distributed lock and set a maximum concurrency value.
Cost map: one job per intended period controls credits; duplicate customer contacts and updates are avoided; users do not receive multiple bot replies.
Mistake 11: No Evaluation, Regression Tests, or Safe Fallback
Teams change prompts, models, tools, and retrieval rules, then assume the agent still works. Small changes can cause tool-selection regressions, longer prompts, higher refusal rates, or invalid outputs. Without tests, the problem appears in production token bills and support tickets.
Prevention: keep a golden set of representative conversations and edge cases. Score tool choice, schema validity, refusal behavior, retrieval relevance, and average tokens per successful task. Run the suite in CI before prompt or model changes are promoted.
Also define a fallback path: use deterministic rules, a canned help response, or a human handoff when the model is unavailable, the budget is exhausted, or confidence is low. Cache stable policy chunks, embedding results, and common tool responses with explicit TTLs and invalidation rules.
Cost map: tests and caching reduce repeated credit waste; fallbacks contain operational risk; users still get a dependable response when the agent cannot complete the task.
Production Readiness Checklist
- Permission matrix: define allowed tools by role, environment, read/write intent, and amount limit.
- Maximum tool calls: enforce per-run limits and duplicate-call detection.
- Per-run token cap: allocate budget across prompt, retrieval, tools, reasoning, and final output.
- Idempotency key: require stable keys for refunds, emails, tickets, publishing, and other writes.
- Human approval threshold: route high-value, low-confidence, legal, billing, or account-changing actions to review.
- Kill switch: disable one tool, one agent, or all autonomous writes without deploying code.
- Alert threshold: alert on token spend, tool error rate, retry count, duplicate keys, review backlog, and failed schema rate.
- Output schema: validate structure, enums, identifiers, amounts, and cross-field consistency before execution.
- Scheduler lock: claim jobs, enforce leases, prevent overlap, and disable test schedules by default.
- Fallback and cache policy: define handoff behavior, TTLs, cache invalidation, and stale-data rules.

Quick Diagnostic Table
- Broad keys: unauthorized writes → scoped tokens and permission matrix → denied tool calls and write volume.
- Infinite loops: repeated tool calls → max calls and loop detection → duplicate tool-call ratio.
- Vague prompts: long, wandering answers → explicit tool and output rules → tokens per resolved task.
- No human review: risky autonomous actions → approval threshold and review queue → high-risk action rate.
- Missing idempotency: duplicate refunds or messages → stable keys and state machine → duplicate key/action count.
- No token cap: runaway sessions → per-run budget and context limits → token spend percentile.
- Blind retries: retry storms → retry policy and structured errors → retries per run.
- Context stuffing: oversized tool payloads → filters, pagination, summaries → context tokens per call.
- No schema validation: malformed actions → typed schema and one repair attempt → validation failure rate.
- Duplicate schedules: repeated batch messages → locks, leases, job claims → scheduled runs per period.
- No evals or fallback: prompt regressions and outages → golden tests, caching, handoff → regression pass rate and fallback usage.
The goal is not to make the agent less autonomous. The goal is to make autonomy measurable, reversible, and bounded. When permissions, budgets, schemas, schedules, and approvals are explicit, API credits go toward useful work instead of funding avoidable production chaos.