AI Foundationspredict · compress · act
act IX

The Agent Infrastructure

A chatbot replies. An agent acts. The difference is a loop, some memory, and permission to change the world.

33

From Answer to Action

before this →How Do We Even Know?

Everything so far produces text. An agent uses that text to do things: call tools, read results, decide what to do next, and repeat until the job is done. This is the same agent loop from chapter 0 — now with a language model inside it.

modeltoolsmemoryactobserve the result, append to contextrecall
the agent loop: model → action → observation → model ... until done

ReAct: think, act, observe

The pattern that made agents work is ReAct (Reason + Act): interleave the model’s reasoning with tool calls. The model writes down what it intends, calls a tool, reads the result, and reasons about it. Every step is appended to the context window — the model’s working memory — so it can act on what it has learned.

Planning

Some agents plan first and execute after. Planning ranges from a simple to-do list the model updates, to tree search over possible action sequences, to decomposing a goal into subgoals. Plans are useful and unreliable: a plan made before touching the world is often wrong, which is why the best agents interleave planning with execution.

The essential insight is that the model is not just generating an answer. It is generating the next step of a process, and the process feeds back into it.

Why agents are hard

the gap between demo and deployment

Errors compound. Ten steps at 95% each is a 40% chance of a mistake somewhere. Context fills up. Tools fail. The model misreads an observation and confidently proceeds. Reliability, not intelligence, is the bottleneck.

the shiftA language model is a component. An agent is a distributed system with a language model in the control loop — and it needs everything a distributed system needs: retries, timeouts, logging, and limits.
REASONdecide what to do next
ACTcall a tool, change the world
OBSERVEread the result, loop
introduces →agent loopReActplanningcontext window
← previousHow Do We Even Know?next →Hands and Function Calls