Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If your agent loses its conversation after a restart, the history was almost certainly held only in the memory of the running process. The fix is to write each conversation to durable storage, give that conversation a stable identifier, and make sure the restarted agent loads the same history under the same identifier before it calls the model.

Why the history disappears

Most agent code keeps the conversation in a Python list, a JavaScript array, or a checkpointer configured with an in-memory saver. Those structures live inside the process. When the process exits, the list is garbage-collected and the saver’s contents go with it. The model itself never remembers anything between calls; it only sees the messages you send with each request. So if the restarted process sends a fresh message with no prior messages, the agent behaves as if the conversation has just started.

Adding instructions to the system prompt does not fix this. Continuity requires that the next run receives the prior messages, or retrieves them from a store that survived the restart.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the basics before changing code

  1. Confirm that history is written after each run, and that the write finishes before the process shuts down. A write that is still pending when the process is killed will be lost.
  2. Confirm the backend is durable. An in-memory object, a temporary directory, or a container’s ephemeral filesystem will not survive a restart.
  3. Confirm the restarted process points to the same database file or service as before. If the path is relative, a different working directory on restart can silently create a new, empty database.
  4. Confirm the conversation identifier is the same on both sides of the restart. A new random ID per run produces a new, empty session every time.
  5. Confirm the framework’s session or checkpointer integration is actually enabled on the run path, so persisted items are loaded before the model call.

If all five hold and the agent still forgets, the problem is usually the identifier or the path, not the framework.

#1 Best Overall
GMKtec AI Mini PC Ryzen Al Max+ 395 (up to 5.1GHz) Mini Gaming Computers
  • EVOLUTION AMD RYZEN AI MAX+ 395 MINI PC - GMKtec EVO-X2 is the next evolution in AI mini PC Ryzen Strix Halo series. Thanks to AMD Simultaneous Multithreading (SMT) the core-count is effectively doubled, to 32 threads. Ryzen AI Max+ 395 has 64 MB of L3 cache and can boost up to 5.1 GHz, depending on the workload. The Ryzen AI Max+ 395 is currently rated as the "most powerful x86 APU" on the market for AI computing.
  • AI NPU with XDNA 2 ARCHITECTURE - Powered by 16 “Zen 5” CPU cores, 50+ peak AI TOPS XDNA 2 NPU and a truly massive integrated GPU driven by 40 AMD RDNA 3.5 CUs, the Ryzen AI MAX+ 395 is a transformative upgrade and delivers a significant performance boost over the competition. The Ryzen AI Max+ 395 excels in consumer AI workloads like the llama.cpp-powered application: LM Studio. Shaping up to be the must-have app for client LLM workloads, LM Studio allows users to locally run the latest language model without any technical knowledge required and unleash their creativity and productivity.
  • AMD RADEON 8090S iGPU GAMING PC - The AMD Radeon RX 8060S offers all 40 CUs with up to 2.9 GHz graphics clock and uses the new RDNA 3.5 architecture. The powerful iGPU is positioned between an RTX 4060 and 4070 laptop GPU and therefore enables gaming in FHD at maximum details in most demanding games. The 8060S can also utilize the full 128GB pool, which is perfect for running LLMs such as Deepseek 70B Q8, which runs comfortably on this machine.
  • EIGHT CHANNEL LPDDR5X - LPDDR5X is a new ground breaking memory small form factor installed on-board. With blazing speeds up to to 8000MT/s, it runs 1.5x faster than the DDR5 SODIMMs; 90% better performance over DDR5 SODIMMs in video conferencing and photo editing; 30% better performance in productivity apps; 12% better performance in digital content workloads.
  • QUAD SCREEN 8K DISPLAY SUPPORT - EVO-X2 AI Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and dual USB 4 40Gbps Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support.

Fix for the OpenAI Agents SDK (Python)

The Agents SDK’s session feature handles the load-and-save cycle for you. Before each run it retrieves the session’s stored items, and after the run it stores the new input and output. Use a persistent session rather than handling to_input_list() yourself. The official Sessions guide shows SQLiteSession, which accepts a session ID and a database file path.

from agents import Agent, Runner, SQLiteSession

agent = Agent(name="Assistant", instructions="You are a helpful assistant.")

session = SQLiteSession("user-42-support-chat", "conversations.db")
result = await Runner.run(agent, "Where is my order?", session=session)
print(result.final_output)

After a restart, create the session again with the same ID and the same database path. The earlier turns are then loaded from conversations.db before the model sees the new message. The history belongs to the stored session, not to the Python object from the previous process.

Rank #2
AMD Ryzen™ AI Halo - Personal AI Desktop Computer - Developer Platform - Linux OS
  • Built for Local AI Development: AMD Ryzen AI Halo is designed for local AI development and inference, featuring 128GB unified memory and support for up to 200B parameter models to build and run intensive AI workloads locally.
  • 128GB Unified Memory: Features 128GB LPDDR5x unified memory at 8000 MT/s with 256 GB/s memory bandwidth, providing a shared memory pool across the CPU, GPU, and NPU to support larger AI models.
  • AMD Ryzen AI Max+ 395 Processor: Features 16 cores, 32 threads, and Zen 5 architecture, paired with AMD Radeon 8060S integrated graphics featuring 40 RDNA 3.5 compute units and an AMD XDNA 2 NPU with up to 50 TOPS.
  • Linux AI Developer Platform: Purpose-built for Linux-based AI development with full AMD ROCm software support and preloaded tools, models, and workflows optimized for local AI development.
  • Compact, Connected Design: Includes a 2TB M.2 SSD, 10GbE LAN, Wi-Fi 7, Bluetooth 5.4, USB-C connectivity, and HDMI 2.1b.

