Agents, loops, and the words around them

The vocabulary of modern AI agent systems — harnesses, hooks, graphs, and everything else that turns a model into something that acts — with the shape it makes on paper.

Model / reasoning step Tool / external system Data / context
1

Agent fundamentals

What an agent actually is, structurally — the model, the loop wrapped around it, and what goes into that first message.

TermWhat it isShape
AgentLLM in a loop, with tools

A model wrapped in a loop that can call tools, observe the results, and decide its next action — not one prompt-to-text call, but a running process that decides what to do next. The line between "agent" and "workflow" is how much the model itself decides the next step.

model tool A tool B the agent
HarnessAgent runtime, scaffold

The program running the loop around the model: it sends the prompt, parses tool calls out of the response, executes them, feeds results back, and decides when to stop. Claude Code, an IDE plugin, a CLI — all harnesses. The model provides judgment; the harness provides the loop, the tools, and the guardrails around both.

harness model tools policies everything around the model that isn't the model
System promptInstructions, preamble

The instructions the harness prepends before the conversation starts — persona, rules, available tools, output format. Set once per session, invisible to the end user, and treated by the model as higher-authority than user turns. Not a magic override — a strong user instruction can still contradict it in the model's eyes.

system: rules, tools, persona user: turn 1 assistant: turn 1
Tool useFunction calling

The model outputs a structured request — a function name and arguments — instead of prose, and the harness executes it and returns the result as a new message. This is what turns a text generator into something that can act. The model never runs the tool itself; it only ever asks for it to be run.

model get_weather(city="Porto") executed by the harness
2

Control flow patterns

How control actually flows through a system, from a flat pipeline to a full graph with branches and cycles.

TermWhat it isShape
Agentic loopThink–act–observe loop

The core control structure: the model reasons about what to do, calls a tool, sees the result, and repeats — with no fixed number of steps — until it decides the task is done or a stop condition is hit. Unbounded by design. Real harnesses cap it with a max-iterations or budget guard.

think act observe stop condition met
GraphState graph, workflow graph

A control flow expressed as nodes (a call to the model, a tool, a check) and edges (which node runs next), often with conditional branches and cycles. LangGraph and similar frameworks compile agents this way instead of a single implicit loop. Trades the loop's flexibility for explicit, inspectable, resumable control flow.

start classify path A path B
ChainPipeline

A fixed sequence of steps — prompt A, then prompt B on its output, then a parser — with no branching and no loop. The simplest control flow, and often all a task needs. If you're not sure whether you need an agent, you probably need a chain.

summarize translate format no branches, no loop
Planner–executorPlan-and-execute

One call produces a multi-step plan up front; a separate loop — often a simpler, cheaper one — executes each step and only calls back to the planner if a step fails or the plan needs revising. Cuts planning cost: you pay for one expensive reasoning pass, not one per step.

planner 1. fetch data 2. transform 3. report go
RouterIntent classifier, dispatcher

A cheap first step that classifies the incoming request and sends it to the right specialized prompt, tool set, or sub-agent — instead of one generalist prompt handling everything. Usually the highest-leverage place to put a small, fast, cheap model.

request router billing agent support agent sales agent
3

Context & memory

What the model can actually see at any given moment, and how that changes across turns and sessions.

TermWhat it isShape
Context windowContext length

The total tokens the model can attend to in one call — system prompt, conversation history, tool results, everything — all competing for the same fixed budget. Bigger isn't free: relevant information buried in a huge context is still easy for the model to under-weight.

system conversation tool output one fixed budget, shared by all of it
Context engineeringWhat goes in the window

Deliberately deciding what to put into the context window and in what order — which files, which past turns, which tool results, summarized or verbatim — since the model can only act on what's actually there. The successor to "prompt engineering" once the hard part became curation, not phrasing.

candidates ? what the model sees
RAGRetrieval-Augmented Generation

Fetching relevant documents from an external store — usually by vector or keyword search — and inserting them into the context before generating an answer, grounding the model in facts it wasn't trained on. Only as good as the retrieval step: a great model on bad search results still answers wrong.

query index doc 1 doc 2 → into context
MemoryShort-term vs long-term

