Think, Act, Look
An agent is a helper that works in little loops: think, do something with a tool, look at what happened. Break a tool and see what it does!
Press Step to watch one loop at a time. I am a toy brain made of simple rules, not a real language model, but the loop is real!
The agent's diary
Challenges
Finish a task with every tool working.
Make a tool flaky and watch the agent retry and still get the right answer.
Break the clock and watch the agent find the date another way.
Break lookup. The agent has no way around it, so see it stop and say so, not make something up.
Solve all three tasks.
What just happened?
- An agent works in a loop: it thinks, acts by calling a tool, then looks at what came back.
- What it sees changes what it does next. A tool error made it retry or use a backup.
- When nothing worked it stopped and said so. That honesty is a feature.
- A turn limit stops loops that never end.
- The thinking here is a toy made of rules. In real agents a language model writes the thoughts, but the loop around it works the same way.
For grown-ups: what's really going on
This is the ReAct pattern (Yao et al., 2022): interleave reasoning (a thought), an action (a tool call with arguments) and an observation (the tool's output), appended to the transcript the next thought is conditioned on.
- Toy stand-in: the thought is chosen by a hand-written policy over a list of steps, not by a language model. The loop, tool calls, error handling and turn budget are real code. A real agent asks a model for the next thought and action given the transcript so far.
- Error handling: on a failed observation the policy retries once (transient fault), then switches to a fallback tool, then gives up. Giving up honestly beats hallucinating an answer.
- A max-turns budget bounds cost and prevents infinite loops. Real systems also add timeouts, retries with backoff, and validation of tool arguments.
- Tools return strings; the agent parses them. Dates are counted as whole UTC days between two ISO dates.
Further reading: Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models (2022).