How to Take AI Agents From Demo to Production

11 min read Agents Engineering

A production-readiness model for AI agents covering state, retries, permissions, verification, observability, and recovery.

During a demo, the builder controls almost everything that matters. The request is complete, credentials work, external services respond, and someone is watching closely enough to intervene when the agent hesitates. Under those conditions, a successful run can feel like evidence that the system is ready.

Production removes that protection one detail at a time. A customer omits an account number, the CRM takes twelve seconds to answer, and the connection disappears just after the agent submits an update. The system now has to determine whether the update happened, whether a retry is safe, and who should resolve the uncertainty if the answer remains unclear.

The model may be behaving exactly as it did in the demo. The surrounding environment has changed, which exposes decisions the demonstration never had to make. Real inputs arrive incomplete, state survives longer than one session, dependencies fail in ambiguous ways, and unattended problems continue until an operator can see them.

Taking an AI agent to production therefore means designing the software and operating process around the model. The agent needs a clear contract, durable progress, controlled side effects, enforced permissions, representative evaluation, useful logs, and a recovery path for work that ends halfway through.

Begin with the contract everyone can inspect

A prompt guides the model’s behavior, while a production contract defines the boundaries of the entire run. Writing that contract forces the team to settle questions that otherwise appear for the first time during an incident.

Contract field Question it answers
Outcome Which observable state should the run create?
Scope Which cases may the agent handle?
Inputs Which fields and sources are required?
Actions Which tools and side effects are allowed?
State What survives a retry, crash, or later turn?
Limits How many attempts, calls, tokens, minutes, or euros may it consume?
Verification Which checks must pass before the result counts?
Escalation Who decides when the agent cannot continue?
Recovery How is partial work resumed, reversed, or closed?
Owner Which person remains accountable for the outcome?

A description such as “the support agent handles tickets” leaves most of those questions unanswered. A production contract could narrow the work to drafting replies for product questions tied to an identified account, using current documentation, and routing policy exceptions to the support owner. Sending remains outside the agent’s authority, and every review request carries the relevant ticket history.

That narrower scope gives engineering, operations, and support the same behavior to evaluate. It also provides a stable reference when a future tool, model, or policy change affects the workflow.

Treat incoming work as production input

People rarely phrase requests in the exact shape a system expects. They omit identifiers, attach the wrong file, refer to an old account name, or ask for an action that belongs to another process. Passing those gaps directly to a model encourages it to fill them with plausible guesses.

Validation should happen before the agent begins its work. Required records need to exist and belong to the expected workspace, while dates, currencies, file types, and enumerated values need normalization. Attachments should stay within known size and content limits, and missing facts should create a specific request for clarification.

Scope deserves the same treatment as format. A contract-review agent may receive a perfectly clear request to approve a payment, yet the action still falls outside its job. Recording that outcome as unsupported gives the operator a useful next step, while a policy prohibition should produce a rejection tied to the relevant rule.

Accepted work, missing information, unsupported requests, and prohibited actions each lead somewhere different. Keeping those states separate makes retries quieter and helps support teams diagnose whether the input, permissions, or service needs attention.

Persist progress before the next call can repeat it

A transcript can appear to hold all necessary state while a demo fits on one screen. Longer runs reveal how difficult transcripts are to query and how little they say about which external actions actually completed.

Production state should be recorded at meaningful boundaries. The validated request, contract version, current workflow step, authoritative tool results, created artifacts, received approvals, remaining work, consumed budget, and reason for pausing all need durable homes. Together, those records let a later attempt continue from evidence rather than from a model’s recollection of a long conversation.

The checkpoint should contain enough information to resume safely, especially after a consequential action. Copying every generated token adds storage and noise while leaving the important question unanswered: what changed in the outside world?

Configuration also needs a version so that, when instructions, policies, models, or tools change, an operator can identify which combination governed an older run. That history explains behavioral differences that timestamps alone cannot.

Design every side effect for an ambiguous timeout

External systems eventually produce a failure that arrives at the worst possible moment. The agent submits a message, task, payment request, or record update, and the connection disappears before the provider confirms the result. The caller sees a timeout even though the action may already exist.

A safe retry begins by reconciling provider state. Each intended effect needs a stable identity so the system can look for the earlier result and determine whether another attempt would create a duplicate. Draft creation, task creation, messages, and record updates can all follow this pattern when their providers expose enough information.

Consequential actions also benefit from a separate planning step. The agent prepares the exact proposed action, validation checks its parameters and current permission, and the orchestration layer executes the approved effect under its stable identity. This gives the system a clear record of what was intended and what the provider accepted.

Retries then become a way to recover from uncertainty. They no longer depend on the assumption that a missing response means a missing side effect.

Let each failure lead to the right exit

Transient faults, invalid requests, policy refusals, and ambiguous side effects ask for different responses. A single retry loop treats distinct problems as though time alone will solve them.

Failure Example Useful response
Transient dependency Rate limit or short network timeout Retry with backoff and a fixed cap
Permanent dependency Revoked credential or missing account Stop and route a clear recovery action
Invalid input Missing customer or malformed date Ask for correction outside the retry budget
Policy refusal Agent lacks permission to send Record the refusal and request an authorized decision when appropriate
Verification failure Draft lacks required evidence Return bounded feedback, then escalate
Ambiguous side effect Provider timed out after submission Reconcile provider state before retrying
Model failure Invalid structured output Retry within a small bound, then stop
Resource exhaustion Budget or execution time reached Pause or fail at the configured limit

