A language-model agent is a policy that acts in a loop: it reads a context, emits an action (a tool call or a final answer), receives the tool’s output, appends both to its context, and repeats.
A language-model agent is a policy that acts in a loop: it reads a context, emits an action (a tool call or a final answer), receives the tool’s output, appends both to its context, and repeats. This looks like a text-generation problem, but its structure is that of a partially observable Markov decision process. The environment has a state the agent does not see; the observation is the tool output; the context window is the agent’s record of what it has seen; and what the agent must carry from one step to the next is a belief about the hidden state. this article writes the loop as a POMDP, proves what a sufficient summary of the history is, quantifies what a bounded context or a bounded memory costs, treats tool calls as typed actions with errors as observations, and implements a small tool-using agent framework (a calculator, a key-value store, and BM25 search over a synthetic corpus) and the exact belief and bounded-memory computations on a small problem.
- Formalize the agent loop as a POMDP and identify its state, actions, observations and the history that conditions the policy.
- Prove that the belief is a sufficient statistic, and decide whether a given summary of the history is sufficient.
- Compute the value lost by a bounded context window or a bounded memory, in an exactly solvable problem.
- Build a typed-tool agent loop in which invalid calls are observations, and account for the cost of re-reading the context.
Continue with the book
Explore the full treatment, worked examples, and exercises in RL for LLM Agents and Reasoning Models.
Companion article for RL for LLM Agents and Reasoning Models, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
