Skip to main content
AI & Automation

AI agent architecture: how a production agent is built (tools, memory, guardrails, handoff)

By Prilient ·

AI agent architecture: how a production agent is built (tools, memory, guardrails, handoff)
Short answer: a production AI agent is not one prompt. It is a small system with six parts: the channel where requests arrive, an orchestrator that decides the next step, a set of tools the agent is allowed to call, memory and knowledge it can read, guardrails that limit what it may do, and a clear handoff to a person. Logging and evaluation sit around all six, so you can see what the agent did and prove it still works after every change.

Why architecture matters more than the model

Most agent demos work. Most agent failures happen later, when real customers send messy requests, a connected system is slow, or the agent is asked something it should not answer. Those failures are rarely fixed by switching to a bigger model. They are fixed by architecture: what the agent can reach, what it remembers, what it must check before acting and when it stops and asks a person.

If you are buying an agent, ask the vendor to draw these layers for your use case. If they cannot, you are buying a demo.

The six layers of a production agent

1. Channel

The channel is where the request comes from: a website chat, WhatsApp, a phone line, email or an internal tool. Each channel has its own rules. Voice needs fast replies and short sentences. WhatsApp needs approved templates for messages sent outside the 24-hour window. Email needs threading. The architecture should keep channel logic separate from business logic, so the same agent can serve more than one channel.

2. Orchestrator

The orchestrator is the control loop. It reads the request, decides which step comes next, calls a tool or the model, checks the result and decides whether the job is done. Simple agents use one loop. Larger systems use a manager agent that hands sub-tasks to specialist agents, for example one that checks stock and one that drafts the reply. Keep the orchestration logic in code you can test, not hidden inside a long prompt.

3. Tools

Tools are the actions the agent may take: look up an order, check a calendar, create a ticket, update a CRM record, send a payment link. Good tool design is the biggest quality lever:

  • Give each tool one narrow job, with typed inputs and clear error messages.
  • Separate read tools from write tools, and require extra checks for writes.
  • Return only the data the agent needs, not whole database rows.
  • Use a standard such as the Model Context Protocol when several agents or apps need the same tools.

We cover MCP in more depth in our guide to MCP server development.

4. Memory and knowledge

There are three kinds of memory, and mixing them up causes most "the agent forgot" complaints:

Kind What it holds Typical store
Conversation memory The current chat or call Session store, cleared after the case closes
Customer memory Facts about this customer, such as past orders or preferences Your CRM or database, read through a tool
Knowledge Policies, product details, FAQs A search index used for retrieval (RAG)

Rules for memory are business rules. Decide what the agent may remember, for how long, and who can see it. Personal data should be read from your systems when needed, not copied into prompts and logs without a reason.

5. Guardrails

Guardrails are the limits that keep the agent safe and on task:

  • Scope limits: topics the agent will not discuss, and a polite way to say so.
  • Action limits: amounts, refunds or changes that always need a person to approve.
  • Input checks: detecting prompt injection in documents, emails or web pages the agent reads.
  • Output checks: blocking personal data, made-up prices or promises the business does not offer.
  • Rate and cost limits: stopping loops and runaway usage.

The OWASP Top 10 for LLM applications is a useful checklist for this layer.

6. Human handoff

Every agent needs a defined exit. Handoff triggers include low confidence, an angry customer, a complaint, a legal or medical question, a high-value action or the customer simply asking for a person. A good handoff passes the summary, the data collected and the reason for escalation, so the customer never has to repeat themselves.

Around the six layers: logs, evaluation and monitoring

A production agent records every step: the request, the tools called, the data returned, the reply and the outcome. That trace is how you debug a bad answer and how you show an auditor what happened. Before each release, run the agent against a test set of real past conversations and compare the results with the previous version. After launch, watch completion rate, handoff rate, tool errors, response time and cost per conversation.

Common architecture mistakes

  1. One giant prompt. Business rules buried in prose are hard to test and easy to break.
  2. Tools that do too much. A single "update customer" tool invites mistakes; split it.
  3. No write approvals. Agents should not refund, cancel or delete without limits.
  4. Knowledge that goes stale. If the price list changes and the index does not, the agent will quote old prices.
  5. No owner. Someone in the business must own the agent's behaviour, not just the IT team.

A simple reference design

For a customer support agent that can check orders and book returns, a sensible first version looks like this: website chat and WhatsApp as channels; one orchestrator; four tools (find order, check return eligibility, create return, hand off to staff); a knowledge index of return and shipping policies; guardrails that cap returns by value and block personal data in replies; and a dashboard of traces and outcomes. That is enough to launch, measure and improve. More agents and more tools come later, when the data shows where they help.

How Prilient designs agent architecture

We start every AI agent development project with a one-week discovery that maps your process, systems and risks into these layers. You get a written architecture before any build starts, a working prototype in 2 to 4 weeks and a production launch with tracing and evaluations in place. If you want to see how the patterns compare, read chat agent vs workflow agent and AI agent vs chatbot vs workflow automation.

Book a free 30-minute call and we will sketch the architecture for your use case with you.

Questions about AI agent architecture

What is AI agent architecture?

It is the design of the parts around the language model that make an agent useful and safe: the channel, the orchestrator, the tools it may call, its memory and knowledge, its guardrails, the handoff to people, and the logging and evaluation that let you trust it.

Do I need multiple agents or one?

Start with one agent and a small set of tools. Split into a manager and specialist agents only when one agent's instructions become too long to test, or when steps need different permissions.

Where should business rules live?

In code and configuration wherever possible: tool permissions, approval limits and validation checks. Prompts should describe tone and judgement, not hard limits such as refund amounts.

How do you stop an agent from taking harmful actions?

Separate read and write tools, set limits on write actions, require human approval above those limits, check inputs for prompt injection and log every action so it can be reviewed.

What is the role of RAG in an agent?

Retrieval-augmented generation lets the agent look up your policies and product information at the time of the question, so answers reflect your current documents instead of what the model learned in training.

Can an existing chatbot be upgraded to an agent?

Often, yes. The usual steps are adding tools that connect to your systems, adding guardrails and approvals for actions, and adding tracing so you can see what the agent does.

Leave A Reply

Your email address will not be published. Required fields are marked *

Have a Project in Mind?

Let us help you build something amazing. Get in touch with our team today.