Skip to content
Log in

Agentic AI System Design: 9 Layers That Break in Production

Agentic AI system design is backend engineering, not prompting. The nine layers that decide whether your agent survives production.

The AI University9 min read
Agentic AI System Design: 9 Layers That Break in Production

Most teams learn what an AI agent is long before they learn how to build one that survives contact with real users. Agentic AI system design is the discipline that closes that gap, and it looks far more like backend engineering than like prompting. An agentic system is not a chat interface wrapped around a language model. It is production software in which a model reasons over goals, calls external tools, maintains state, and triggers real actions through APIs — which means it inherits every reliability, security and observability problem ordinary distributed software has, plus a few of its own.

What follows is the architecture layer by layer: what each layer does, why it exists, and the decision inside it that most teams get wrong.

What agentic AI systems actually are

The defining feature of an agentic system is not intelligence. It is the loop.

They decompose goals rather than answer prompts

A single model call takes an input and returns an output. An agentic system takes a goal and decomposes it into steps, calls external tools to carry those steps out, updates its own state as results come back, and repeats. The model is not producing the answer in one pass; it is producing the next move, over and over, until the work is done.

The loop needs a stopping point

Because the system loops, something has to decide when it stops. That stopping condition is a design decision, not an emergent property — an agent with no explicit stopping point will keep spending tokens and calling tools long after it has stopped making progress. This is the first place where agentic AI system design stops resembling prompt work and starts resembling control-flow engineering.

Single-agent and multi-agent architectures

The next decision is how many agents you actually need, and it is usually made too early and too enthusiastically.

When one controller is enough

In a single-agent system, one controller handles every step centrally. A customer support agent, for example, might classify the incoming request, call the relevant APIs, ask the user for confirmation, and compose the final response — all within one control loop. It is simpler to reason about, simpler to trace, and simpler to debug.

What specialization actually costs

In a multi-agent system, specialized agents divide the responsibilities: one plans, another retrieves knowledge, another writes code, another reviews it, another executes. The upside is genuine specialization. The cost is equally genuine — you now need coordination between agents, fault tracking across agents, and substantially more logging to work out which agent caused a bad outcome. Multi-agent is a trade, not an upgrade.

The model layer in agentic AI system design

The model layer is where most of the cost and most of the downstream fragility originate.

Route by difficulty, not by default

Model routing means matching the model to the job. Small, cheap models are perfectly capable of simple work like classification, and using them there is what keeps a system affordable at volume. Stronger, more expensive models get reserved for the steps that genuinely require complex reasoning. Sending every call to the largest available model is the most common and most expensive default in production AI.

Structure the output or break everything downstream

Model output should be structured predictably, using JSON schemas or function calls. Free text is convenient in a demo and corrosive in a system: the moment downstream code has to parse prose, every phrasing change becomes a potential outage. Structured output is what makes the model's response a value your program can rely on rather than a string it has to interpret.

Tools: the interface to the outside world

Tools are how a model reaches systems it does not contain — APIs for database lookups, CRM records, calendars, payments, ticketing.

Every tool needs a contract

A tool is not just an endpoint you expose to a model. It needs a clear name, defined input and output schemas, explicit permission boundaries, and retry and timeout rules. Those rules are part of the tool's contract rather than operational details to add later, because the model will call the tool in situations you did not anticipate.

Read-only and write tools are not the same risk

The most useful separation in the tool layer is between read-only tools and risky write tools. A lookup that returns data is recoverable if it goes wrong. A tool that issues a refund, deletes a record or sends an email is not. Write tools require validation and frequently human approval before they execute; treating both categories identically is how an agent causes damage that cannot be undone.

Memory and state are not the same thing

This distinction is the one most commonly collapsed, and collapsing it produces agents that behave unpredictably for reasons that are very hard to trace.

State is the current run

State tracks what is happening right now: which step of the workflow the system is on, which tool calls have been made, which confirmations the user has given. It is the execution context of this particular task.

Memory is everything before it

Memory is the accumulated material — conversation history, user preferences, retrieved knowledge. It is not tied to the current step and it does not describe where the workflow has got to.

Store by access pattern, not by habit

Not all of that belongs in an expensive vector database. Storage should follow access patterns and latency needs: some things are looked up by key, some are genuinely semantic searches, some only need to live as long as the session. It matters just as much to distinguish short-term context passed into the prompt from long-term memories fetched selectively — pushing everything into the context window is both costly and counterproductive.

Orchestration: the control layer

Orchestration is the layer that runs the whole thing, from user intent through tool calls to final output.

Pipelines, state machines and graphs

Orchestration can be a simple linear pipeline, a state machine, or a graph-based workflow. Which one you choose matters less than choosing deliberately, because the orchestration layer is where control flow, retries, branching and approvals have to be defined explicitly. Behaviour that is implicit here is behaviour nobody can predict or reproduce.

Multi-agent orchestration adds routing and handoffs

