demo

An agent's reasoning, frame by frame

Agents don't think in one shot — they loop. User input becomes reasoning, becomes tool calls, becomes tool results, becomes more reasoning, until an answer crystallizes. Step through four curated traces and watch the loop run.

The five step kinds

  • User — the input the human typed. Fixed; the agent doesn't get to revise it.
  • Reasoning / thinking — the model writing about what to do next. In Claude these are explicit thinking blocks; in older agents (ReAct) they were just freeform text in the prompt. Either way, this is where the plan lives.
  • Tool call — the model emits a structured call to a function it has access to: a search engine, a code interpreter, a database. It includes the args.
  • Tool result — the function ran. Whatever it returned (text, JSON, an error) gets injected into the agent's context for the next round.
  • Assistant — the final answer to the user. Cleaned up, integrated, presented.

Patterns to notice

  1. One tool call ("weather Tokyo") is the simplest agent shape: question → call → answer. Most "agent" features in modern apps are just this loop with one tool.
  2. Search → reflect → search-deeper ("recent papers about RoPE"): the model widens, then narrows. The explicit reflection block is where the agent decides which candidates are worth fetching in detail.
  3. Run → observe → fix ("fibonacci bug"): the canonical Claude Code coding loop. Run a test, see the failure, propose the fix, re-run, confirm. This is where agents start to look like collaborators.
  4. Supervisor + specialists ("Tokyo trip"): one coordinating model dispatches three sub-agents in parallel, waits, and integrates their outputs. Multi-agent orchestration is just nested versions of this loop.

Why this teaches

Most engineers' first contact with agents is "magic black box that does things". Once you see the trace, the magic disappears: an agent is a model deciding what to do, calling a function, reading the result, and deciding again. Every "agent framework" you'll meet (LangChain, LlamaIndex, Claude Agent SDK, Strands, smolagents) is a thin wrapper around exactly this loop.

Anchored to 11-agents/agent-loop-and-architecture from the learning path.