Loop Engineering · Reference

Glossary

The shared vocabulary for this course. Every lesson adheres to these definitions. When a term is added or sharpened, it changes here first.

How to use This is a reference, not a lesson — skim it, don't memorise it. Lessons link here; come back when a term is fuzzy.
Loop engineering
The discipline of designing and tuning the iteration loop that drives an AI agent — what context enters each model call, what actions the model can take, how results feed back, and when the loop stops. The umbrella term for this course.
Agent loop (agentic loop)
The repeating cycle at the heart of every agent: assemble context → call the model → execute the tool calls it returns → append the results → check the stop condition → repeat. Often summarised as “an LLM, a loop, and enough tokens.” — Thorsten Ball, How to Build an Agent
Turn / step / iteration
One pass through the agent loop: a single model call plus the tool execution it triggers. Agent “length” is measured in turns; step budgets cap how many are allowed.
Workflow
A system where “LLMs and tools are orchestrated through predefined code paths.” You — the engineer — decide the route between steps. Predictable, testable. — Anthropic, Building Effective Agents
Agent (autonomous)
A system where “LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks.” The model decides the route between steps. Flexible, less predictable. — Anthropic, Building Effective Agents
Ground truth
Real feedback from the environment that the agent reads each turn to judge progress — “tool call results or code execution.” Without it the loop is guessing, not steering. — Anthropic, Building Effective Agents
Context engineering
Curating the exact set of tokens placed in the model’s context each turn so the most useful information is present and noise is excluded. Anthropic frames it as “the natural progression of prompt engineering” and the single biggest lever on agent reliability. — Anthropic, Effective Context Engineering
Tool · ACI (agent–computer interface)
A function the model can call to act on the world (read a file, hit an API, run code). The ACI is the design of that tool surface — its names, schemas, and docs. Anthropic treats tool documentation and testing as a first-class part of agent quality.
Stop condition (termination)
The rule that ends the loop: task complete, max turns hit, budget exhausted, or human handoff. A missing or weak stop condition is a top cause of runaway agents.
Step / token budget
An explicit cap on turns or tokens per task. 12-Factor Agents advises keeping agents to roughly 3–20 steps before handing off or chaining a fresh agent. — HumanLayer, 12-Factor Agents
Control-flow ownership
Writing the loop yourself — “prompt + switch statement + context builder + loop” — rather than delegating it to a framework, so you keep the fine-grained control production reliability needs. — HumanLayer, Factor 8: Own your control flow
The five workflow patterns
Anthropic’s catalogue of predefined control structures: prompt chaining (sequential steps), routing (classify then dispatch), parallelization (sectioning or voting), orchestrator–workers (a lead model delegates and synthesises), and evaluator–optimizer (a generator and a critic loop). — Anthropic, Building Effective Agents
Human-in-the-loop (HITL)
Pausing the loop to get a human’s information, judgement, or approval — ideally surfaced through the same tool-call mechanism the agent already uses. — HumanLayer, Factor 7: Contact humans with tool calls
Compaction · error compaction
Summarising history — or specifically failures — into a compact form before they re-enter the context window, so the loop recovers from errors without drowning in raw logs. — HumanLayer, Factor 9: Compact errors into the context window
Harness · scaffolding
The non-model code surrounding the loop: the context builder, tool dispatcher, parser, state store, and stop logic. Most of a “good” agent is this ordinary software, with the model placed at key decision points. — HumanLayer, 12-Factor Agents
Attention budget · context rot
An LLM has finite attention to spend across the tokens in its window; as the window fills, accuracy decays — context rot. The reason context engineering chases the smallest high-signal set, not the largest. — Anthropic, Effective Context Engineering
Right altitude
The target zone for a system prompt: specific enough to guide behaviour, flexible enough to leave the model strong heuristics — avoiding both brittle hardcoded logic and vague hand-waving. — Anthropic, Effective Context Engineering
Just-in-time retrieval
Holding lightweight identifiers (file paths, queries, links) and loading the actual data with tools only when needed, instead of pre-loading everything. Progressive disclosure that keeps the window lean. — Anthropic, Effective Context Engineering
Eval (evaluation)
A set of well-specified tasks plus graders that measure what an agent can do and whether it still does it. A good task is one where “two domain experts would independently reach the same pass/fail verdict.” Grade outcomes, not the exact tool path. — Anthropic, Demystifying Evals for AI Agents
Capability eval · regression eval
A capability eval asks “what can this agent do well?” and starts at a low pass rate; a regression eval asks “does it still handle what it used to?” and should sit near 100%. High-passing capability evals “graduate” into a continuously-run regression suite to catch drift. — Anthropic, Demystifying Evals for AI Agents
pass@k · pass^k
Reliability metrics over k runs of the same task. pass@k = at least one of k succeeds (use when one success suffices). pass^k = all k succeed (use when consistency is the requirement, e.g. customer-facing agents). — Anthropic, Demystifying Evals for AI Agents
L1 Map · L2 Dial · L3 Context · L4 Stop · L5 Recovery · L6 Ship Glossary v2 · grows with the course