← Blog overview

From Demo to Production: The 5 Zones of a Real AI Agent System

From Demo to Production: The 5 Zones of a Real AI Agent System

Most AI agents pass their first test. A user asks a question, the model replies, and the demo looks finished. Then the agent goes live, usage climbs, and the answers get worse, not better. The model has not changed. The architecture around it was never built to hold up at volume.

The gap is architectural, not technical. That is the pattern worth naming directly: teams are shipping agents faster than ever, and the quality of those agents is degrading as usage scales, not improving. The fix is rarely a bigger model. It is the right setup: five architectural zones that turn a one-off demo into a production AI agent system that survives contact with real traffic. This article walks through each zone, the failure it exists to prevent, and where GoTeams has seen teams build it right.

The five zones at a glance

ZoneWhat it doesFailure it prevents 
The HarnessAssembles everything the model sees per runMissing context; rules scattered in code
The Agent RunLLM + tools + loop + guardrailsRunaway retries; unauthorised actions
The Memory LayerPersists skills, facts, and historyStarting from zero every session
The RAG PipelineIndexes knowledge and retrieves it on demandConfident answers from stale or missing data
LLM OpsTraces, evals, gates, and releasesUnexplainable failures; irreversible changes

1. The Harness: What the Model Is Allowed to See

The harness assembles one conversation for the model before it answers anything, and it has three inputs.

System Prompt. Your house rules: tone, hard constraints, safety policies. Keep this in one versioned file, never buried in application code, so it can be evaluated and rolled back without a deploy.

User Prompt. The raw ask, stored word for word. Keep a cleaned version for the model if needed, but preserve the original. Evals and complaint investigations both need the exact wording, not a paraphrase.

Chat History. The turns of the current thread, trimmed to a token budget. A follow-up like “and the cheaper one?” means nothing without it.

The context window is a counter, not free storage. These three inputs feed into working memory, the context window. One context builder should assemble every run, and each section (rules, thread, retrieved facts, tool schemas) gets its own explicit token budget. Overflow becomes a decision made in advance: old chit-chat drops first, safety-critical rules never do. Everything on the counter clears the moment the run ends.

The mistake GoTeams sees most often is a single giant prompt with everything pasted in. It works in the demo. It breaks the first week traffic peaks, the token limit gets hit, and the most important instruction is the first one to silently fall off.

2. The Agent Run: Judgement, Equipment, and a Timer

This is where the assistant stops being a chatbot and starts having consequences.

LLM. The judgement. It reads the assembled context and decides what happens next.

Tools. The equipment. Typed schemas, scoped credentials, read-only wherever possible. A “look up payment” tool should be scoped to the asking customer, never a free query over the payments table. Tool descriptions matter as much as function signatures, because the model chooses a tool by reading its description. A vague description is a bug, not a style choice. Resist shipping twenty overlapping tools: accuracy falls sharply once the names blur together.

The loop. Think, act, observe, repeat. This is what lets the agent recover from an empty result instead of giving up.

Guardrails set three limits against three failure modes. A maximum-iterations cap catches the model ping-ponging on the same failed call. A cost ceiling catches one expensive tool or retrieval blowing the budget. A wall-clock timer catches a hung external API that never returns.

The scare story every team eventually tells is an agent calling the same tool with the same arguments forty times overnight: a frightening bill and no answer. With guardrails in place, a stuck run exits with a partial answer and a logged limit instead. The reply should also carry a reference to what was actually done (a booking ID, an order number), so a failed write surfaces immediately, not in a support ticket three days later.

3. The Memory Layer: Three Stores, One Write-Back

The context window dies the moment the run ends. Without a memory layer, every conversation is the agent’s first conversation, no matter how many times the same user has asked the same thing.

The fix is to separate three kinds of memory. Procedural memory answers how to act, and lives in skill files (how to quote a custom order). Semantic memory answers what is true, and lives in a vector store (durable facts, catalog data, preferences). Episodic memory answers what happened, and lives in SQL plus vectors (dated events, past threads). Keeping the three separate means each is editable without breaking the others. Episodic memory deliberately uses both halves: SQL answers “what did we promise last Tuesday,” vectors answer “when did we discuss that allergy.”

