Beyond the hype: a working definition, the agent loop, and the four building blocks.
Agents Module 1
In 2026 vendor decks, the word agent means at least five different things — sometimes all on the same slide.
We need a usable definition before we can pick a framework — every framework optimises for a different point on this spectrum.
An LLM agent is a program whose control flow is driven by an LLM's output: the LLM picks what step to take next, the runtime executes it, and the result is fed back to the LLM.
Contrast with three things that are not agents under this definition:
Every agent — in every framework — is some elaboration of this shape:
+-------------------+
| build prompt |
| (sys + history) |
+---------+---------+
|
v
+-------------------+
+----> | call the LLM |
| +---------+---------+
| |
| action? | final answer?
| |
| +----------+----------+
| | |
| v v
| +------+ +-----------+
| | tool | | return |
| +--+---+ +-----------+
| |
| v
| +--------+
+--+observe|
+--------+
Loop body: prompt → LLM → tool call → observation. Exit: the LLM emits a final answer (or a stop condition fires).
Picks the next step. The “brain” of the agent — usually a single LLM behind an API.
What the agent can do. Functions with schemas the LLM can call by name.
What the agent knows so far. Conversation history plus any scratchpad or external store.
Wires the three together. Drives the loop forward until a stop condition fires.
Three named patterns you'll meet in papers and framework docs:
The LLM doesn't run tools — it asks the runtime to. A tool call is just a structured block in the model's output:
# Pseudocode: LLM emits a structured tool-call block
{"name": "search", "input": {"query": "rust async runtimes 2026"}}
The runtime parses the block, dispatches the function call, captures the result, and feeds it back to the LLM as the next observation. The LLM never touches the network, the disk, or your database — your code does.
The conversation messages sent to the LLM on every turn: system prompt, user turns, assistant turns, tool results.
The LLM sees these by default. Cheap and immediate, but bounded by the context window.
Anything the agent has to fetch: a vector DB, a structured store, files on disk.
The LLM only sees long-term memory when a tool reads it — treat it as an external system you query, not as state you assume.
Most production agents need both.
Every agent needs all four of these. Missing one is a runaway-cost bug waiting to happen.
stop_reason == "end_turn").The most common 2026 incident: a developer relied solely on the natural exit. The LLM kept emitting tool calls. The cost ran for hours before anyone noticed.
The steps are known in advance.
Example: “Summarise this document.” Input → OCR → LLM → summary → out.
Cheaper, more predictable, easier to test. The LLM is one node, not the driver.
The steps depend on intermediate results.
Example: “Answer this question — search, read, decide if you have enough, repeat.”
More flexible, harder to bound cost, needs explicit stop conditions.
If you don't need LLM-driven control flow, don't reach for an agent. Pipelines are usually the right tool.
By the end you'll know which framework to reach for — and when the answer is none of them.