Skip to content

Command Palette

Search for a command to run...

BLOG / ARCHITECTUREAdvanced

The Enterprise AI Engineering Blueprint

A reference architecture for enterprise AI: gateway, orchestration, RAG, MCP tools, identity, guardrails, evaluation, observability and governance.

Bhavin Mistry September 11, 2026 16 min readLast reviewed

Topics:RAG and retrievalMCP and tool useEnterprise AI engineering

Enterprise AI Engineering SeriesPart 1 of 5

Six months after the demo shipped, the questions arrive: who can see what data the model reads, why the bill tripled, and why an agent touched records it should never have. None of them is a model problem. Each is a layer that was never built.

TL;DR

An enterprise AI system is not an app that calls a model. It is a stack of layers (gateway, orchestration, context and RAG, tools and MCP, agents, identity, guardrails, evaluation, observability and governance) between the product and the model, and each one exists because a real failure mode requires it. Add the AI gateway first, because it is nearly free early and expensive to retrofit.

The problem with "just call the API"

An illustrative arc, common enough to recognise: most enterprise AI efforts start the same way: a team wires a chat UI directly to a hosted model API, ships a demo, and gets a green light. Six months later the same team is fielding a security review that asks who can see what data the model reads, a finance review asking why the model bill tripled, and an incident where an agent deleted records it should never have touched. None of that is a model problem. It is an architecture problem: there was never a layer between the product and the model that could enforce identity, cost, policy, or auditability.

This article lays out a reference architecture for enterprise AI systems: not a product pitch, a shape. We call it the Enterprise AI Engineering Stack. It is deliberately boring: every layer exists because a real failure mode requires it, not because it is fashionable. If you are building your first internal AI product, use this as a checklist of what you are missing. If you already run one in production, use it to find the layer you skipped.

Key takeaway

An enterprise AI system is not "an app that calls a model." It's a stack: gateway, orchestration, context, tools, identity, guardrails, evaluation, observability and governance sit between the product surface and the model, and skipping any one of them shows up later as an incident, not a missing feature.

The reference architecture

Client / Product Surfacechat, IDE plugin, internal app, agent UIAI Gatewayrouting, auth, rate limits, cost metering, loggingOrchestrationagent loop, workflow engine, prompt/version registryContext & RAGretrieval, reranking, enterprise data, vector + search indexTools & MCP Serversinternal APIs, ticketing, code search, data warehousesIdentity & Guardrailsagent identity, least privilege, policy engine, sandboxingEvaluation & Observabilityoffline evals, CI gates, tracing, drift & cost monitorsGovernance & Auditmodel catalog, approvals, audit trail, kill switch
The Enterprise AI Engineering Stack: Learn AI Engineering reference architecture

Read it top to bottom as the path a request takes, and bottom to top as the path a response takes back. Every layer below is optional in a prototype and mandatory in production.

Client / product surface

This is the chat window, IDE plugin, internal ops console or agent-driven workflow the user actually touches. It should carry almost no business logic: its job is to render, collect input, and stream output. Treating it as a thin client is what makes every layer beneath it swappable later.

AI Gateway

The AI gateway is the single choke point every model call passes through. Concretely, it is a proxy that does authentication, per-team and per-request rate limiting, cost metering, request/response logging and model routing. Without a gateway, every team that wants to call a model integrates directly with a provider SDK, and you end up with credentials scattered across a dozen services, no unified view of spend, and no place to enforce a policy like "no raw customer PII in prompts to third-party models."

A minimal gateway configuration might look like this:

routes:
  - name: internal-assistant
    match:
      team: support-eng
    policy:
      allowed_models: ["claude-sonnet-4-5", "gpt-4.1-mini"]
      max_tokens_per_request: 4096
      pii_redaction: enabled
      log_level: full
    budget:
      monthly_usd: 5000
      alert_at_pct: 80
  - name: customer-facing-agent
    match:
      team: product-agents
    policy:
      allowed_models: ["claude-sonnet-4-5"]
      pii_redaction: enabled
      require_human_approval_for: ["refund", "account_deletion"]
    budget:
      monthly_usd: 20000
      alert_at_pct: 75

