Agent Internals
Inside the Agent Loop
10 min+100 XPStep 1/12
The loop is a state machine, not a vibe
Strip away the framework magic and every agent is the same machine: assemble context → call the model → parse the action → execute → append the observation → repeat until a stop condition fires. The state is the message list. That's it.
The deep part: the model sees its own past reasoning as ground truth. A wrong 'thought' at step 3 doesn't get corrected — it gets cited. The agent confidently builds on its own mistakes because they read exactly like its successes. This is why trajectory hygiene matters more than clever prompting.
insight
Your agent's transcript is both its memory and its self-fulfilling prophecy. Garbage written to the scratchpad stays true forever.