Start studying
Module 11 · AI Agents Module contents
Module 11  ·  Card 9 / 17intermediate

State

State is everything the agent needs to remember within a single task.

It covers the goal, steps completed, tool results and errors so far.

Keeping it in the conversation is simple but consumes context quickly.

Keeping it externally lets you summarise and prune what the model sees.

Losing state mid-task causes agents to repeat work or contradict themselves.

Learn in depth ↓
Module 11 · AI Agents · 17 concepts
In depth  /  15 lines

State, in more detail

State is what the agent needs to remember within one task.

The goal, the steps already completed, the results returned, the errors hit.

The simplest approach is to keep everything in the conversation.

That works and consumes context fast, since every tool result stays forever.

A twenty-step run can fill a large window with material long since irrelevant.

Keeping state outside the conversation lets you control what the model sees.

A structured record of steps and results can be summarised into a few lines.

The model then sees a compact status rather than a full transcript.

That costs less, and it keeps the important parts away from the middle of a long context.

Decide explicitly what to carry forward and what to drop.

Failed attempts are worth keeping, or the agent will retry them.

Losing state mid-task makes agents repeat work or contradict themselves.

Persisting it also lets a long task resume after a crash.

Store it somewhere queryable so a human can inspect a stuck run.

State is separate from memory, which is what persists between tasks rather than within one.

Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What happens when an agent loses track of its state mid-task?
AI Agents

17 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close