The specific product you use to implement this (a self-hosted proxy, a managed gateway, a service mesh extension) matters less than the fact that one exists and that nothing calls a model provider directly.

Orchestration

Orchestration is the layer that turns "a prompt" into "a workflow": the agent loop, the multi-step chain, the state machine that decides what happens after the model responds. It owns prompt and workflow versioning, retries, and the decision of whether the next step is another model call, a tool call, or a return to the user. See AI agent loops, stopping conditions and guardrails for how to keep this layer from looping forever or taking unbounded action.

Context & RAG

Most enterprise use cases are not "ask the model a question." They are "ask the model a question about our data." That means retrieval: turning internal documents, tickets, code and structured records into context the model can use. This is a full subsystem in its own right, with its own failure modes. See Production RAG architecture for ingestion and indexing, and Why good retrieval still produces bad answers for why a good retriever does not guarantee a good answer. The RAG system pattern documents this as an architecture pattern in its own right.

Tools & MCP servers

Modern assistants do more than answer. They act, by calling tools: internal APIs, ticketing systems, code search, data warehouses. The Model Context Protocol (MCP) is the open specification, originally published by Anthropic, that standardizes how a model-facing application discovers and calls such tools, instead of every team writing a bespoke tool-calling integration per model provider. See What is MCP? Model Context Protocol Explained for the protocol itself. Architecturally, treat every MCP server as a piece of attack surface: it is a bridge between a model's output and a system that can take real action, and it needs the same access controls you would put in front of any internal API: least privilege, scoped credentials, input validation on tool arguments, and audit logging of every call. MCP's own security guidance is explicit that a human should be able to deny a tool invocation, not just observe it after the fact.

Agents

An agent is orchestration plus tools plus a loop: the model decides which tool to call, observes the result, and decides again. The agent system pattern and production agent pattern describe this in more depth. The engineering discipline that matters here is bounding the loop: a maximum step count, a cost ceiling per task, and an explicit set of stopping conditions, because an agent that can keep calling tools indefinitely is a cost incident and a safety incident waiting to happen.

Identity

Every agent and every tool call needs to run as somebody: not a shared service account, but a specific, attributable identity with its own scope. When an agent modifies a record, the audit log should show which agent, acting under which policy, on whose behalf, took that action, the same way you would want a human employee's actions attributed. This is the foundation the guardrail layer below is built on: you cannot enforce least privilege for an identity that does not exist.

Guardrails

Guardrails are the enforcement layer: policy checks before and after a model call, tool permission checks, output filters, sandboxing for anything the model's output might trigger. We cover this as its own topic, with a named framework, in Enterprise AI Guardrails, the third article in this series. The short version: guardrails are not one control, they are defense in depth across the whole stack, not a single filter bolted onto the model's output.

Evaluation

Evaluation is how you know whether a change made things better or worse, before your users find out. That means offline evaluation sets, regression gates in CI, and a scoring methodology that separates did the pipeline retrieve and assemble the right context from did the model produce a correct, well-supported answer. See LLM evaluation fundamentals for production for the mechanics, and the evaluation pipeline pattern for how to wire it into deployment.

Observability

Observability is evaluation's real-time twin: tracing every request end to end (which documents were retrieved, what prompt was assembled, which tools were called, what the final answer was), monitoring cost and latency per team and per model, and detecting drift: a retrieval index going stale, a provider silently changing model behavior, an agent's tool-call success rate dropping. Without a trace, a "bad answer" ticket is unsolvable. With one, it is a five-minute root-cause.

Governance

Governance is the layer that makes the rest of the stack an organizational fact rather than one team's discipline: an approved model catalog (which models may be used for which data classifications), a change and approval process for new agents and tools, an audit trail that regulators or internal security can query, and a kill switch that can disable a specific agent, tool or model route without taking down the whole system. Governance is what lets you say "yes" to a new use case quickly, because the guardrails and audit trail are already there. The alternative is a security review that blocks every new idea from scratch.

What existing categories of tools do at each layer

