Production AI Agent Architecture: The 7 Layers You Need
A reference architecture for turning a capable model into a reliable business system.

Why a model is not the architecture
A model can interpret language and produce a plan, but it does not automatically know the verified user, current workflow state, authoritative data, allowed actions, or operating policy. Those responsibilities belong to the surrounding application.
Treat the agent as a distributed business system. Its reliability comes from clear layer boundaries, structured contracts, least privilege, evaluation, and operational ownership.
- Keep business state outside the model conversation.
- Make permissions enforceable at data and tool boundaries.
- Version prompts, schemas, policies, and evaluations.
- Design failure and recovery before granting action access.
Layer 1: experience and human control
The experience layer captures the user’s intent, identity, inputs, and consent. It should show what the system understood, which evidence supports the result, and what action will happen next.
For approvals, present a decision-ready package and record the reviewer’s action. Clear status, cancellation, and escalation are as important as a polished chat interface.
Layer 2: orchestration and state
Orchestration converts intent into a bounded workflow. It owns stages, dependencies, retries, timeouts, approvals, idempotency, and recovery. Deterministic code should control the process even when a model helps choose among approved paths.
Persist state explicitly so operators can inspect and resume work without asking a model to reconstruct what may have happened.
| Layer | Primary job | Production question |
|---|---|---|
| Experience | Collect intent and show evidence | Can users understand and control the proposed action? |
| Orchestration | Own state, routing, and recovery | Can work resume safely after partial failure? |
| Models | Interpret and generate | Can models be evaluated and changed without breaking contracts? |
| Knowledge | Supply approved context and memory | Are sources current, permissioned, and attributable? |
| Tools | Read and change business systems | Is every operation narrow, validated, and authorized? |
| Guardrails | Enforce policy and quality | What is blocked, escalated, or reviewed? |
| Observability | Operate and improve the service | Can owners explain cost, quality, and incidents? |
Layer 3: model access
Use a model gateway or clear service boundary to manage model choice, parameters, structured outputs, usage limits, fallbacks, and version changes. Keep provider-specific details away from business workflow logic where practical.
Select models by task quality, latency, cost, data policy, and operational fit. Evaluate changes against the same representative cases before promoting them.
Layer 4: knowledge and memory
Knowledge retrieval supplies current, approved context with source metadata and access controls. Workflow memory stores durable facts or prior state only when the business has a reason, permission, retention period, and correction process.
Do not treat the complete conversation as permanent memory. Separate transient working context from records that are intentionally retained.
Layer 5: tools and integrations
Tools connect the agent to APIs, databases, files, queues, and internal services. Expose narrow operations with typed inputs, scoped credentials, validation, useful errors, and clear read-versus-write authority.
MCP can standardize reusable access for compatible clients, while a direct integration may be simpler for one fixed workflow. Both still require secure underlying access and production operations.
Layer 6: guardrails and evaluation
Guardrails enforce data, action, content, and policy constraints outside the model where possible. Evaluation tests representative normal, edge, adversarial, and refusal cases before launch and after meaningful changes.
Pair automated checks with targeted human review. Track task-specific criteria such as groundedness, required fields, correct tool use, escalation, and prohibited actions instead of one universal accuracy score.
Layer 7: observability and operations
Trace a task across model calls, retrieval, tools, approvals, and state changes. Monitor completion, quality, escalation, latency, cost, dependency errors, and policy events while minimizing sensitive data in logs.
Assign owners for incidents, credentials, knowledge, evaluations, integrations, and change approval. A production agent remains reliable because people can observe, repair, and improve it—not because the first prompt was perfect.
Primary references
Source material used for definitions, architecture, risk, and control considerations.