# What an agent is made of

> The parts that turn a language model into an agent that can do real work.

By Soufiane El Hamri. Published 2026-11-26, updated 2026-11-26. Source: https://www.soufiane-elhamri.com/blogs/what-an-agent-is-made-of

A language model can only write text, so on its own it can't act. An agent is the full system built around the model to let it act. The model, tools, memory, planning and reflection run together in one loop: the agent decides, acts, checks the result and decides again until a stop rule says the task is done.

Tools are how the agent acts. A tool has two parts: a description the model reads, with its name, job and inputs, and code that only your program runs. The model never sees the code. It asks for a tool in text, your program runs it, and the result goes back. Since the model knows a tool only by its description, an unclear name or input causes most mistakes. Every description also stays in the context, so keep few tools, each with one job.

Before MCP, each app connected tools differently. MCP is an open standard, like a USB port. A service like Slack offers its tools once through an MCP server. An app like Claude or Cursor is the MCP client: it shows the model the server's tools and has the server run the one it picks. Any client can use any server.

Tools and MCP let the agent act but don't say how you want the work done. A skill holds those instructions for one kind of task, like how your team writes tests. It loads in levels: only its name and description stay in the context, and the full instructions load when a task needs them.

The context has a size limit, so your documents won't fit, and models miss facts in the middle of a long context. RAG keeps the documents outside. It cuts them into pieces and turns each one into numbers that stand for its meaning, so "sofa" and "couch" end up close. For each question, it finds the closest pieces and gives only those to the model.

RAG has two weak spots, and both matter because the context has limited space. An unrelated piece can mislead the model, and a repeated piece takes space a useful one needs. First, the search returns pieces that look like the question, even when they don't help answer it. A re-ranker reads the question and each piece together, so it can tell which pieces really help. It's slow, so it only checks the first 20 or so pieces the search found. Second, two pieces can say the same thing, because documents often copy the same sources. MMR picks pieces one by one. It prefers pieces that match the question and skips any that repeat one already picked.

The conversation fills the context too. A model forgets everything after each answer, so the app resends the whole chat on every call. Old messages can move to a database and return when needed, which loses nothing, or become a summary, which is smaller but loses detail. Long-term memory keeps three things after the session ends: facts, like help articles; past events, like a short summary of each chat; and how to do things, like the system prompt and skills. A step in the loop decides what is worth keeping.

Planning and reflection guide how the agent thinks. On a long task, an agent without a plan loses its goal halfway. Planning breaks the goal into small steps. A full plan up front is cheaper but can't adapt. Planning one step at a time handles surprises better but calls the model more often.

A plan can still be wrong, so reflection checks the work before the agent says it is done. If the check fails, the agent writes a short note on what went wrong, then tries again with that note in mind. Every try costs time and money, because the model rereads all the steps so far. So set a limit, like three to five tries.

The rule that matters most is to check against something real. A model grading itself with nothing to compare against often doesn't improve, and can turn a right answer into a wrong one. A failed test or an error message gives it proof. Put those checks in the loop, and have a person approve anything that can't be undone, like deleting data.