The write-back step is the one most teams skip. Every finished run should be written back to memory after the reply goes out. Skip it, and memory looks implemented while nothing actually persists. Store the run ID with each saved record, so a bad eval score next week traces back to the exact turns that caused it.

Raw chat turns pile up fast, and six months in, retrieval starts returning “hi” and “thanks” instead of facts. A cheap model should periodically distil raw turns into structured facts (subject, fact, source run, date) written to semantic memory. That summarizer should fire behind a gate, after N new chats or a staleness threshold, not on a five-minute cron. Consolidation cost then tracks real activity instead of the clock, and since this is compression work rather than reasoning, it belongs on your cheapest capable model.

4. The RAG Pipeline: Two Paths That Meet at the Vector Database

Real organisational knowledge lives in PDFs, spreadsheets, and chat logs. A retrieval-augmented generation (RAG) pipeline turns it into something searchable, and the key design decision is that it runs on two paths with two different clocks. Filing happens on a schedule. Looking something up happens on the user’s clock. The two paths meet only at the vector database.

The write path is offline and scheduled. Sources (docs and chats) each carry an owner and a date. Chunking splits content by section, with overlap and metadata preserved. Embedding uses one recorded model, not whatever happens to be current that week. Storage lands in a vector database plus SQL metadata, feeding semantic memory.

The read path is live and runs per query. The real intent gets rewritten standalone from the thread. The query is embedded with the exact same model used at write time. Retrieval pulls an approximate-nearest-neighbour top-k with permission and date filters applied. Reranking, usually with a cross-encoder, keeps the best few. Assembly places the result onto the context window, labelled with source and date.

Four rules do most of the work here. Never embed documents live during a request: it is slow, expensive, and impossible to reproduce later, so a nightly job re-indexes what changed while live queries keep serving the existing index. Embed intent, not the literal message: “and the cheaper one?” retrieves nothing on its own, because the subject lives in earlier turns. The read path must use exactly the embedding model of the write path; a mismatch throws no error, quality just collapses while every dashboard stays green. And retrieve generously, filter strictly: twenty to fifty candidates in, three to eight out after reranking, because the paragraph that actually answers the question often sits at rank eleven. Every chunk should also carry its source and effective date. Index a price list without one, and the system will eventually quote an expired price with total confidence.

5. LLM Ops: From Complaint to Reversible Release

When someone reports “it gave the wrong answer yesterday” and all you have is the reply text, there is nothing to debug. LLM Ops is the zone that closes the improvement loop.

Six steps make up the loop. Trace produces one record per run: assembled context, tool calls, tokens, latency, cost, and prompt version. Observe tracks health metrics: p95 latency, error and tool-failure rates, cost per run. Eval uses a judge model to score runs against a rubric on a frozen set of real questions. Diagnose clusters failures by stage: retrieval, tool choice, or generation. Gate applies fixed thresholds, with no regression allowed on any rubric line. Release ships one reversible bundle, prompt version plus model config plus tool changes plus RAG parameters, behind a canary.

Observe and eval answer different questions, “is it working” and “is it good,” and they fail independently of each other. Build the golden eval set from real traces, embarrassing ones included, then freeze it so scores stay comparable across releases. Never judge with the same model and prompt being tested; it grades its own style as correct. Diagnose before you fix: a score drop after a data change is usually a retrieval or assembly bug (retrieved chunks truncated by a token budget is a common one), not a prompt problem, even though the reflex in most rooms is to rewrite the prompt on a Friday afternoon. Gate per rubric dimension rather than on one average, so a groundedness drop cannot hide behind nicer formatting. And treat a release as a bundle, not a prompt edit: the same prompt with a different top-k or a different model is a different system. Version the retrieval parameters too, or a rollback restores half the old system and the mystery continues.

