The word "agent" gets applied to a wide range of AI systems right now, from simple chatbots with a search button to fully autonomous software that can browse the web, write code, and manage files without human input. This range makes the term nearly meaningless — until you understand the underlying structure.
Every genuine AI agent, regardless of what it does or how sophisticated it is, is built from three components: a large language model that reasons about what to do, an agent loop written in conventional code that drives the process forward, and a set of tools the agent can call to interact with the world. Understanding each piece — and how they connect — gives you a clear mental model for evaluating any AI agent you encounter or build.
The LLM: The Reasoning Engine
The large language model is the brain of the agent. It's the component that reads the current situation, thinks through what needs to happen, and decides what action to take next.
What makes modern LLMs useful for agents isn't just their knowledge — it's their ability to follow complex instructions, reason through multi-step problems, and produce structured output that other software can act on. When an agent is deciding what to do next, the LLM is given a description of the goal, the history of what's happened so far, and a list of available tools. It responds not just with text for the user, but with a decision: call this tool with these inputs.
The LLM doesn't remember previous conversations on its own — it works entirely from the context window it's given at each step. This means the agent loop is responsible for feeding it the right information at each turn. The LLM is stateless; the loop provides the state.
The LLM doesn't execute anything. It reads, reasons, and responds. Every actual action in the world is taken by the code around it.
This is an important distinction. The LLM is a reasoning engine, not an executor. It can't directly read a file, send an email, or query a database. It can only produce text — including text that says "run this function." Acting on that output is the job of the loop and the tools.
The Agent Loop: Conventional Code Driving the Process
The agent loop is where most people's mental model of AI agents breaks down. It's easy to assume that the LLM is doing everything — but the loop is written in ordinary software, running on ordinary infrastructure, with the full capabilities and reliability that implies.
A basic agent loop looks like this:
- Assemble context. Gather the user's goal, conversation history, available tools, and any relevant data. Format it all as a prompt.
- Call the LLM. Send the prompt to the model and wait for a response.
- Inspect the response. Did the LLM call a tool? Did it produce a final answer? Did it ask for clarification?
- If a tool was called, execute it. Run the tool, capture the result, and add it to the context.
- If no final answer yet, loop back to step 1. Feed the tool result back in and let the LLM decide what to do next.
- Return the final answer to the user.
That's it. The loop is the scaffold. It handles state, manages the conversation history, executes tool calls, enforces safety checks, handles errors, and decides when the task is done. Everything the LLM can't do — which is most of the work — is done here.
search_documentation with query "torque spec bearing B-44".write_maintenance_log with asset ID and spec value.Because the loop is conventional code, it can enforce rules the LLM can't reliably enforce on its own. You can require human approval before any write operation. You can limit which tools are available based on the user's role. You can catch errors from tool calls and decide whether to retry or abort. The loop is where policy lives.
Tools: How the Agent Interacts with the World
Tools are functions that the agent loop can call on the LLM's instruction. They're what transform an agent from a sophisticated text generator into a system that can actually do things.
A tool is defined by three things: its name, a description of what it does (written in plain language so the LLM can understand when to use it), and its input schema. The LLM is given a list of available tools at each step and can invoke any of them by producing a structured response specifying the tool name and arguments.
Tools can do essentially anything a function can do:
- Read data — search documentation, query a database, look up a record, read a file
- Write data — update a record, log an entry, create a ticket, send a notification
- Call external systems — hit an API, trigger a workflow, post to a service
- Gather context — get the current date and time, look up user permissions, fetch asset metadata
- Call other agents — delegate a subtask to a specialized agent with its own loop and tools
The quality of an agent is largely determined by the quality of its tools. A well-designed tool has a clear, specific purpose; a description that accurately conveys when to use it; and reliable, predictable behavior. An agent with vague or unreliable tools will produce vague and unreliable results, regardless of how good the underlying LLM is.
Tools are also the main surface where trust and safety are enforced. A tool that writes to a database can require authentication. A tool that sends emails can be scoped to a specific domain. A tool that modifies critical systems can require a human confirmation step before executing. The LLM decides to call the tool; the tool itself decides whether to comply.
How the Three Components Work Together
The power of an AI agent comes from the combination. The LLM provides reasoning that no conventional code can replicate — the ability to interpret ambiguous instructions, synthesize information from multiple sources, and make judgment calls in situations that weren't anticipated at build time. The loop provides the reliability, structure, and control that the LLM can't provide on its own. The tools provide grounding in reality — real data, real systems, real actions.
Remove any one component and you don't have an agent. An LLM without a loop and tools is a chatbot — useful for answering questions, limited in what it can accomplish. A loop without an LLM is a script — deterministic, but brittle in the face of variation. Tools without an agent to drive them are just functions, waiting to be called.
The interplay between these components is also what determines an agent's failure modes. If the LLM makes a bad decision, the loop can catch it and ask for clarification. If a tool call fails, the loop can retry or route around it. If the task turns out to be impossible with the available tools, the LLM can say so rather than hallucinating a result. A well-built agent is more robust than any one component suggests because each component compensates for the limitations of the others.
What This Means for Building Agents
Understanding this architecture is practical, not just theoretical. When an agent behaves unexpectedly, the three-component model tells you where to look:
- If the agent is making wrong decisions about what to do next, the issue is usually in the prompt — the instructions and context the loop is feeding the LLM. Better system prompts, clearer tool descriptions, and more relevant context in the conversation history will fix most reasoning failures.
- If the agent is doing the right thing but failing to complete it, the issue is usually in the tools — they're returning errors, producing unexpected output, or covering cases the LLM doesn't know about.
- If the agent is getting stuck in loops or losing track of progress, the issue is in the loop design — how state is managed, how completion is detected, how errors are handled.
Most of the engineering work in building a useful agent is not in the LLM — modern models are capable enough for most tasks. It's in designing a clean loop and a well-defined set of tools, and in writing system prompts that give the LLM accurate information about what it can and can't do.
If you're exploring how AI agents could work within your operations — whether for field service, documentation access, or internal workflows — we'd like to hear about your use case. The architecture described here is the foundation of every agent we build.