AI agents
The agentic AI tech stack: six layers, and the three that decide whether it works
The model gets the attention, but the layers around it decide whether an agent can be trusted with real work.
What is in an agentic AI tech stack?
An agentic AI tech stack has six layers: a language model, an orchestration loop that decides the next step, tools the agent can call, retrieval and memory for context, guardrails and permissions, and observability with evaluation. The model is the easiest part to swap. Tools, permissions and evaluation decide whether it works in production.
The short version
- An agentic AI tech stack has six layers: a model, orchestration, tools, retrieval and memory, guardrails and permissions, and observability with evaluation.
- The model is the easiest layer to replace, so choose it last, by testing it against an evaluation set of real tasks.
- A framework is optional. A single agent with a few tools can run on a short loop in your own code.
- An agent should act with the permissions of the person it works for, never through a shared account with wider access.
- Without traces and an evaluation set, nobody can tell whether a change to a prompt, tool or model made the agent better or worse.
What are the layers of an agentic AI tech stack?
An agentic AI tech stack has six layers. A language model reasons about the task. An orchestration loop decides the next step and keeps track of state. Tools let the agent read from and write to other systems. Retrieval and memory supply context the model does not have. Guardrails and permissions limit what it can do. Observability and evaluation tell you whether any of it works.
Underneath sits ordinary software: hosting, a queue, a database, secrets management and deployment. None of that is specific to agents, and putting an agent on top does not make any of it optional.
The layers do not take equal effort. If the rest of the stack is built well, the model sits behind one interface and can be swapped quickly. The tools, the permissions and the evaluation set are where the engineering time goes, because they encode how your business actually works.
What does each layer of an agentic AI stack do?
| Layer | What it does | Example choices | What usually goes wrong |
|---|---|---|---|
| Model | Reads the context and decides what to say or which tool to call | Hosted models from Anthropic, OpenAI or Google; open-weight models you serve yourself | Chosen first, on reputation, before there is a test to choose it by |
| Orchestration | Runs the loop of reasoning, tool calls and results; holds state; enforces limits on steps and cost | A plain loop in your own code; LangGraph; a model provider's agent SDK | No step limit, so a confused agent keeps looping until the budget runs out |
| Tools | Lets the agent read from and write to other systems | Function calling against your own APIs; Model Context Protocol (MCP) servers | Vague tool descriptions, and error messages the model cannot act on |
| Retrieval and memory | Supplies documents, records and earlier context the model does not have | Postgres with pgvector, a dedicated vector database, keyword search, a session store | Stale or over-broad content, and permissions lost at indexing |
| Guardrails and permissions | Limits what the agent can see and do, and decides when a human must approve | Scoped credentials for each user, approval queues, input and output checks | A shared service account with more access than any single user has |
| Observability and evaluation | Records every step and tests each change against known cases | OpenTelemetry traces, Langfuse, LangSmith, a versioned evaluation set | Added after launch, so nobody can say whether a change helped |
Which model should an agentic AI stack use?
Use the model that passes your evaluation set at a cost per task you can accept. That sounds circular, and it is meant to. You cannot choose a model well until you have real tasks to test it against, so the model is the last layer to commit to, not the first.
Agentic work asks more of a model than chat does. It has to pick the right tool from several, fill in the arguments correctly, read the result and judge whether the task is finished. A model that writes fluent answers can still be poor at this, and the only way to find out is to run it on your own tasks.
A stack can use more than one model: a capable one for planning and difficult steps, and a cheaper, faster one for routing, classification or extraction. Keep every model behind a thin interface in your own code, so that changing one is a configuration change. Prices and rankings move quickly, and a stack tied to one provider pays for it later.
Do you need a framework to build an AI agent?
Not always. At its core an agent is a short loop. Send the conversation and the tool definitions to the model, run any tool it asks for, add the result, and repeat until it gives a final answer or hits a limit. For one agent with a handful of tools, that loop in your own code is often enough, and you can read every line of it.
A framework earns its place when runs get long or get interrupted. If a run takes minutes, waits for a person to approve a step, or has to survive a server restart halfway through, you need durable state, retries and a way to pause and resume. Frameworks such as LangGraph, and the agent SDKs that model providers publish, supply those pieces. You can write them yourself, but that is rarely the best use of the time.
Whatever you choose, three limits belong in this layer: a maximum number of steps, a timeout, and a spending cap for each run. An agent that misreads a tool result can call the same tool again and again, and without limits nothing stops it.
In a multi-agent design, several agents hand work to each other, which adds a coordination problem on top of everything else. Start with one agent. Split it only when one agent's instructions and tools no longer fit together cleanly.
How does an AI agent connect to tools and data?
Through tool definitions. Each tool has a name, a description and an input schema. The model reads them, decides to call one and writes the arguments. Your application runs the call and passes the result back, not the model. The model never touches your systems directly.
The Model Context Protocol (MCP) gives that connection a standard shape, so a tool written once as an MCP server works with any client that speaks the protocol. Anthropic created MCP. On 9 December 2025 it donated the protocol to the newly established Agentic AI Foundation, so a foundation now holds it, not a single vendor.
Anthropic also published its own count of active public MCP servers at the time, without saying how it counted them. Whatever the true number, a public MCP server is third-party code that runs with whatever credentials you give it. Review it as you would any dependency with access to production data, or write your own.
How good the tools are matters more than which protocol carries them. Narrow tools with clear descriptions get called correctly. Write operations should be idempotent, so that a retry does not send the same refund twice. Errors should tell the model what to do next. 'Customer not found, check the ID format' lets it recover. A bare 'error 500' leaves it guessing.
What do retrieval and memory add to an AI agent?
They give the model context it was not trained on: your documents, your records and what happened earlier in the task. Retrieval searches your content and returns the relevant passages. Memory carries state, either within a single run or across sessions.
In an agentic stack, retrieval can be a tool the agent calls when it needs it, instead of a search that runs before every answer. The agent can then search, read the results and search again with a better query. A single fixed search cannot do that.
Treat long-term memory with care. Facts an agent saves about a user go out of date. If they are stored under the wrong key they can leak into another user's session. They also become data you have to manage and delete on request. Store less than you think you need.
Both depend on permissions. If the index does not know who may read each document, the agent can retrieve content for a user who could never open it. Check permissions before the search, not after.
Where do guardrails and permissions fit in an agentic AI stack?
Around every tool call, not just the final answer. The agent should act with the identity and permissions of the person it is working for, so it can never see or change more than that person could.
In practice that means credentials scoped to each user instead of one service account, read tools kept separate from write tools, and a human approval step before anything irreversible, such as issuing a refund, emailing a customer or deleting a record. You can relax approval later, once the traces show the agent gets that action right.
Treat everything the agent reads as untrusted. A retrieved document, a web page or a tool result can contain instructions, and the model may follow them. This is called prompt injection, and you cannot rely on filtering it out of the input. The defence is to limit what a misled agent is able to do. That is a question of permissions, not of prompts.
How do you know whether an AI agent is working?
You trace every run and test every change against an evaluation set. A trace records each model call and tool call, with its inputs, outputs, latency and cost. An evaluation set is a collection of real tasks with known good outcomes. You run it again whenever a prompt, a tool or a model changes.
Judge the path as well as the result. An agent can reach the right answer by luck, or by calling five tools where two would do. Check that it chose the right tools, passed sensible arguments and stopped when it should have.
Track cost per completed task, not cost per call. An agent makes several model calls for each task, so a cheaper model that needs more steps can cost more overall.
Build this layer first, not last. Without it, every model upgrade or prompt edit is a guess, and you hear that it was a bad one from a user.
When is an agentic AI stack not worth building?
When the steps are known in advance. If you can draw the process as a fixed flowchart, a set workflow that uses a model for individual steps will be cheaper, faster and easier to test than an agent that chooses its own route.
A full agentic AI technology stack earns its complexity when each step depends on what the last one returned. Investigating a support ticket, reconciling records that disagree and researching across several sources all fit. Document extraction, routing and form filling usually do not.
In what order should you build an agentic AI stack?
- Write down the task and what a correct outcome looks like.
- Collect a few dozen real examples to use as the evaluation set.
- Connect one model to one or two read-only tools with a plain loop, with tracing on from the first run.
- Run the evaluation set and compare models on pass rate and cost per completed task.
- Add permissions and human approval before any write action reaches production.
- Add retrieval, long-term memory or a framework only when a failing test shows you need it.
Questions people ask
Do you need LangChain or another framework to build an agentic AI stack?
No. A single agent with a few tools can run on a short loop in your own code: call the model, run the tool it asks for, return the result, repeat. Frameworks help when runs are long, pause for human approval or must survive restarts, because they provide durable state and retries. Adopt one when you hit those needs, not before.
What is the difference between an agentic AI stack and a RAG stack?
A RAG stack retrieves relevant content and answers in a single pass. An agentic stack runs a loop. It decides what to do, calls tools, reads the results and decides again, and it can take actions in other systems. Retrieval often becomes one tool inside the agentic stack. The extra layers are orchestration, tools that can write, and the guardrails those tools need.
Do we need the Model Context Protocol?
Not necessarily. MCP helps when the same tools must work across several clients, or when you want to use existing MCP servers instead of writing your own integrations. For one application calling a few of your own APIs, ordinary function calling is simpler and has one less moving part. If you do use public MCP servers, review them as you would any third-party code.
How much does an agentic AI stack cost to run?
It depends on how many steps a task takes, how many tokens each step uses and which model handles each step, so nobody can give an honest figure in advance. Measure cost per completed task on your evaluation set before launch. Set a hard spending cap for each run, because an agent stuck in a loop can multiply costs before anyone notices.
Can an agentic AI stack run entirely on our own infrastructure?
Yes. Open-weight models can run on your own hardware or private cloud, and you can self-host orchestration, retrieval and tracing too. There are two trade-offs. You take on the operational work of serving models, and you need to test whether an open-weight model handles your tool-calling tasks well enough. Run the evaluation set before you decide.
Related on this site
Sources
- 2025: The State of Generative AI in the Enterprise | Menlo Ventures, Survey of 495 U.S. enterprise AI decision-makers, run with an independent research firm, November 7-25, 2025 · Menlo Ventures, data from 2025
- State of Agent Engineering, Public online survey of 1,340 engineers, product managers and business leaders, November 18 to December 2, 2025. Respondents came mostly from the LangChain user community. · LangChain, data from 2025
- State of Agent Engineering, Public online survey of 1,340 engineers, product managers and business leaders, November 18 to December 2, 2025. Respondents came mostly from the LangChain user community. · LangChain, data from 2025
- Large Firms With at Least 20 Employees Biggest AI Users, Business Trends and Outlook Survey (BTOS), a nationally representative survey of U.S. businesses run every two weeks. Data collected December 14, 2025 to May 3, 2026. · U.S. Census Bureau, data from 2025-2026
- Small Business Use of AI Surges, Driving Daily Efficiency | U.S. Chamber of Commerce, Nationwide survey of U.S. small businesses, run by Teneo Research for C_TEC and published August 18, 2025. Small businesses report their own use. · U.S. Chamber of Commerce Technology Engagement Center (C_TEC), data from 2025
- Donating the Model Context Protocol and establishing the Agentic AI Foundation, Anthropic's own count of active public MCP servers, stated when it donated the protocol on December 9, 2025. The counting method is not disclosed. · Anthropic, data from 2025