Building a demo AI agent takes an afternoon. You wire up an LLM, give it a tool or two, and it does something impressive. Then you try to run it in production, and everything gets harder.

Production agents need to handle failures, control costs, manage credentials securely, and run reliably at scale. The gap between “works on my laptop” and “runs for real users” is mostly infrastructure. Here’s a checklist for closing that gap.

1. LLM Provider

Pick a provider and model that fits your agent’s workload.

  • Latency requirements. If your agent serves real-time user requests, you need fast inference. If it runs background tasks, you can use slower, cheaper models.
  • Context window size. Agents that process tool outputs need room in the context. A research agent that calls five tools might use 20K+ tokens of context before generating its response.
  • Cost per token. At scale, token costs add up fast. A task that costs $0.05 in tokens seems cheap until you’re running 10,000 tasks per day.
  • Reliability. Provider outages take your agent down. Consider having a fallback model from a different provider.

Most production agents use a mix: a fast, cheap model for simple routing decisions, and a more capable model for complex reasoning.

2. Tool Access

Your agent needs tools. The question is how to connect them.

Option A: Direct integrations. Your agent calls APIs directly. You manage authentication, handle each API’s quirks, and maintain the integration code. This works for a small number of stable APIs.

Option B: Tool platform. A service like AgentPatch gives your agent access to many tools through a single API. One authentication flow, one response format, one billing system. This reduces integration work but adds a dependency.

Option C: MCP servers. You connect to MCP-compatible tool servers. This gives you a standard protocol, but you still need to find, host, and manage the servers.

For most production agents, a combination works best: a platform for common tools (search, email, data lookups) and direct integrations for specialized internal APIs.

3. Error Handling and Retries

Tool calls fail. Your agent needs a strategy for each failure type.

  • Transient errors (500, timeout). Retry with exponential backoff. Two or three retries with increasing delays handles most transient issues.
  • Rate limits (429). Respect the Retry-After header. If your agent is hitting rate limits often, you’re either calling too frequently or need a higher-tier plan.
  • Bad input (400). Don’t retry the same bad request. Log the error, and if your agent can self-correct (read the error message, fix the input), let it try once with corrected parameters.
  • Authentication errors (401/403). Don’t retry. Alert the operator. Something is misconfigured.

Every retry costs tokens (the LLM has to process the error and decide what to do) and time. Set a maximum retry count and a total timeout per task.

4. Cost Monitoring and Controls

Production agents spend real money on two fronts: LLM tokens and tool calls.

  • Set per-task budgets. Limit how much any single task can spend. A runaway agent loop that keeps calling tools will drain your balance fast.
  • Track spending by task type. Know which tasks cost the most and why. Often a few task types account for most of your spend.
  • Set daily and monthly caps. Hard limits prevent surprises. Alert well before hitting them.
  • Monitor credit balances. If you’re using a credits-based tool platform, set up alerts for low balance. An agent with no credits just stops working.

A research task that makes 5 web searches, 2 news lookups, and 1 image generation costs roughly $0.15 in tool calls on most platforms. Add $0.05 to $0.50 in LLM tokens depending on the model. At 1,000 tasks per day, that’s $200 to $650 per day. Know your numbers.

5. Rate Limiting

Protect yourself and the services you depend on.

  • Outbound rate limiting. Limit how many tool calls your agent makes per minute, per hour, and per day. This prevents runaway loops and keeps you within provider limits.
  • Per-user rate limiting. If your agent serves multiple users, limit each user’s usage. One abusive user shouldn’t exhaust your tool budget for everyone.
  • Concurrent task limits. Running too many agent tasks in parallel can overwhelm your infrastructure and downstream APIs. Set a concurrency cap.

6. Logging and Observability

You can’t debug what you can’t see.

  • Log every tool call. Record the tool name, input parameters (sanitized), response status, latency, and cost. This is your audit trail.
  • Log LLM interactions. Record prompts and completions (or at least their token counts and latency). This helps you optimize prompts and identify regressions.
  • Structured logging. Use JSON logs with consistent fields. You’ll be searching and filtering these at scale.
  • Dashboards. Track success rates, p50/p99 latency, and cost per task in real time.

7. Security

Agents with tool access can read data, send messages, and call paid APIs. Security is not optional.

  • API key management. Never embed keys in prompts or code. Use environment variables or a secrets manager. Rotate keys regularly.
  • Principle of least privilege. Give the agent access only to the tools it needs. If it doesn’t need email access, don’t connect email.
  • Sandboxing. If your agent can execute code, run it in a sandboxed environment with no network access to internal systems.
  • Human-in-the-loop for sensitive actions. Require approval before sending emails, making purchases, or modifying data. This is especially important for early deployments.

8. Testing

  • Unit tests for tool integrations. Mock tool responses and verify your agent handles them correctly, including errors.
  • End-to-end tests. Run full agent tasks against real (or staging) tool endpoints. Verify the agent produces correct results.
  • Regression tests. When you change prompts, models, or tool configurations, run your test suite. Small changes to prompts can cause large changes in agent behavior.
  • Cost tests. Run a sample workload and verify the cost matches your estimates. Cost surprises in production are painful.

The Checklist

Before going to production, verify each item:

  • LLM provider selected with fallback plan
  • Tool access configured (platform, direct, or MCP)
  • Error handling with retries and fallbacks implemented
  • Per-task, daily, and monthly cost limits set
  • Rate limiting on outbound calls and per-user usage
  • Structured logging for tool calls and LLM interactions
  • API keys in secrets manager, not in code or prompts
  • Sandboxing for code execution tools
  • Human approval for sensitive actions
  • End-to-end and regression test suite passing
  • Cost estimates validated against real workload

None of this is specific to any particular framework or model. Whether you’re building with Claude, GPT, Gemini, or an open-source model, the infrastructure requirements are the same. Get the checklist right, and your agent will run reliably at scale.