Skip to main content
connic
Back to BlogTutorial

AI Agents: From Prototype to Production

A demo works great until 1,000 concurrent users arrive. A practical guide to the production requirements most teams find out about too late.

January 10, 202610 min readAuthor: Simon Dabrowski

The AI agent demo impressed everyone in the stakeholder meeting. The CEO is excited. The product manager is already writing the press release. That polished Jupyter notebook isn't going to survive first contact with real users.

The gap between "it works on my machine" and "it works for 10,000 users at 3am on a Saturday" is where most AI agent projects go to die. This guide is about crossing that gap without turning production into a permanent debugging exercise.

The Prototype-to-Production Gap

An AI agent prototype usually has these constraints:

  • Single-threaded execution (one request at a time)
  • No error handling (if it fails, restart the notebook)
  • API keys hardcoded in cells
  • No logging (print statements don't count)
  • Unlimited timeouts (the notebook just sits there)
  • No cost tracking (surprise $500 OpenAI bills)

Move an agent to production

Deployment, scaling, observability, and connectors are handled, so a prototype becomes a product without the rebuild.

The Production Checklist

These requirements need attention before an agent faces real users. Missing any of them means debugging in production.

1. Isolated Execution Environments

Each agent run must be fully isolated. Runs share neither state nor global variables, so one request cannot depend on context left by another.

Prototype
Global state persists between requests. User A's data leaks into User B's response.
Production
Each run gets a fresh container. No state carries over, and isolation is guaranteed.

2. Retry Logic with Exponential Backoff

LLM APIs fail, rate limits hit, networks blip. An agent needs to handle that gracefully.

agents/resilient-agent.yaml
version: "1.0"
name: resilient-agent
description: "A resilient assistant with retry handling"
model: connic/gpt-5.6-terra
system_prompt: |
  You are a helpful assistant.
retry_options:
  attempts: 3      # Total attempts, including the first (1-10)
  initial_delay: 10
  max_delay: 30    # Max seconds between retries

With sane retry configuration, transient failures become non-events instead of pager alerts.

3. Timeout Handling

When an agent takes too long in a prototype, the operator waits. Production needs defined behavior.

  • โ€ขRequest timeout: Maximum time for the entire run (prevents runaway costs)
  • โ€ขTool timeout: Maximum time for individual tool calls
  • โ€ขGraceful degradation: Return partial results rather than nothing

4. Concurrency Control

Without concurrency control, 100 users hitting an agent simultaneously cause these problems:

  • โ†’Rate limits hit immediately
  • โ†’Memory exhaustion
  • โ†’Unpredictable response times
  • โ†’Cost spikes

Production systems need per-agent concurrency limits, request queuing, and fair scheduling.

5. Observability (The Non-Negotiable)

Without visibility into an agent's behavior, debugging failures is guesswork. Failures are inevitable in production.

Production observability means:

  • โ€ขRun history: Every execution logged with status, duration, and trigger source
  • โ€ขExecution traces: Step-by-step breakdown of LLM calls, tool invocations, reasoning
  • โ€ขToken tracking: Input and output tokens per run, per LLM call
  • โ€ขError categorization: Is it a tool failure? Rate limit? Timeout? Bad input?

Integration Patterns for Scale

How agents are triggered matters as much as how they are built. The patterns below hold up at scale.

Async-First Architecture

The tempting move is to build synchronous APIs: user sends request, waits for response. That works until:

  • โ†’Agent processing takes 30 seconds and the load balancer times out
  • โ†’Users refresh and create duplicate requests
  • โ†’Web servers are blocked waiting on LLM responses

The solution is accept โ†’ queue โ†’ process โ†’ callback.

Async Flow
1. User submits request
   โ†’ API returns immediately with request_id

2. Request triggers agent via webhook/queue
   โ†’ Agent processes asynchronously

3. Agent completes
   โ†’ Results delivered via outbound connector
   โ†’ Webhook callback to the originating system
   โ†’ Or direct database write

4. User polls or receives push notification
   โ†’ Results displayed in UI

When Sync Makes Sense

Synchronous patterns do have their place:

  • โ€ขChat interfaces: Users expect immediate, streaming responses
  • โ€ขSimple lookups: Quick queries that complete in under 5 seconds
  • โ€ขBlocking workflows: When the user cannot proceed without the result

For these, use WebSocket connections for streaming responses and set aggressive timeouts.

A Complete Production Example

The following real-world example brings the pieces together: a document processing pipeline that extracts data from uploaded invoices.

agents/invoice-extractor.yaml
version: "1.0"
name: invoice-extractor
description: "Extracts structured data from invoices"
model: connic/gemini-3.7-flash
system_prompt: |
  You are an invoice processing specialist. Extract structured
  data from invoice images and documents.

  Always extract: vendor name, invoice number, date, line items,
  subtotal, tax, and total. If a field is unclear, mark it as
  "unclear" rather than guessing.
tools:
  - documents.parse_pdf
  - documents.extract_text_from_image
  - validation.verify_totals
output_schema: invoice  # References schemas/invoice.json
agents/invoice-pipeline.yaml
version: "1.0"
name: invoice-pipeline
type: sequential
description: "Complete invoice processing: extract, validate, store"
agents:
  - invoice-extractor
  - invoice-validator
  - invoice-storer

This pipeline:

  • 1.Triggers when a file is uploaded to S3
  • 2.Extracts structured data with confidence scoring
  • 3.Validates the extracted data (math checks, format validation)
  • 4.Stores results and notifies downstream systems

Each step is traced, tokens are counted, and transient failures retry at the failing model-request or operation boundary with exponential backoff.

Deployment Strategy

Production deployments should be boring. No manual steps, no "deploy on Friday and pray."

connic deployments history showing the active deployment plus a versioned list of prior deployments with commit hashes, passed test status, and durations
Every deployment is versioned and logged, with status, commit, agent counts, test result, and duration at a glance.

Git-Based Workflow

Terminal
# Make changes
$ vim agents/invoice-extractor.yaml

# Test locally with hot-reload
$ connic test

# Commit and push
$ git add .
$ git commit -m "Improve extraction accuracy for handwritten invoices"
$ git push origin main

# Deployment happens automatically
# Dashboard shows build progress and deployment status

Rollback in Seconds

Every deployment is versioned. If something goes wrong:

  • โ†’Click "rollback" in the dashboard
  • โ†’Previous version is live immediately
  • โ†’Debug the issue without production pressure

Production Readiness Check

A platform can handle these production concerns:

  • โœ“Isolated execution environments (automatic)
  • โœ“Retry logic and timeout handling (configured, not coded)
  • โœ“Concurrency control (per-agent limits)
  • โœ“Full observability (built-in from day one)
  • โœ“Instant rollbacks (click a button)

For teams still evaluating options, the AI agent deployment platform comparison covers the main tradeoffs.

The quickstart guide covers the initial setup, while the observability features show what production-grade monitoring looks like.