How AI systems are built, one layer at a time
By Sudharsan · Updated 3 October 2026 · Version 1.1
You do not need to know anything about AI to follow this. It starts with one question typed into a chatbot and adds one idea at a time, until you can read the diagram of a full company-wide AI platform. Each stage answers a simple question: what is still missing?
Every stage opens with a one-line plain-English summary and an everyday comparison, follows one example question through the system. Words with a dotted underline show a short definition when you hover, tap or focus them. Click any box in a diagram to see what it does.
A short, plain-language guide to how a company builds an AI system it can trust. Ten steps, one screen each: what it means, what it gives, and the main risk. No technical background needed.
Press Play in the player below to watch the system build up, or run a request through the finished platform in stage 10. Want more depth? Press Technical in the top bar.
The whole journey on one screen
Watch the system build up, step by step
Press Play, or step through with Next and Back. Each step adds one layer; the new parts appear highlighted. Hover over any box to see what it connects to.
How to read the diagrams
Boxes are components, arrows show what flows between them, and the labels say what travels along each arrow. The diagram grows cumulatively: what you saw earlier stays in place, and newly added parts sit on a yellow highlight with a NEW tag. On narrow screens, drag a diagram sideways.
Colour key
- New in this stage
- Users, outputs, systems
- Prompts, schema, gateway
- Models
- Knowledge and memory
- Tools and MCP
- Agents and orchestration
- Human approval
- Evals
- Guardrails
- Observability
- Governance
- Infrastructure
Stage 1 of 10 · Foundation
LLM for research and drafting
Start with the simplest possible system: a person writes a prompt, a large language model returns text. Nothing else is attached.
A very capable writing and research assistant that works from memory. It drafts, summarises and explains, but it can sound certain while being wrong.
A little more detail
A large language model (LLM) is the engine behind tools like ChatGPT and Claude. It was trained on huge amounts of text, and all it does is predict the next word (technically a token, a small chunk of a word), again and again, until the answer is complete.
What you type is the prompt. The reply is the completion. The model can only look at a limited amount of text at once, called the context window: think of it as the size of its desk. A setting called temperature controls how adventurous the guesses are: low for safe and repeatable, high for creative.
Even this alone is useful for research and drafting: summarise an article, compare options, rewrite an email. The catch is that it predicts plausible words rather than looking up facts, so it can sound confident and be wrong. That is called a hallucination.
An LLM is a next-token predictor. Text is cut into tokens (word pieces; roughly 4 characters or 0.75 English words each). The model repeatedly produces a probability distribution over the next token, picks one, appends it and repeats until it emits a stop token. Your prompt plus everything it has generated so far must fit in the context window, the model's working memory for a single call.
Sampling controls shape the output. Temperature rescales the probabilities: near 0 the model almost always takes the most likely token (repeatable, good for extraction), higher values spread the choice (varied, good for brainstorming). Top-p restricts sampling to the smallest set of tokens whose probabilities add up to p. Max output tokens caps length and cost.
Even this bare setup is useful for research and drafting: summarising a paper, comparing options, outlining a document, rewriting for another audience. But the model only knows its training data, cannot look anything up unless a product wraps a search tool around it, and has a training cutoff.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Good to know: prompt, retrieve or train?
A common question is "why not just train the model on our data?" Start with the cheapest option and move up only when you need to.
- Prompt it (stages 1 and 2): give clear instructions and examples. Cheap, instant and easy to change.
- Retrieve (stage 3): look up your documents at question time. Best for facts that change or must be cited.
- Fine-tune: train the model further on your own examples to change its style, format or specialist skill. It costs more, needs good examples, and is a poor way to teach facts that keep changing.
Many real systems use prompting plus retrieval and never fine-tune.
Good to know: not just text
Many models also accept images, audio and documents (screenshots, scanned forms, voice) and some can produce them too. Every layer on this page still applies; the input simply is not only text.
Technical stack
- Models
- Hosted frontier models (OpenAI GPT family, Anthropic Claude, Google Gemini); open-weight models (Llama, Mistral, Qwen, DeepSeek).
- Access
- Chat apps, or provider REST APIs and SDKs using system / user / assistant message roles.
- Tokenizers
- BPE-style tokenizers (tiktoken, SentencePiece) to count tokens before you send them.
- Pricing unit
- Input tokens plus output tokens, billed per million; longer context costs more and is slower.
What can go wrong
Hallucination. The model produces plausible text, not verified text. It cannot reliably say what it does not know, may invent citations, and goes stale after its training cutoff. Output is free text, so software cannot depend on its shape. Results also vary between runs and between phrasings of the same question.
Stage 2 of 10 · Make it repeatable
Prompt engineering and structured outputs
Stop typing ad-hoc questions. Wrap the model in a prompt builder that always applies the same instructions, and force the answer into a machine-readable contract.
Standing instructions and a fixed answer format, so results are consistent and other systems can use them.
A little more detail
Instead of typing a fresh question each time, a prompt builder adds the same instructions every time (for example: "You are a support assistant. Be brief. Never guess.") plus a few worked examples. Getting good at this is called prompt engineering.
Then we ask for the answer in a strict format: a form with named fields, such as product, risk level and summary. This format is called a schema. A validator checks the form and asks the model to try again if it is wrong, so other software can rely on the answer.
This is also how a model will later ask for things: it fills in a form that says "please run this function with these values". That idea is the seed of tools in stage 4.
A system prompt sets role, rules, tone and constraints for every call. Few-shot examples show the model two or three input/output pairs so it imitates the pattern. Delimiters (XML tags, headings) separate instructions from untrusted input. A prompt builder fills a template with the user's task so behaviour is consistent and version-controlled.
A JSON Schema is the output contract: field names, types, enums, required keys. With structured-output features, constrained decoding masks any token that would break the schema at each step, so the output is valid by construction. Without it, you parse, validate and retry. Either way a program, not a human, consumes the result.
The function-calling format is the same idea: you describe a function with a name, description and parameter schema, and the model returns a JSON object of arguments instead of prose. Your code runs the function. That is the bridge to tool use in stage 4.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Prompt management
- Templates (Jinja2, framework prompt templates), Git-versioned prompt files, prompt registries.
- Schemas
- JSON Schema, Pydantic (Python), Zod (TypeScript).
- Libraries
- Instructor, Outlines, Guidance, framework output parsers.
- Provider features
- Structured outputs / JSON mode and tool-calling APIs from the major model providers.
- Testing
- promptfoo or a simple side-by-side script to compare prompt variants on fixed inputs.
What can go wrong
Prompts are brittle: small wording changes shift behaviour. Valid JSON can still contain wrong facts. Few-shot examples use context and can bias the answer toward the examples. Most importantly, the model still cannot answer questions about your contracts, tickets, specifications or policies, because it never saw them.
Stage 3 of 10 · Add knowledge
RAG: grounding answers in your data
Instead of hoping the model remembers the right facts, look them up at query time and put them in the prompt.
Before answering, the assistant looks up your approved documents and shows where each fact came from.
A little more detail
Setup, done once. Your documents are cut into small pieces called chunks. Each chunk is turned into a long list of numbers that captures its meaning (an embedding) and stored in a database that can search by meaning, a vector database.
When someone asks a question. The system searches for the best chunks two ways, by meaning and by exact keywords, then re-orders the top results with a second, more careful model (the reranker). The best few chunks are pasted into the prompt and the model answers using them, pointing to the source of each fact (citations).
This is called RAG (retrieval-augmented generation). It cuts down made-up answers, and you can update what the system knows by updating documents instead of retraining a model.
Ingestion (offline). Load documents, parse them, split into chunks (typically a few hundred tokens, ideally cut along headings or sections, with slight overlap), turn each chunk into an embedding vector with an embedding model, and store vector, text and metadata (source, date, access rights) in a vector database next to a BM25 keyword index.
Query (online). Embed the question, run vector search (finds paraphrases) and BM25 keyword search (finds exact terms, part numbers, IDs) in parallel, merge the lists with reciprocal rank fusion, then let a reranker (a cross-encoder that reads question and chunk together) re-score the top candidates. Enforce access rights at query time: filter the search by the caller's permissions (group or ACL metadata) so restricted chunks are never retrieved, rather than hoping the model withholds them; permissions copied into the index at ingestion go stale when someone's access changes, so re-sync them or check at the source. The best few chunks go into the prompt with the instruction to answer only from them and to cite chunk IDs.
The result is a grounded answer with citations: a reader can click through to the source, and the model is steered away from inventing facts. Hybrid search matters because vectors alone miss exact identifiers and BM25 alone misses meaning.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Parsing
- Unstructured, Docling, Apache Tika for PDFs, Office files, HTML.
- Embedding models
- OpenAI text-embedding-3, Cohere Embed, Voyage; open models such as BGE, E5, GTE.
- Vector stores
- pgvector, Qdrant, Weaviate, Milvus, Pinecone, Chroma; FAISS as a library.
- Keyword / hybrid
- Elasticsearch and OpenSearch (BM25); several vector databases offer built-in hybrid search.
- Rerankers
- Cohere Rerank, BGE reranker and other cross-encoders.
- Frameworks
- LlamaIndex, LangChain, Haystack.
What can go wrong
Retrieval quality caps answer quality. Poor chunking splits a table or separates a definition from its context; embeddings can miss domain jargon; the index goes stale; and a retrieved chunk may be one the asking user is not allowed to see. The model can still ignore or misquote the context. And RAG can only read: it cannot check an order, create a ticket or run a calculation.
Stage 4 of 10 · Add actions
Tool use: function calling, APIs, code and MCP
The model stops being a text box and becomes a decision-maker that can call your systems, with your code doing the actual work.
The assistant can request actions in your systems, such as looking up an order or creating a ticket, through controlled connections.
A little more detail
The model never touches your systems directly. It writes a request such as "call get_order_status for order 4821". Separate software, the tool executor, checks the request, carries it out and hands the result back to the model.
Typical tools: company systems (orders, customer records, tickets), databases, web search, and a code sandbox, a locked room where the model can run small programs without touching anything important.
MCP (Model Context Protocol) is a common plug standard for these tools. Think of it as USB for AI: build a connector once and many AI applications can use it.
The model never executes anything. You send it a list of tool definitions (name, description, JSON Schema for arguments). When it decides a tool is needed it returns a structured tool call instead of prose. Your executor validates the arguments, runs the function, and returns the result as a new message; the model then continues, and may call another tool or write the final answer. Retrieval from stage 3 can simply be one of the tools.
Typical tools: business APIs (look up an order, create a ticket), database queries, web search, and a code sandbox for calculations and data analysis, run in an isolated environment with no access to your network or secrets.
MCP (Model Context Protocol) is an open standard, using JSON-RPC messages, for how an AI application discovers and calls capabilities exposed by a server: tools, resources and prompt templates. Servers are reached over stdio (a local process) or Streamable HTTP (remote). You write the integration once and any MCP-capable client can reuse it, instead of rebuilding a connector per application.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Native tool calling
- OpenAI function / tool calling, Anthropic tool use, Gemini function calling.
- MCP
- Official SDKs (Python, TypeScript and others); community and vendor servers for databases, source control, chat, file systems.
- Schemas
- OpenAPI specifications converted into tool definitions.
- Sandboxes
- Docker with gVisor, Firecracker microVMs, hosted sandboxes such as E2B.
- Credentials
- OAuth with scoped tokens, secrets manager; never put secrets in prompts.
What can go wrong
Every tool is a new risk: wrong tool, wrong arguments, repeated failing calls, destructive actions, and tool output that contains injected instructions (indirect prompt injection). Treat every tool result and retrieved document as untrusted data, never as instructions: keep it apart from the system prompt, limit what the agent may do after reading untrusted content, and require approval for risky actions. And one round of calling is not enough for real tasks, which need several steps where each result changes the next decision.
Stage 5 of 10 · Add autonomy
A single agent: plan, act, observe
An agent is an LLM running in a loop with tools and state. The loop, not the model, is what turns a one-shot answer into multi-step work.
The assistant plans several steps, checks its own results and keeps going until the job is done or a limit is reached.
A little more detail
An agent repeats a cycle: think about the goal, pick an action, run it, look at the result. A small piece of ordinary code, the loop controller, runs this cycle. The model supplies the thinking; the code supplies the discipline.
The agent keeps short-term memory (the notes on its desk for this task) and may use long-term memory (a filing cabinet it can search and add to across tasks).
Every agent needs stop rules: it finished, it took too many steps, it spent too much money, or it ran out of time.
The ReAct pattern alternates reasoning and acting: the model writes a short thought, chooses an action (a tool call), the controller runs it and appends the observation, and the cycle repeats. The loop controller is ordinary code. It assembles the prompt from the goal, history and memory, calls the model, executes the chosen action, updates state and decides whether to continue.
Short-term memory is what is in the context window: recent messages, a scratchpad of intermediate results, a running summary of earlier steps (older content is trimmed or summarised so it fits). Long-term memory lives outside the model in a vector store, key-value store or database; the agent reads it through retrieval and writes to it deliberately. Checkpointing state after each step lets you pause, resume and replay a run.
Stop conditions are mandatory: the model emits a final answer, a maximum step count is hit, a token or cost budget is exhausted, a timeout expires, a repeated-action loop is detected, or a human interrupts.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Agent frameworks
- LangGraph, OpenAI Agents SDK, Claude Agent SDK, LlamaIndex agents, Microsoft Agent Framework, Google ADK.
- Patterns
- ReAct, plan-and-execute, reflection / self-critique.
- Memory stores
- Redis, Postgres, vector databases; memory libraries such as Mem0 and Letta.
- State and replay
- Framework checkpointers, durable workflow engines such as Temporal.
What can go wrong
Agents compound errors. If each step is 95% reliable, ten steps in a row succeed only about 60% of the time (0.9510 ≈ 0.60). They can loop, drift from the goal, burn budget or choose the wrong tool. A single agent with many tools and a long history becomes slow, expensive and confused.
Stage 6 of 10 · Divide the work
Multi-agent systems
When one generalist agent struggles, use an orchestrator and several specialists, each with a narrow prompt, a small toolset and its own context.
A manager assistant divides the work among specialists, and a person approves the risky steps.
A little more detail
An orchestrator breaks the goal into tasks and hands each one to a specialist agent: one that researches, one that crunches numbers, one that acts in business systems. Each has a short job description and only the tools it needs.
They share one common notebook (shared state, also called a blackboard) instead of passing long chat logs around.
Human approval gates pause the work before irreversible steps such as payments or deletions. A person says yes or no, even a day later. Use several agents only when one agent really is not enough: more agents mean more cost and more that can go wrong.
An orchestrator (supervisor) breaks the goal into subtasks and delegates them: a researcher agent that uses RAG, an analyst agent that uses the code sandbox, an operator agent that calls business APIs. A handoff transfers control, and the relevant context, from one agent to another. Smaller toolsets and shorter contexts make each worker more reliable and cheaper.
Agents coordinate through shared state (a blackboard): a structured store everyone reads from and writes to, instead of passing long transcripts that lose detail. The orchestrator merges results, resolves conflicts and decides when the goal is met.
Human-in-the-loop approval is a gate in the workflow: the system pauses before irreversible or high-impact actions (payments, deletions, external emails), when confidence is low, or when policy requires sign-off. Because state is checkpointed, the human can approve minutes or days later. Use multiple agents only when a single agent demonstrably hits a limit; each extra agent adds cost, latency and failure modes.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Frameworks
- LangGraph (graphs with interrupts), OpenAI Agents SDK (handoffs), CrewAI, Microsoft Agent Framework (with migration guides from AutoGen and Semantic Kernel), Google ADK.
- Interoperability
- MCP for tools; the Agent2Agent (A2A) protocol, hosted by the Linux Foundation, for agents talking to other agents.
- Durable execution
- Temporal, or queues such as SQS and Kafka, for retries, timeouts and long waits.
- Approval UX
- Slack or Teams approval messages, ticket queues, review dashboards.
What can go wrong
Coordination overhead appears: agents duplicate work, pass lossy summaries, disagree or bounce tasks back and forth. Cost and latency multiply, and a failure can sit in any of five agents. Worst, you can no longer judge by eyeballing a few outputs whether the system is improving or regressing. You need systematic measurement.
Stage 7 of 10 · Measure quality
Evals: tests for non-deterministic systems
Software tests assume the same input gives the same output. LLM systems do not, so you build graded test sets and score behaviour statistically.
A standard test set and scoring, so you know whether a change made the system better or worse.
A little more detail
Make a list of realistic questions with known good answers: the golden dataset. Run the system on all of them and score the results with simple checks, with another AI acting as the marker (LLM-as-judge), and with spot-checks by humans.
For systems that search documents, check two things separately: did it find the right pages, and did the answer stick to them (faithfulness)? For agents, check whether the task got done, with the right tools, at what cost.
Run these tests automatically on every change, like a safety net. After launch, keep sampling real usage and compare versions side by side (A/B tests).
A golden dataset is a versioned set of representative inputs with expected answers or grading criteria, drawn from real logs, subject-matter experts and known edge cases. Graders include programmatic checks (valid schema, correct tool called), LLM-as-judge scoring against a rubric, and human review used to calibrate the judge.
RAG metrics separate retrieval from generation: faithfulness (are the answer's claims supported by the retrieved context), answer relevancy, context precision (is the relevant material retrieved and ranked high) and context recall (was everything needed retrieved). Agent evals score task success, tool-call correctness and the trajectory: how many steps, which tools, how much cost.
Offline, the suite runs in CI on every change to a prompt, model or retriever, and blocks the merge on regression. Online, you sample production traffic, run shadow or canary releases, A/B test variants and collect user feedback.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Eval frameworks
- Ragas, DeepEval, promptfoo, TruLens, OpenAI Evals, Inspect.
- Platforms
- LangSmith, Braintrust, Arize Phoenix, Langfuse.
- Practices
- Calibrate judges against human labels, use pairwise comparison, run each case several times to see variance.
- CI gating
- Run the suite in CI (for example GitHub Actions) and fail the build below a threshold.
What can go wrong
Evals can mislead. Judge models tend to prefer longer answers and answers in their own style, small datasets hide rare failures, and a golden set drifts away from real usage. Above all, evals measure quality; they do not stop a bad answer from reaching a user live. An unsafe or leaking response is already delivered before the nightly run notices.
Stage 8 of 10 · Constrain behaviour
Guardrails and safety
Guardrails are runtime checks wrapped around the model at three points: before it sees input, before the user sees output, and before any action runs.
Safety checks on what goes in, what comes out and what actions are allowed, with a tamper-proof record.
A little more detail
Input checks hide personal data and look for attempts to trick the model, such as instructions hidden inside a document (prompt injection) or a jailbreak. Output checks verify the format, the policy and that claims match the sources.
Action checks matter most: each agent gets a short list of allowed tools and only the minimum permissions (least privilege), risky actions need human approval, and spending is capped. Everything is written to a tamper-proof log.
No single check is perfect, so we stack several (defence in depth) and assume the model can be fooled.
Input guardrails detect and mask PII, flag prompt-injection and jailbreak attempts, enforce topic scope and authenticate the caller. Output guardrails validate the schema, check toxicity and policy, check groundedness against the retrieved sources, redact secrets, and either refuse or regenerate.
Action guardrails govern tools: allow-list the tools each agent and user may use, issue least-privilege scoped credentials, default to read-only, validate arguments, require human approval for high-impact calls, restrict network egress, and apply rate limits and cost budgets. Every decision goes to an append-only audit log.
Use defence in depth, because no single filter is reliable. In particular, prompt injection cannot be solved by wording the system prompt carefully. Treat every retrieved document and tool result as untrusted data, and limit what the system can do even if the model is fooled.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Technical stack
- Guardrail frameworks
- NVIDIA NeMo Guardrails, Guardrails AI, LLM Guard.
- Safety classifiers
- Llama Guard and Prompt Guard (Meta), cloud content-safety services such as Azure AI Content Safety and Amazon Bedrock Guardrails.
- PII
- Microsoft Presidio and cloud DLP services.
- Policy and access
- OAuth scopes, Open Policy Agent for allow / deny rules, API-gateway rate limits.
- Reference
- OWASP Top 10 for LLM Applications (prompt injection is listed first).
- Audit
- Append-only logs shipped to a SIEM.
What can go wrong
Guardrails add latency and false positives (blocking legitimate requests), attackers adapt, and rules written for known failures miss new ones. When something does go wrong, or quality quietly slips, you need to see inside the system: which prompt version ran, which chunks were retrieved, which tool was called, what it cost.
Stage 9 of 10 · See inside
Observability and LLMOps
You cannot improve or govern what you cannot see. Every request becomes a trace, every change becomes a version, every failure becomes a test case.
A full record of every step, its cost and its delay, plus version control, so problems can be explained and fixed.
A little more detail
Each request becomes a trace, a timeline of its steps (the model call, the search, each tool, each safety check) with timing, inputs, outputs and cost.
Prompts, model versions and settings are versioned like software, so you can see which version produced an answer and undo a bad change.
Cost and speed are tracked per team and feature. User feedback (thumbs down, corrections) becomes new test cases, feeding back into stage 7, so the system gets better over time.
Tracing. A request is a trace; each model call, retrieval, tool call, guardrail check and agent step is a span with inputs, outputs, latency, token counts, status and a parent-child link. OpenTelemetry-style spans make a five-agent run readable, and OpenTelemetry publishes semantic conventions for generative-AI calls.
Versioning. Prompts, model versions, retriever settings and tool schemas are versioned artifacts with release and rollback, and each trace records which versions served it. Cost is tokens in and out multiplied by price per model, attributed per feature, team and user, with budgets and alerts. Latency is tracked as time to first token and total time, p50 and p95, broken down per step.
The feedback loop closes the circle: thumbs-down, user edits and escalations are triaged, failing cases are added to the golden dataset (stage 7), the fix is evaluated, then deployed, and the new version is watched in production.
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Running example
"Is part 4471 still under warranty? If not, open a service ticket."
Good to know: what drives the bill
- Volume of text: long prompts, long retrieved documents and long histories all count, in and out.
- Which model: larger models cost more per unit of text and are slower.
- Number of steps: agents and multi-agent systems make many model calls for one request.
- Retries and failures: each repeat is paid for again.
- Everything around the model: search databases, hosting for self-run models, logging storage.
Levers: shorter prompts, caching repeated answers, sending easy tasks to cheaper models, capping steps and budgets, and measuring cost per feature. Prices change often, so check current provider pricing.
Technical stack
- Instrumentation
- OpenTelemetry with its generative-AI semantic conventions (still evolving).
- LLM observability
- Langfuse, LangSmith, Arize Phoenix, Helicone, Datadog LLM Observability, Weights & Biases Weave.
- General backends
- Prometheus and Grafana, Jaeger or Tempo, the ELK stack.
- Versioning
- Git plus CI; prompt registries such as the one in MLflow.
- Cost
- Provider usage APIs and gateway metrics, tagged by feature and team.
What can go wrong
Traces contain prompts and business data, so telemetry needs its own redaction, retention and access control. Teams drown in traces without sampling and alerts. And now there are many parts, each built by a different team: gateway, identity, models, retrieval, tools, guardrails, evals, monitoring. Without a shared platform they diverge and become unmanageable.
Stage 10 of 10 · Putting it together
The enterprise AI reference architecture
The same layers, now run as a shared platform. Every component you met in stages 1 to 9 has a place, an owner and a control around it.
The same ideas run as one shared company platform with a front door, shared services and common rules, instead of many one-off projects.
A little more detail
Read the diagram top to bottom as one request travelling through. People use an app. The front door checks who they are. The agent layer does the work. The model gateway picks which AI model to use. The knowledge layer supplies documents. The tool layer talks to business systems such as ERP, CRM, PLM and ticketing.
Down the sides sit the controls: guardrails for safety, governance for policy and accountability, evals and observability for quality and visibility.
The idea is shared infrastructure. Project teams build the use cases; a platform team provides the common, safe foundations underneath them.
Read the diagram top to bottom as the request path, and the strips on the sides as the controls that apply across it. Identity and the gateway authenticate and rate-limit every caller. The orchestration layer runs agents, memory, workflows and approval gates. The LLM gateway hides model vendors behind one interface: it routes by task, cost, latency and data-residency, caches semantically similar requests, falls back when a provider fails and enforces token budgets.
The knowledge layer keeps enterprise data searchable with access rights intact (vector index, keyword index, knowledge graph for relationships). The tool layer exposes systems of record such as ERP, CRM, PLM and ticketing through MCP servers behind a policy gate. Guardrails, evals, observability and governance are cross-cutting rather than bolted on at the end.
The numbered badges mark six data paths, listed below the diagram. The point of the platform is separation of concerns: a use-case team writes prompts, tools and evals; the platform team owns the gateway, identity, guardrails, observability and cost; the governance body owns policy and risk.
Try it: follow one request through the platform
Pick a scenario, then step through it and watch which parts of the platform do the work.
Follow one request through the platform
Example: an employee asks, "Is part 4471 still under warranty? If not, open a service ticket."
- 1Front door. The employee signs in. The gateway checks who they are and what they may access. The input guard scans the question for personal data and tricks.
- 2Plan. The orchestrator works out it needs two things: the warranty facts, then a ticket.
- 3Look up. A researcher agent searches the knowledge layer, but only documents this employee is allowed to see, and finds the warranty policy and the purchase record.
- 4Think. The model gateway picks a suitable AI model for the reasoning, serves a cached answer if one is safe, or falls back to another model if one is down.
- 5Act, with approval. An operator agent prepares the ticket through the tool layer. Because it changes a system, the policy gate pauses for a human approval, which a manager gives.
- 6Check and learn. The output guard confirms the answer matches the sources, and the employee sees it with citations. Every step was traced, is logged for audit, and later feeds the evals.
The six data paths
- 1Request path. Channel → gateway (SSO, RBAC, rate limit) → input guardrails → orchestrator. The response travels back through output guardrails, schema validation and, for risky outputs, an approval gate.
- 2Reasoning path. Orchestrator and worker agents call the LLM gateway, which picks a model by task, cost, latency and residency, serves cached answers where safe, and falls back on failure.
- 3Retrieval path. Agents query the knowledge layer: hybrid search over the vector and keyword index plus the knowledge graph, filtered by the caller's permissions, then reranked.
- 4Action path. Tool calls go through the MCP gateway and a policy check (allow-list, scoped credentials, approval) to systems of record: ERP, CRM, PLM, ticketing.
- 5Ingestion path. Offline: connectors and ETL stream data from systems of record into chunking, embedding and the indexes, carrying access-control metadata.
- 6Control path. Spans, costs and feedback flow to observability and evals; governance sets policy, owns the registry and reviews the audit trail.
Technical stack
- Gateway and identity
- Kong, Apigee, Azure API Management, AWS API Gateway; Okta, Microsoft Entra ID, Keycloak (OIDC, SAML, SCIM).
- LLM gateway and routing
- LiteLLM, Portkey, Kong AI Gateway, or cloud platforms such as Amazon Bedrock, Azure AI Foundry and Google Vertex AI.
- Model serving
- vLLM, NVIDIA NIM and Triton, Hugging Face TGI for self-hosted models.
- Data and knowledge
- Kafka, Airflow, dbt, Snowflake or Databricks; Neo4j or similar for the knowledge graph.
- Orchestration
- LangGraph or Temporal on Kubernetes; MCP gateway for tools.
- Governance
- NIST AI Risk Management Framework, ISO/IEC 42001, the EU AI Act (applying in phases from 2025 to 2028), a model registry and a risk register.
- Infrastructure
- Kubernetes, GPU clusters, Vault or cloud KMS, private networking, infrastructure as code (Terraform).
What can go wrong
Typical failure modes are platform sprawl, unclear ownership, runaway token cost, vendor lock-in, and governance that exists as paperwork rather than enforced controls. The most common mistake is building the whole picture before one use case works.
Recap
What each layer adds, and what it leaves open
| Stage | Adds | Solves | Leaves open |
|---|---|---|---|
| 1 | Prompt in, text out | Nothing; only the model | Hallucination, free-form output |
| 2 | System prompt, few-shot, JSON schema, validator | Inconsistent, unparseable output | No access to private knowledge |
| 3 | Ingestion, embeddings, hybrid search, reranker, citations | Missing or stale knowledge | Read-only; no actions |
| 4 | Function calling, executor, MCP, code sandbox | Cannot act on systems | Single calls, no multi-step planning |
| 5 | Loop controller, memory, state, stop conditions | One-shot reasoning | Error compounding, overloaded generalist |
| 6 | Orchestrator, workers, shared state, human approval | Overloaded single agent | Cannot tell if it is improving |
| 7 | Golden sets, LLM-as-judge, RAG and agent metrics, CI gate | No quality measurement | Does not stop bad output at runtime |
| 8 | Input, output and action guardrails; audit log | Unsafe inputs, outputs and actions | Opaque system, hard to debug |
| 9 | Tracing, versioning, cost, latency, feedback loop | No visibility or rollback | Fragmented, ungoverned components |
| 10 | Gateway, identity, LLM router, governance, platform | Component sprawl | Organisational adoption |
References
Sources and further reading
Product and framework names on this page are examples of representative technology, not endorsements or a complete list. Facts about protocols, standards and frameworks were last reviewed against the pages below on 3 October 2026. This field changes quickly and the page does not re-check itself, so confirm against current documentation before you decide.
Foundations and papers
- ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al.)
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al.)
Protocols
- Introducing the Model Context Protocol (Anthropic, November 2024)
- MCP specification: transports (stdio and Streamable HTTP; JSON-RPC messages)
- Linux Foundation launches the Agent2Agent protocol project
- OpenTelemetry semantic conventions for generative AI
Security, risk and regulation
- OWASP Top 10 for LLM Applications (prompt injection is LLM01 in the 2025 list)
- NIST AI Risk Management Framework (Govern, Map, Measure, Manage)
- ISO/IEC 42001: AI management system standard
- European Commission: the EU AI Act and its phased application dates