If the system has multiple agents, orchestration also routes information between them, resolves conflicts when they disagree, and manages handoffs. That is a meaningful amount of additional machinery, and it is the real reason multi-agent systems are harder to operate than their architecture diagrams suggest.

Evaluation: AI systems fail semantically

Ordinary software fails loudly. AI systems fail quietly — producing output that is well-formed, confident, and wrong or unsafe.

Score every step, not just the answer

Because the failure can occur anywhere in the loop, evaluation has to cover every step: intent classification, retrieval, tool selection, argument validation, policy compliance, and the final result. An end-to-end check that only inspects the last message will miss a retrieval that returned the wrong document and a tool that was called with the wrong arguments.

The evidence that makes evaluation real

That means trace-level evaluations rather than single-output scoring, realistic test sets that include edge cases rather than happy paths, and human review. Track accuracy, refusal rates and cost per task — cost per task in particular is the metric that tells you whether a working system is also a viable one.

Approval and policy controls

Some actions are simply too consequential to leave to a probabilistic system.

High-impact actions need human gating

Sending emails, deleting data, issuing refunds, cancelling orders — these need a human in the loop. The model's suggestion should be validated by deterministic code and, where the stakes justify it, approved by a person before anything executes.

Execution should not trust planning

In a multi-agent system this becomes an architectural rule: the execution layer does not blindly trust the planning layer. A plan is a proposal. Something deterministic has to check it before it becomes an action.

Production principles

Everything above is architecture. These are the properties that architecture has to deliver.

  • Reliability comes from decomposition, validation, retries, fallbacks and monitoring — the same mechanisms that make any distributed system dependable.

  • Cost and latency are designed rather than discovered, through aggressive caching and token limits.

  • Context design is critical: pass only data that is relevant, trusted and minimal. More context is not better context.

  • Observability requires logging metadata at every step — model versions, costs, errors, user feedback — because you cannot debug a loop you cannot see.

  • Security starts from the assumption that all model inputs are attacker-controlled unless verified.

  • Privacy means minimising the data sent to models at all, and masking PII appropriately.

The bigger shift

Read those layers together and the pattern is hard to miss: almost none of them are about the model. Routing, contracts, state, control flow, evaluation, gating, caching, logging, input trust — these are backend concerns, and they are the concerns that decide whether an agent works in front of real users. The model is one component inside a system, and the system is where the engineering lives. That is the real shift in agentic AI system design: the hard problems moved from writing better instructions to building better software around them. It is backend design, not prompt engineering.

Frequently asked questions

What is the difference between an AI agent and a chatbot?

An AI agent differs from a chatbot in that it runs a loop rather than a single exchange. A chatbot takes one input and returns one output. An agent takes a goal, decomposes it into steps, calls external tools to carry those steps out, updates its state as results come back, and repeats until a stopping condition is met. That loop is what makes an agent production software rather than a chat interface.

Do you need a multi-agent setup to build a serious AI agent?

No — multi-agent architecture is a trade, not an upgrade, and most systems are better served by a single controller. One controller handling classification, tool calls, confirmations and the final response is simpler to reason about, trace and debug. Splitting the work across specialist agents buys genuine specialization, but you pay for it in coordination, fault tracking across agents, and substantially more logging to work out which agent caused a bad outcome.

What is the difference between memory and state in an AI agent?

State tracks the current run; memory holds everything before it. State is the execution context of this particular task — which workflow step the system is on, which tool calls have been made, which confirmations the user has given. Memory is the accumulated material: conversation history, user preferences, retrieved knowledge. Collapsing the two produces agents that behave unpredictably for reasons that are very hard to trace, which is why the distinction is worth enforcing in code.

Why do AI agents get so expensive to run in production?

AI agents get expensive because cost is discovered rather than designed. Sending every call to the largest available model is the most common default in production AI, when small cheap models handle classification perfectly well and stronger models can be reserved for genuine reasoning. Pushing everything into the context window compounds it. Aggressive caching, token limits, model routing by difficulty, and tracking cost per task as a first-class metric are what keep an agent viable at volume.

Why should an AI agent return JSON instead of free text?

An AI agent should return structured output — JSON schemas or function calls — because downstream code has to rely on the response rather than interpret it. Free text is convenient in a demo and corrosive in a system: once your program parses prose, every phrasing change becomes a potential outage. Structured output turns the model's answer into a value the rest of the system can depend on.

Which AI agent actions need human approval before they run?

Any action that cannot be undone needs human gating: sending emails, deleting data, issuing refunds, cancelling orders. The useful split in the tool layer is read-only versus write. A lookup that returns the wrong data is recoverable; a refund that should not have been issued is not. Write tools need deterministic code validating the model's suggestion first, and a person approving it where the stakes justify one.

Share this post

Build it yourself

Everything written about here gets built in the open. The community on Skool is where the source, the prompts and the questions live.

Join the community →

Keep reading