Short-term memory is just the current context window. Long-term memory is state written to external storage — a file, a database row, a vector store — deliberately saved and re-loaded across sessions. A model has no memory of its own; every "memory" is something the harness chose to persist and re-inject.

this session gone when it ends save durable store re-loaded next time
Prompt cachingKV cache reuse

Reusing the model's internal computation for a prefix of the input that hasn't changed since the last call, so a long, stable system prompt or tool schema doesn't get reprocessed — and re-paid for — on every turn. Put stable content (system prompt, tool defs) first and volatile content (the latest user turn) last, so the prefix actually stays stable.

stable prefix — cached new turn — computed only the tail costs full price
4

Tools & environment

How an agent reaches out of the conversation and into the world — and how that reach gets contained.

TermWhat it isShape
ToolFunction

A named capability the harness exposes to the model with a schema — a description and typed parameters — that the model can invoke by name. Search the web, read a file, run SQL: each is one tool. The description in the schema matters as much as the code — it's the model's only way of knowing when to reach for it.

search_web "Search the public internet for a query" query: string, max_results: int
MCPModel Context Protocol

An open standard for exposing tools, data sources and prompts to any compatible agent over a common protocol, so a server built once — a database connector, a search API — plugs into many different harnesses without custom glue code. Think of it as a USB-C port for tools: one interface, many devices on either side.

agent A agent B MCP files database
HooksLifecycle callbacks

Code the harness runs at fixed points in the loop — before a tool executes, after the model responds, when a session starts — independent of the model's own reasoning. Used to enforce policy, log, or block an action outright. Deterministic where the model is not: a hook always runs, whether or not the model "remembers" the rule.

model call hook tool runs deterministic checkpoint, not a model decision
SandboxIsolated execution environment

A restricted environment — a container, a VM, a scoped filesystem — where an agent's actions (running code, writing files) are contained, so a mistaken or adversarial action can't reach the host system. The blast-radius question to ask before granting any tool: what's the worst this can do inside the box?

sandbox agent fs host blocked
Computer useGUI agent

An agent that operates a real user interface — moving a cursor, clicking, typing, reading the screen — instead of calling structured APIs, for the many tasks that only exist as a GUI. Slower and less reliable than an API call; reach for it only when no API exists.

agent click(120, 55)
5

Multi-agent systems

Patterns for splitting one big task across several agents instead of asking one to do everything.

TermWhat it isShape
Orchestrator+ sub-agents

One agent (the orchestrator) breaks a task apart and delegates pieces to other agents (sub-agents), each with a narrower scope, then assembles their results. The orchestrator never does the work itself. Give sub-agents fresh, minimal context — don't just hand them the orchestrator's whole history.

orchestrator sub-agent sub-agent sub-agent
Multi-agent systemAgent swarm

Several agents working on the same problem, each with its own context, role and sometimes its own model, communicating through messages, a shared document, or a coordinator — instead of one agent doing everything. Adds coordination overhead and cost; only worth it when the roles genuinely benefit from separate context.

researcher writer critic
HandoffAgent transfer

One agent explicitly passes control of the conversation to another, along with enough context to continue, instead of calling it as a sub-routine and waiting for a return value. The receiving agent takes over fully. Different from delegation: a handoff doesn't come back to the first agent unless handed off again.

triage agent + context billing agent control doesn't return
Blackboard patternShared workspace

Multiple agents read and write to one shared piece of state — a document, a scratchpad — instead of messaging each other directly, each contributing when it has something relevant to add. Simpler to add new agents to than a fixed message-passing topology; harder to reason about who changed what.

blackboard agent 1 agent 2 agent 3
6

Reliability & control

Where a system checks its own work, and what it looks like when checking is skipped or a claim goes unverified.

TermWhat it isShape
GuardrailsInput/output checks

Checks that run on what goes into the model or comes out of it — a content filter, a schema validator, a policy check — that can block or rewrite a step before it takes effect. Distinct from a hook: guardrails specifically judge content, not just fire at a point in time. Put the expensive check on the output, the cheap one on the input — most bad inputs never reach the model at all.

input check model check
Human-in-the-loopHITL

