JustujuAI, layer by layer.Open in the interactive map

The agent loop

Plan, act with a tool, observe the result, and repeat until the goal is met.

Layer 8 · Agents · Run time · Draft, awaiting expert review, reviewed 2026-09-28

Read first: Tool use & protocols (MCP).

D1 · StoryFor young children and total beginners

Before you read: how would you know when a messy room is finished?

Think of a robot tidying a room: look around, pick one thing up, check where it goes, then look again. It keeps going until the room is tidy.

An AI agent works the same way, using computer tools instead of hands.

Like: A robot tidying a room, one item at a time.

D2 · PictureFor curious beginners

The agent receives a goal. The model reasons about the next step and requests a tool call.

The harness runs the tool, with permission checks, and feeds the result back into the context.

The loop repeats until the model decides the task is done, a limit is reached, or a person steps in.

The agent loop

  1. Goal: from the user
  2. Think: choose next step
  3. Act: call a tool
  4. Observe: read the result
  5. Done?: stop or continue

Like: A robot tidying a room.
Where it breaks: A tidying robot can see the whole room. An agent only sees what's in its context, so long tasks need summaries and memory, and details can get lost.

D3 · PlayFor motivated learners

An agent task is a chain of steps: read a file, call a tool, edit, run a test. The whole task only succeeds if every step does.

If each step succeeds with chance p, and steps fail independently, a task of n steps finishes with chance p to the power n. Small per-step errors compound fast.

A check and retry step helps: a test or a second look catches some failures, and the agent gets one more try. Turn it on and watch the curve lift.

Try the interactive version in the map.

Things to try

D5 · FrontierFor experts

Open problems: reliability over long tasks, knowing when to stop or ask for help, evaluating agents on realistic work, and containing agents that read untrusted content.

Sources

  1. ReAct: Synergizing Reasoning and Acting in Language Models (2022)
  2. Building effective agents (Anthropic) (2024-12-19)