Use an absolute path for the database file, or anchor it to a fixed directory, so restarts from a different working directory still open the same file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not mix session memory with server-side continuation

The SDK’s run options conversation_id, previous_response_id, and auto_previous_response_id let OpenAI keep the conversation state on its side instead. Sessions keep it in your storage. The SDK documentation indicates that session persistence cannot be combined with these server-managed continuation settings on the same run, so pick one approach per conversation. Mixing them is a common source of duplicated or missing turns.

Rank #3
GMKtec EVO-X2 AI Mini PC Ryzen Al Max+ 395 Superchip 128GB LPDDR5X 2TB SSD
  • EVOLUTION RYZEN AI MAX+ 395 MINI PC - GMKtec EVO-X2 is the next evolution in AI mini PC Ryzen Strix Halo series. Thanks to AMD Simultaneous Multithreading (SMT) the core-count is effectively doubled, to 32 threads. Ryzen AI Max+ 395 has 64 MB of L3 cache and can boost up to 5.1 GHz, depending on the workload. The Ryzen AI Max+ 395 is currently rated as the "most powerful x86 APU" on the market for AI computing.
  • AI NPU with XDNA 2 ARCHITECTURE - Powered by 16 “Zen 5” CPU cores, 50+ peak AI TOPS XDNA 2 NPU and a truly massive integrated GPU driven by 40 AMD RDNA 3.5 CUs, the Ryzen AI MAX+ 395 is a transformative upgrade and delivers a significant performance boost over the competition. The Ryzen AI Max+ 395 excels in consumer AI workloads like the llama.cpp-powered application: LM Studio. Shaping up to be the must-have app for client LLM workloads, LM Studio allows users to locally run the latest language model without any technical knowledge required and unleash their creativity and productivity.
  • AMD RADEON 8090S iGPU GAMING PC - The AMD Radeon RX 8060S offers all 40 CUs with up to 2.9 GHz graphics clock and uses the new RDNA 3.5 architecture. The powerful iGPU is positioned between an RTX 4060 and 4070 laptop GPU and therefore enables gaming in FHD at maximum details in most demanding games. The 8060S can also utilize the full 128GB pool, which is perfect for running LLMs such as Deepseek 70B Q8, which runs comfortably on this machine.
  • EIGHT CHANNEL LPDDR5X - LPDDR5X is a new ground breaking memory small form factor installed on-board. With blazing speeds up to to 8000MT/s, it runs 1.5x faster than the DDR5 SODIMMs; 90% better performance over DDR5 SODIMMs in video conferencing and photo editing; 30% better performance in productivity apps; 12% better performance in digital content workloads.
  • QUAD SCREEN 8K DISPLAY SUPPORT - EVO-X2 AI Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and dual USB 4 40Gbps Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support.

Fix for the OpenAI Agents SDK (JavaScript)

The JavaScript SDK exposes a Session interface that you can back with your own storage. Its default in-memory session is meant for local development. For production, use a session implementation that writes to a database or other store and reloads it on the next run, and reuse the same session identity and backing store after a restart. Check the session’s documentation for the specific backend classes available in your version.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix for LangGraph

LangGraph persists state through a checkpointer attached to the graph. Two things must be true for restart recovery:

  • The graph is compiled with a durable checkpointer, such as a SQLite- or Postgres-backed saver, not an in-memory one. An in-memory saver only lasts for the life of the process.
  • Every invocation for the same conversation passes the same thread_id in the configurable run settings.
config = {"configurable": {"thread_id": "user-42-support-chat"}}
graph.invoke({"messages": [("user", "Where is my order?")]}, config)

LangGraph uses the thread_id as the key for saving and retrieving checkpoints. After a restart, rebuild the graph with the same durable checkpointer pointing at the same database, then invoke it with the same thread_id. The thread’s prior state is loaded automatically. A new or random thread ID starts a new, empty thread.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep thread history and long-term memory separate

There are two different persistence jobs, and they need different tools.

Need What to store Key used to retrieve it Typical mechanism
Continue one conversation after a restart The full message history or graph state for that conversation Session ID (OpenAI Agents SDK) or thread_id (LangGraph) Session or checkpointer with durable storage
Remember selected facts across many conversations Chosen facts, preferences, or knowledge Application-defined, such as a user ID A separate long-term store that your code reads and writes

LangGraph’s persistence documentation makes this split explicit: checkpointers hold thread-scoped state, and stores hold data shared across threads. A checkpoint for one thread does not make its facts visible to another thread. If a user expects the agent to remember their preferences in a new chat, you need to write those preferences to a store and read them back when the new conversation starts.

Multiple workers and containers

If your application runs several workers or containers, the session or thread ID must resolve to storage that every worker can reach. A SQLite file on one container’s local disk will not be visible to a worker started on another machine. In that setup, use a shared database service, or mount the same persistent volume into every instance. Verify this with a test where one worker handles the first turn and a different worker handles the second. This is an operational requirement that follows from how session and checkpoint storage works, not a behavior specific to any one platform.

Common mistakes that cause silent loss

  • Generating a new ID on each request. The session or thread is new every time, so the history looks empty.
  • Using a relative database path. A restart from a different directory creates a new empty file.
  • Keeping the database inside a container’s writable layer. Recreating the container discards it. Mount a volume instead.
  • Combining sessions with server-side continuation. Choose one history source per conversation.
  • Expecting checkpoints to share facts across threads. Use a long-term store for that.

“

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.