Task state
state = {
"goal": "investigate service",
"host": "web01",
"service": "nginx"
}- These facts are needed for the current investigation.
- They do not automatically belong in permanent memory.
A multi-step agent must remember what it is doing right now. That task state is different from conversation history, and both are different from information intentionally retained for future sessions.
Engineering focus: Working state, conversation context and durable memory
A multi-step agent must remember what it is doing right now. That task state is different from conversation history, and both are different from information intentionally retained for future sessions.
Framework names come later. First understand what the application is doing and where its control boundaries belong.
Across the course, imagine an assistant that investigates operational problems using narrow tools. The design progressively adds plans, specialist agents, approvals, reliability controls and MCP while keeping model output separate from execution authority.
Facts such as the current goal, host, service, plan and recent tool result belong to the active task. Losing them causes the agent to repeat questions or act on the wrong target.
Dialogue can contain useful facts, but production applications often need explicit structured state that can be validated, updated and passed to tools without re-parsing prose.
Long-lived information should be retained deliberately, not because it happened to appear in a chat. Durable memory raises questions about purpose, access, correction, expiry and deletion.
The application should choose the information needed for the current model decision. Sending every stored fact increases cost and can distract the model.
state = {
"goal": "investigate service",
"host": "web01",
"service": "nginx"
}stored information
↓
select relevant facts
↓
model context for this decisionGoal: See a multi-step task succeed with explicit state and fail when a required fact is removed.
python3 public/labs/agentic-ai/04_state_and_memory.pyThe application retains host=web01 and adds service=nginx.
The lab removes host and demonstrates why the next step has to ask again.
Production agent memory should be purpose-limited, scoped and observable. State stores, session stores and durable memory have different retention and security requirements.
Open every answer only after committing to your own answer. Opening all four answers records knowledge-check activity in My Learning.
Working state — They are task-scoped facts needed during the current run.
Because useful state can include structured task facts and tool results not represented well as dialogue — Applications often need explicit structured state.
The application should select relevant context for the current decision — Context selection should be deliberate and task-relevant.
Loss of required working state — The task cannot continue correctly because a required task fact was lost.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.