The output of a release flows back into the harness: better rules and config on every subsequent run. Traces make evals, evals make a diagnosis, releases make better runs, which make better traces. That closed loop is the actual difference between monitoring a system and improving one.

Why Most Agents Stall at “Mostly Fine”

GoTeams has watched this pattern up close. Most teams build the context window and the read path first: the harness and a basic RAG pipeline. They ship, the demo looks good, and usage grows. What is missing is rarely visible until it is: no consolidation step, no release gate, no separation between procedural, semantic, and episodic memory. Quality does not collapse all at once. It erodes, one silently-dropped instruction and one stale retrieval at a time, until the agent plateaus at “mostly fine” and nobody can say exactly why.

That is the pattern behind Zennify, a GoTeams Plus+ venture that extended a call-centre platform into a scalable framework for AI assistants: LLM orchestration, speech services, and Twilio integration, built as a modular, containerised system from day one. The team did not treat orchestration as an afterthought bolted onto a working demo. Guardrails, tool scoping, and a structured memory layer were part of the architecture from the first sprint, not a fourth-quarter cleanup project. Zennify now runs over 200 configuration options for contact centres and is a European market leader, used by PMI, Nestlé, FlixBus, and Illy Café among others. The lesson is not that GoTeams builds the five zones perfectly. It is that teams who treat architecture as day-one work, not scale-up work, are the ones whose agents get better with volume instead of worse.

Frequently asked questions

Why does an AI agent get worse as usage scales, even though the model hasn’t changed?

Model quality is constant; the surrounding architecture is what breaks under load. Without a token-budgeted context builder, guardrails on tool calls, and a memory layer that writes back after every run, an agent accumulates silent failures: dropped instructions, unbounded retries, and retrieval drift. At low volume these are rare enough to miss. At scale they compound into the “mostly fine” plateau most teams eventually hit.

What is the single most commonly skipped piece of AI agent architecture?

The write-back step in the memory layer. Teams build a vector store and call it memory, but if finished runs are never written back after the reply goes out, nothing actually persists between sessions. The agent looks like it has memory and behaves like it doesn’t.

Do I need all five zones from day one?

Not at full depth, but each zone needs its skeleton in place before you scale traffic. A production RAG pipeline without an LLM Ops trace and eval loop, for instance, means the first quality complaint has no way to be diagnosed. Retrofitting guardrails and observability after launch is possible, but it is slower and riskier than building the skeleton first.

What is the difference between the read path and the write path in a RAG pipeline?

The write path is offline and scheduled: documents get chunked, embedded with one recorded model, and stored ahead of time. The read path runs live, on the user’s clock, per query: it rewrites intent from the thread, embeds with the exact same model used at write time, retrieves generously, and reranks strictly. The two paths only meet at the vector database, and a mismatch between their embedding models fails silently, with no error but a visible drop in answer quality.

How do you debug an AI agent that “gave the wrong answer yesterday”?

Only with a trace: one record per run capturing the assembled context, tool calls, tokens, latency, and prompt version. Without it, “it gave the wrong answer” has no starting point for diagnosis. With LLM Ops in place, the failure gets clustered by stage (retrieval, tool choice, or generation) before anyone touches the prompt, because most quality drops trace back to a retrieval or assembly bug, not a prompt problem.

The bottom line

Build your agents for quality at scale from the start, not for the demo. A one-model-call assistant can pass every test a stakeholder throws at it in a conference room and still fail the moment real traffic hits it, because the demo never had to survive a token-budget overflow, a stuck tool call, or six months of stale retrieval. The five zones (Harness, Agent Run, Memory Layer, RAG Pipeline, and LLM Ops) are not an enterprise upgrade bolted on after the fact. They are the difference between an agent that plateaus at “mostly fine” and one that gets more reliable the more it is used. GoTeams builds AI-orchestrated engineering teams around exactly this discipline: pairing the judgement of the model with the guardrails, memory, and release process that keep it accountable at scale. The next box worth checking is rarely a bigger model. It is the leftmost missing zone.