Generative AI & Agentic AIAgent workflows and state

Agent memory: separate facts, preferences and temporary state

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (5 sections)

“Memory” often combines different records that should not share authority or lifetime. A policy fact, a user’s style preference and the current draft step need different sources, validation and deletion.

Classify every record

The agent controls lab creates three synthetic records.

python
from agent_cases import memory_case

result = memory_case()
assert result["classes"] == ["fact", "preference", "temporary_state"]
assert result["all_have_source"] is True
assert result["all_have_expiry"] is True
print(result["records"])

The fact cites a policy and expires on supersession; the preference cites user settings; temporary state belongs to one run and expires at run end.

Give each class its own contract

Facts require an authoritative source, effective date and freshness. Preferences require authenticated user scope and edit/delete controls; they cannot override policy. Temporary state requires run ID, schema and checkpoint lifetime.

Do not promote model summaries into durable facts automatically. A retrieved document cannot write a user preference. Apply tenant/access boundaries before reading memory and minimize sensitive content.

Test conflicts and forgetting

Create a newer policy, changed preference and cancelled run. Verify the old fact is no longer current, the new preference affects only that user and temporary state is removed. Define behaviour when sources conflict or expire.

The Generative & Agentic AI course connects memory classes to data contracts, privacy and state recovery.

Exercise

Design a memory schema with provenance and expiry for all three classes. Inject cross-user access and a policy/preference conflict, then demonstrate fail-closed resolution and deletion.

Continue learning

This article is part of the Agent workflows and state sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

Reference: LangGraph memory overview.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Generative & Agentic AI programme — 3 months. Add practical GenAI, retrieval and agent-building skills to your existing toolkit.

Explore Generative & Agentic AI
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.