What is inside an AI agent
AI agents come with a lot of vocabulary, and the words are often used loosely. Here is what each piece means, in the order you meet them when you open one up.
LLM: the model
A large language model (LLM) is the engine. It reads text and predicts what comes next, which is how it answers questions, summarises documents and writes code. On its own it only produces text: it cannot open a file, run a command or remember yesterday’s conversation. What it knows comes from training, and from whatever you put in front of it right now.
Harness and the agentic loop
The harness is everything wrapped around the model: the instructions it starts with, the tools it may call, the permissions it has, and the code that actually runs those calls. Claude Code and Codex are harnesses. The same model can behave quite differently inside different ones.
The harness is what lets a model act, and the agentic loop is how it acts. The model reads the context and picks the next step, which is either an answer or a tool call. The harness runs the tool and puts the result back into the context, and the model decides again. This repeats until the task is done or someone stops it.
AI agent
An AI agent is the combination: a model running inside a harness, using the loop and its tools to pursue a goal. That is why “agent” says more about the system than about the model. Two agents built on the same model can be very different, depending on the tools they have and the rules they follow.
MCP and RAG: tools and knowledge
Tools and knowledge are the two things an agent most often needs more of. The Model Context Protocol (MCP) is an open standard for connecting an AI application to tools and data through small servers. An MCP server for a ticket tracker, a browser or a design file can work with any app that speaks the protocol, so the connection is built once.
Retrieval-augmented generation (RAG) is about knowledge. Before the model answers, the system searches your documents, finds the relevant passages and adds them to the prompt. The answer then rests on your material instead of the model’s memory. The two solve different problems and combine well: an agent can reach a tool through MCP and a document store through RAG.
LangChain: a toolkit
LangChain is an open-source framework for building applications around LLMs. It offers ready-made pieces such as prompt templates, model wrappers, retrievers, tools and agents, so you do not write the same plumbing for every project. It is a way to build the parts above rather than another part of the picture. You can build an agent without it, and many people do.
Summary: the whole picture
In one line: an agent is an LLM inside a harness, running a loop with tools. MCP and RAG feed it tools and knowledge, and LangChain is one way to build it.
| Term | What it is | For example |
|---|---|---|
| LLM | The model that predicts text | Claude, GPT |
| Harness | The runtime around the model: prompt, tools, permissions | Claude Code, Codex |
| Agentic loop | Think, call a tool, read the result, repeat | Fixing a failing test step by step |
| AI agent | LLM, harness, tools and loop pursuing a goal | A coding agent working on a ticket |
| MCP | A standard way to connect tools and data | Servers for Jira, a browser, Figma |
| RAG | Search your documents, add them to the prompt | Answering from a company wiki |
| LangChain | A framework for building LLM applications | Prompt templates, retrievers |
Working on something similar? Let's talk