Backoff can give a struggling dependency time to recover, while revoked credentials require an owner who can restore access. Missing input should return to the requester, and a verification failure should move through a limited rework cycle before it reaches a reviewer.

Every branch needs a maximum and a named final state. “Waiting for corrected input” tells an operator what can move the run forward. “Failed after provider reconciliation” preserves a different kind of evidence. Clear exits prevent a stalled loop from disguising itself as active work.

Enforce authority at the action boundary

Prompts can describe policy, but code and access controls determine which actions are possible. Least-privilege credentials, narrow tools, and fresh authorization checks keep the agent’s effective authority aligned with the production contract.

Read access should remain separate from mutation access, and preparing a draft should remain separate from sending it. Permission needs another check when the action occurs because the user, target, or surrounding state may have changed since the agent made its plan.

A high-consequence action needs an approval tied to the exact parameters a reviewer saw. The approval should record who granted it, expire when it becomes stale, and require a final check that the target still matches. Material changes to the proposal create a new decision because the earlier approval describes a different action.

A permission refusal is a meaningful workflow result. It should preserve the attempted action and route it to the authorized owner, giving the team visibility into where the production boundary was reached.

Measure the resources around the model

Tokens are only one part of production cost. An agent can occupy browser sessions, database connections, worker capacity, provider quotas, and reviewer attention, so each resource needs a limit where it is consumed.

A run may have a model budget, a maximum number of tool calls, deadlines for individual requests, a provider-aware concurrency cap, and a bound on verifier-driven rework. Human attention needs similar care because repeated observations of one unresolved decision should update the existing request, allowing the owner to resolve it once.

These limits should stop work predictably and leave the reason visible. When measurement shows that a healthy run regularly reaches an artificial boundary, the team can adjust it with evidence. Raising a limit merely to let a stuck run continue usually delays the underlying repair.

Evaluate the decisions the workflow depends on

Fluent output reveals little about whether an agent chose the correct policy, called the right tool, or recognized when to ask for help. Production evaluation needs to reflect those decisions.

A representative set should include ordinary requests, incomplete cases that require clarification, prohibited cases that require refusal, high-consequence cases that require escalation, and earlier failures that should never recur. The expected result describes an action or acceptable outcome, which makes the evaluation useful even when several different drafts would all be valid.

For a support agent, the important checks may include selecting the current policy, citing relevant evidence, preserving the sending boundary, and routing the intended exceptions. Changes to instructions, tools, models, or knowledge should run through that set before release.

Production review continues to add cases that offline evaluation could not predict. New request shapes, dependency behavior, and operator corrections become evidence for improving the set, which allows the evaluation to follow the real workflow over time.

Give operators a record they can act on

When a run fails, the operator needs a concise path through what happened. Useful records include the run and owner identifiers, contract and configuration versions, step transitions, authorized tool targets, outcomes, retry counts, budget use, verifier results, human decisions, and final error class.

Sensitive input and output should remain under the same authorization and retention rules as the source work. Operational logs can reference protected artifacts and record the action metadata required for diagnosis, avoiding a second uncontrolled copy of private content.

The workflow also needs to record evidence rather than hidden model reasoning. The selected action, its parameters, the relevant sources, the result, and a concise rationale give reviewers something connected to the real side effect.

Alerts become useful when they correspond to a response. A service-wide rise in errors may call for an operator, while one run waiting for a policy decision needs a decision request with the ticket, evidence, choices, and next step. Each path should place the work with someone able to resolve it.

Rehearse recovery before launch

Production readiness includes the hours after a partial run. For every consequential step, the team should know whether recovery means resuming, retrying, compensating, restoring, or closing the work.

A simple drill can interrupt the workflow after each major boundary and confirm that it resumes without duplicating actions. Revoking a credential should create the expected recovery request. Repeated verifier failures should stop at their limit, and an ambiguous provider timeout should trigger reconciliation before another submission.

Partial artifacts and completed effects remain attached to the run throughout that process. Distinguishing a timeout after submission from a failure before submission gives the operator a much safer starting point.

Before real work arrives, review the complete path from validated input through recovery. Confirm that state can resume, permissions hold at the action boundary, resource limits are active, evaluation covers consequential cases, verifiers judge the artifact, logs preserve useful evidence, and every escalation reaches an owner with enough context to decide.

Giving the production loop a durable home

Task Machine organizes production agent work around durable Tasks and explicit workflows. Connected workers execute the work, while Tasks preserve the outcome, history, artifacts, questions, and review decisions that allow a run to continue across more than one model call.

Workflow steps can include bounded retries, human questions, approval gates, verifier results, and recorded outcomes. Decisions return to the Inbox with their context, detailed steering stays on the Task, and higher-level direction begins in Chat. Each kind of attention therefore has a stable place in the operating loop.

The structure still depends on thoughtful workflow design, representative evaluation, and an available connected environment. Its value comes from making state, limits, verification, escalation, and recovery visible before an agent begins handling production work.

Apply this model to one agent you intend to deploy. The first unanswered question in its contract is the next production task, because resolving it deliberately will always be cheaper than discovering the answer during a customer-facing failure.

Put the work you just read about on rails

Join the waitlist and we will send early access when the first private beta spots open.

Private beta. We invite teams in batches and never share your email.