LESSON 04 · CONTROL LOOP

Design the Agent Loop

An agent is a feedback system. Every action should change state, produce evidence, and lead to an explicit continue, stop, or escalation decision.

TIME35–45 min
LEVELFoundation
LABLoop simulation
ARTIFACTAgent Loop Map

Build a loop that can explain why it continued.

A weak agent loop is “think, use a tool, repeat.” A production loop must make observation, state update, action selection, verification, and stopping explicit. The loop should also know when authority is insufficient and a human must take over.

D→V RULE

No action without a verification path. If the system cannot determine whether an action succeeded or changed the relevant state, it cannot safely decide what to do next.

What must be refreshed before reasoning?

How does the agent choose the next permitted action?

When is approval required?

How is tool output checked?

What ends the loop?

Hard loop limit.

GENERATED LOOP
INTERACTIVE LAB · RUN THE LOOP

Choose what happens next.

Use the boundary and authority logic from Lessons 2–3. Each decision should move the case forward without crossing the operating envelope.

State 01 · Shipment is 9 hours late.

Carrier event stream is stale. Weather is unknown. Customer SLA requires notification if the delay exceeds 12 hours.

State 02 · Weather explains some delay, terminal status does not.

The terminal reports congestion, but carrier ETA conflicts with the terminal's queue estimate.

State 03 · A recovery route is available.

The new route is likely to meet SLA but creates a $1,850 carrier commitment.

State 04 · Approval is granted and booking executes.

The booking tool returns success.

State 05 · Verification matches expected state.

New route is confirmed, the case record contains the approval, and the target operational state is reached.

LESSON ARTIFACT

Write the Agent Loop Map.

Capture what the loop observes, how it chooses actions, what it may execute, how it verifies effects, and what forces stop or escalation.

D→V · DESIGN RECORD

Agent Loop Map

NEXT · LESSON 05

Tool Design

Turn the loop's actions into typed, permissioned, idempotent capabilities with explicit failure behavior.

Back to track →