Stack layerTool categoryWhat "good" looks like
AI GatewayLLM proxy / gatewaySingle choke point, per-team budgets, provider-agnostic routing
OrchestrationWorkflow / agent frameworkVersioned prompts, explicit state machine, bounded loops
Context & RAGVector store + search indexEvaluated retrieval, version-aware chunking, access-control-aware filtering
Tools & MCPMCP servers / internal API gatewaysScoped credentials per tool, input validation, per-call audit log
IdentitySecrets manager / IAMPer-agent service identity, no shared credentials, short-lived tokens
GuardrailsPolicy engineDeclarative, testable policy, enforced pre- and post-model-call
EvaluationEval framework / CI gateRegression set, blocked deploys on quality drop
ObservabilityTracing / APM for LLM callsFull request trace, cost and latency dashboards, drift alerts
GovernanceModel catalog / audit logApproved model list, immutable audit trail, per-agent kill switch
Architecture decision

Put the AI gateway in front of every model call before you build anything else. It is the one layer that is nearly free to add early and expensive to retrofit: once five teams have five different direct integrations to a model provider, unifying them is a migration project, not a config change.

A build checklist for the stack

  • Every model call passes through a single gateway: no direct provider SDK calls in application code
  • Every agent and tool call runs under a distinct, attributable identity
  • Every tool (including every MCP server) has scoped, least-privilege credentials
  • Retrieval and generation are evaluated separately, with a regression set that runs in CI
  • Every request is traceable end to end: retrieved context, assembled prompt, tool calls, final answer
  • There is an approved model catalog, and using an unapproved model requires an explicit exception
  • There is a kill switch that can disable one agent or tool without a full system outage
  • Audit logs are immutable and queryable by security/compliance without engineering involvement

Frequently asked questions

What is an enterprise AI architecture? A layered stack between the product and the model: AI gateway, orchestration, context and RAG, tools and MCP servers, agents, identity, guardrails, evaluation, observability and governance. Each layer exists because a real failure mode requires it.

What is an AI gateway? A single proxy that every model call passes through. It handles authentication, per-team rate limiting, cost metering, request and response logging, model routing and policy enforcement such as redacting PII.

Why is the gateway the first layer to build? It is nearly free to add early and expensive to retrofit. Once several teams have separate direct integrations with a model provider, unifying them is a migration project, not a config change.

Why must agents have their own identity? You cannot enforce least privilege for an identity that does not exist. Attributable identities also let the audit log show which agent, under which policy, on whose behalf, took an action.

How should I secure MCP servers? Treat each one as attack surface: least privilege, scoped credentials, input validation on tool arguments and audit logging of every call, with a way for a human to deny an invocation.

What does governance add on top of guardrails? An approved model catalog by data classification, a change and approval process for new agents and tools, a queryable audit trail and a kill switch, so the stack is an organisational fact rather than one team's discipline.

Where this series goes next

This blueprint is the map. The next four articles walk each region of it in practice: how the AI-native software delivery lifecycle changes stage by stage, what a single developer's day looks like inside this stack, how the guardrail layer is actually built, and a 90-day plan for rolling all of this out without boiling the ocean.

Enterprise AI Engineering SeriesPart 1 of 5

Enterprise AI and governance

Your next step

Reading is the start. Turn it into skill: read the chapter, practise on something real, check the numbers, then follow a path.

  1. Read · ChapterAI Governance & Risk
  2. Practise · Debug challengeInjection via Retrieved Documents
  3. Use a free toolAI Adoption Funnel
  4. Follow a roadmapAI Engineering Leader roadmap
All articles on RAG and retrieval
#enterprise-ai-engineering-series#architecture#ai-gateway#mcp#governance#rag

Discuss this article

Got a question, a counter-example or a correction? Bring it to the community.

Join the discussion

Email updates

Enjoyed this? Get the next guide by email.

One email when something substantial is published. No digests, no daily drip. Unsubscribe in one click.

We will email you a confirmation link first, then send an occasional email when a substantial guide is published. Unsubscribe in one click. Stored on our own servers, never sold or shared. See the privacy policy.

Prefer a feed reader? Follow by RSS.