Module 6.1
AI Concepts Intermediate 4.2 showed the think-act-observe ring as a diagram. Here's the actual text — every line tagged by who wrote it: the developer's instructions, the model's own output, or code splicing in a result.
The math
Module 1.3 showed one attention step; Module 2 showed one forward pass. A ReAct "agent" is just that forward pass, called repeatedly on a buffer that code keeps growing.
The code
buffer = SYSTEM_INSTRUCTIONS + f("\n\nQuestion: {question}\n\n")
while True:
completion = model.generate(buffer, stop=["Observation:"])
buffer += completion
if "Final Answer:" in completion:
break # the model decided it's done
action = parse_action_line(completion) # regex on "Action: tool(args)"
result = run_tool(action) # your code, not the model
buffer += f("Observation: {result}\n") # spliced back in, verbatim
Notice stop=["Observation:"] — the model is explicitly cut off right where it would try to hallucinate its own observation instead of waiting for the real one.
The Nimbus thread
Without stop=["Observation:"], nothing prevents the model from writing a plausible-looking fake observation itself — "Observation: quota was fine, must be a network issue" — and confidently reasoning from a number it made up. The stop sequence forces a hard handoff: the model proposes an action and nothing past it; only your code is allowed to write what actually happened.
So what
An agent's "memory" of what it just did is a bigger text file — nothing more exotic is happening between one call and the next.