A required pause for human approval before a consequential action executes — sending an email, deleting data, spending money — instead of letting the agent act fully autonomously. Scale the approval to the blast radius: read-only actions rarely need it, irreversible ones almost always should.

agent approve? action runs a person, not the model, decides here
EvalsEvaluations

A test suite for a model or an agent's behaviour: a fixed set of inputs with a way to score the outputs, run before shipping a prompt or model change to see whether it actually made things better. Without evals, every prompt tweak is a guess — you're optimizing on vibes, not a number that can regress.

test cases model v2 92%
GroundingFact anchoring

Tying a model's output to a verifiable external source — a retrieved document, a tool result, a citation — so a claim can be checked, instead of relying purely on what the model recalls from training. RAG is one way to ground; a calculator tool grounding an arithmetic answer is another.

"revenue grew 12%" source: Q3 report
HallucinationConfabulation

The model producing a confident, fluent, and wrong statement — a fabricated citation, an API that doesn't exist — with no signal to the reader that it's unsupported. A generation-quality problem, not a bug in the traditional sense. Grounding reduces it; nothing eliminates it — always treat unverified model output as a claim, not a fact.

"according to the 2024 study..." no such study exists
7

Training & adaptation

How a model's behaviour gets shaped — permanently through training, or temporarily through what's in the prompt.

TermWhat it isShape
Fine-tuningPost-training

Continuing to train an already-trained model on a smaller, task-specific dataset, adjusting its weights so the behaviour shifts permanently — unlike a prompt, which only steers that one call. Expensive and slow to iterate on compared to a prompt; reach for it only after prompting has hit a real ceiling.

base model + dataset tuned
RLHFReinforcement Learning from Human Feedback

Training a model to prefer outputs that humans rate as better — humans rank candidate responses, a reward model learns from those rankings, and the model is optimized against that reward signal. What turns a raw text predictor into something that behaves like an assistant.

ranked by humans reward model assistant
In-context learningFew-shot prompting

The model picking up a pattern from examples placed directly in the prompt — no weight updates, no training run — and applying it to a new input in the same call. Cheaper than fine-tuning and reversible; costs context-window space on every single call instead.

cat → gato dog → cão bird → ? model ave
DistillationKnowledge distillation

Training a smaller, cheaper model to imitate a larger one's outputs, so most of the capability survives at a fraction of the size and inference cost. The usual path from "we prototyped with the biggest model" to "we ship with a small one".

teacher (large) student (small)
Chain-of-thoughtReasoning trace

Prompting or training a model to write out intermediate reasoning steps before its final answer, which measurably improves accuracy on multi-step problems — and gives a human something to inspect for where the reasoning went wrong. Modern reasoning models generate long internal chains of thought automatically, often hidden from the final output.

step 1 step 2 answer
8

Runtime & infrastructure

The mechanics underneath every call: what gets counted, what gets tuned, and what determines how it feels to use.

TermWhat it isShape
InferenceServing

Running a trained model forward to produce an output — as opposed to training, which adjusts its weights. Everything an agent does at runtime is inference; training already happened, long before, somewhere else.

input frozen weights output
TokenSub-word unit

The unit the model actually reads and writes — usually a few characters, not a whole word. Cost, context-window limits and rate limits are all measured in tokens, not words or characters. Rough rule of thumb: about 4 characters of English per token.

"unbelievable" un believ able
TemperatureSampling, randomness control

A parameter controlling how much randomness goes into picking the next token. Low (near 0) is nearly deterministic and repetitive; high pushes toward more varied, sometimes less coherent, output. Use low temperature for tool calls and structured output, higher only where creative variety is actually wanted.

temp = 0.1 temp = 1.2
StreamingToken-by-token output

Sending each token to the client as soon as it's generated, instead of waiting for the full response, so a user sees words appear progressively rather than staring at a blank screen until it's all done.

rendered as they arrive The answer is grow...
LatencyTTFT, tokens/sec

Time-to-first-token (TTFT) is the delay before the first token appears; tokens-per-second is the speed once it starts. Together they determine how an agent actually feels to wait on — a slow TTFT feels broken even if throughput is fine.

request sent TTFT tokens/sec