Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsAn AI feature may begin with a prompt and a response, but the moment it retains conversation history, calls tools, waits for approval, retries work, or resumes after a crash, it has state to manage. Treat that state as an application and distributed-systems concern: decide what is kept, where it lives, who controls it, how it is recovered, and when it is deleted.
State belongs to the system around the model
A language model generates an output from the input and context supplied to it. Any continuity between calls—conversation history, a user’s preferences, an unfinished task, or the result of a tool call—depends on the surrounding application storing and supplying that information.
As an Amazon Associate I earn from qualifying purchases.
That distinction matters. “How do I make the model remember?” can lead to one growing bucket of context. A more useful design question is: “What does the system need to remember, why, for how long, and under whose authority?” Ibrahim KILIC makes that system-oriented framing in a LinkedIn post about his article. The architectural recommendations below apply that framing; they should not be read as a list of specific implementation details from KILIC.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
State can accumulate without the model itself being a long-running process. An orchestrator may persist messages, tool results, approval status, retry information, or a checkpoint that allows an interrupted workflow to continue. Each retained item can affect later decisions, costs, access permissions, and recovery behavior.
#1 Best Overall
Separate workflow state from durable memory
Different state serves different purposes. A useful starting point is to distinguish data needed to continue a particular request or workflow from information intentionally reused across conversations. LangGraph’s persistence documentation illustrates this distinction with thread-scoped checkpointers for short-term state and stores for application-defined information that can span threads.
| State scope | Typical contents | Design purpose | Retention question |
|---|---|---|---|
| Request | Inputs and intermediate values needed while handling one call | Complete the current operation | Can it be discarded as soon as the operation ends? |
| Thread or workflow | Conversation context, tool results, approval status, and progress markers | Continue or recover one interaction or task | How long must this workflow remain resumable? |
| Cross-thread memory | Deliberately retained preferences, facts, or shared knowledge | Personalize or inform later interactions | What event, expiry, or request should remove or correct it? |
These are design categories, not a requirement to use three databases. They make it easier to assign each piece of information a scope and lifecycle before choosing storage. A preference intended to influence later conversations should not be accidentally retained merely because it appeared in a thread checkpoint. Conversely, an in-progress approval may need to remain attached to its workflow rather than become general-purpose memory.
Rank #2
Choose persistence for the recovery you need
Persistence is not synonymous with durability. LangGraph’s documentation notes that its in-memory saver loses checkpoints when the process restarts. It is useful for development scenarios, but it cannot provide restart recovery. If users or operators must resume interrupted work after a restart, use a persistent checkpointer or equivalent storage mechanism and verify that it meets the system’s actual failure and recovery requirements.
Be precise about what “resume” means. A saved snapshot can restore the application’s recorded state, but it does not automatically make an external action safe to repeat. If a workflow sends a payment, creates a ticket, or changes an account and then crashes before recording success, a retry may perform the action twice unless the integration and workflow handle duplicate execution. Design checkpoints, retry behavior, and side effects together.
- Define the recovery boundary. Decide which interruptions the system should survive: a failed request, worker restart, deployment, or longer outage.
- Persist meaningful progress. Record enough state to continue safely, including which steps completed and which external actions may have occurred.
- Make retries deliberate. Where tools support it, use idempotency keys or equivalent duplicate protection; otherwise, reconcile the action’s outcome before repeating it.
- Test restoration. Interrupt a workflow at meaningful points and verify the resumed run does not lose required context or repeat unsafe effects.
Give every retained item an owner and a lifecycle
State design needs an answer for who may write, read, correct, and delete information. This applies both to user-linked memory and to workflow records that may contain sensitive messages or tool output. Keep access aligned with purpose: a component that needs to resume a task may not need access to every user’s durable memory.
Retention should be explicit for checkpoints as well as long-term memory. LangGraph warns that checkpoints can accumulate over long conversations, increasing storage use and latency, and recommends pruning old checkpoints or setting a retention policy. Apply the same discipline to other persisted context: define expiry, deletion behavior, and what happens to copies, indexes, or derived records when data is removed.
- Classify what each state field contains and whether it is personal, sensitive, or untrusted.
- Set separate retention rules for resumable workflow state and cross-session memory.
- Specify who can view or change memory and how a user or operator can correct an inaccurate retained fact.
- Define deletion behavior, including any replicas or retrieval indexes maintained by the application.
- Measure storage growth, retrieval latency, and the amount of context sent to the model.
Threat-model stored and retrieved context
Persisted context can influence future model behavior, so it belongs in the system’s security threat model. OWASP’s 2025 Top 10 Risk & Mitigations for LLMs and Gen AI Apps names prompt injection, data and model poisoning, vector and embedding weaknesses, and unbounded consumption among its risk categories. Applying those categories to a system’s memory and retrieval paths is an architectural inference, not a claim that OWASP prescribes one particular memory-control design.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →As a design practice, treat user input and retrieved material as data that may be inaccurate or adversarial, not as trusted instructions simply because the application stored it. Limit which tools can act on the basis of retrieved content, enforce authorization outside the model, and review the path by which content enters durable memory. Keep untrusted content distinguishable from trusted application instructions wherever it is assembled into a prompt.
Best Value
Also consider resource abuse: repeated or oversized interactions can grow checkpoints and retrieval work. Bound input and retention where appropriate, monitor storage and retrieval costs, and ensure that cleanup policies actually run. These are recommended controls for the risks above, not controls specified by the OWASP risk list itself.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Make state observable without exposing it unnecessarily
When an agent takes an unexpected action, operators need to understand what state informed the decision and how the workflow reached that point. Record operational events such as checkpoint creation, resume, tool invocation, retry, and deletion, along with stable identifiers that let authorized staff trace a workflow. For sensitive state, prefer access-controlled diagnostics or carefully selected metadata over copying full conversation contents into broad-access logs.
Decide what replay means for your system. A record of inputs, retrieved context, model or tool versions, and workflow transitions may help explain a decision, but storing it creates additional privacy, access, and retention obligations. Observability is not a reason to retain everything indefinitely; it is a reason to choose deliberately what evidence is needed and who may inspect it.
A practical design review
Before shipping a stateful AI workflow, answer these questions for each category of state—not just for the database as a whole:
- Purpose: What future operation needs this information?
- Scope: Is it request-only, thread-scoped, or meant to span users or sessions?
- Authority: Who or what may create, read, update, or delete it?
- Recovery: Which failures should it survive, and what happens if an external action completed but its result was not checkpointed?
- Lifetime: When does it expire, and how are associated copies or indexes removed?
- Security: Can untrusted input influence this state, and what actions could downstream components take based on it?
- Operations: Can authorized operators trace state transitions, detect growth, and investigate failures without unnecessary access to sensitive content?
Answering these questions turns “memory” from a vague model feature into an explicit system capability—with boundaries, recovery behavior, and a lifecycle that can be tested and operated.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




