Threads and checkpoints
Save a conversation between calls so your Agent can pick up where it left off.
On this page
Keep conversation state between callsKeep conversation state between calls
A thread groups related messages and agent state into one conversation. For example, a support agent can remember an order mentioned in the first message when the customer asks a follow-up question.
A checkpoint is a saved snapshot of the agent’s graph state, including its conversation messages. A checkpointer (also called a saver) stores those snapshots, for example in SQLite. Reusing an authorized thread lets a managed Python agent read its saved state on the next call.
Use checkpoints when later calls need earlier context. Independent one-shot requests do not need a thread. Saving graph state does not prove that a refund, email or other external action completed.
This example uses a thread ID that belongs to one open Agent session. SQLite keeps the messages on disk after the session ends. If the conversation must survive a restart, use an application-authorized thread from the first call.
Install a supported SQLite checkpointer
pip install 'openeight[langchain-durable]'Send two messages on the same thread
This snippet runs inside your application. Supply your configured model, test tools without external effects, and openeight_config. Get the connection configuration →
The resource factory opens SQLite on the SDK’s event loop and keeps the connection open until the Agent finishes the work it has accepted. Use an explicit agent context for the whole conversation.
from contextlib import asynccontextmanager
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer
from openeight.managed import ManagedResources
from openeight.langchain import create_agent
@asynccontextmanager
async def resources():
async with AsyncSqliteSaver.from_conn_string("checkpoints.sqlite") as saver:
saver.serde = JsonPlusSerializer(pickle_fallback=False)
yield ManagedResources(checkpointer=saver)
with create_agent(
model=model,
tools=tools,
openeight=openeight_config,
resources=resources,
) as agent:
thread_id = agent.new_thread()
config = {"configurable": {"thread_id": thread_id}}
first = agent.invoke(
{"messages": [("user", "Remember order ORD-1041. Take no action.")]},
config=config,
)
follow_up = agent.invoke(
{"messages": [("user", "Which order did I mention?")]},
config=config,
)
print(follow_up)
agent.release_thread(thread_id)Expected result: the second call receives the earlier conversation state, so the model can answer with ORD-1041. Both calls use the same thread ID; a newly issued thread starts a separate conversation. Inspect the returned messages to check your model’s answer.
Use only IDs issued by this entered agent. Calls on one thread must run sequentially. Release the thread after the conversation finishes; release invalidates that ID for this owner without deleting saved database rows.
Continue after a session closes
For managed Python threads that must outlive an agent session, configure OpenEightConfig.checkpoints with an application-owned CheckpointAccess adapter. Pass the thread ID in configurable.thread_id on each call. The SDK rejects new_thread() and release_thread() in this mode. Your application authenticates the caller, authorizes the exact thread and namespace, retains enrollment and execution records, and holds an exclusive guard shared by every writer.
Qualified SQLite and PostgreSQL savers can store native graph state. The supported enrollment path uses one process; distributed writers and expiring leases are unsupported. Continuation selects the latest saved state. Adopting an existing native history requires explicit authorization, quiescent state and reconciliation of earlier external effects.
Checkpoints preserve graph state; they do not provide business-effect recovery or long-approval scheduling. If an action or stored execution is uncertain, reconcile the original attempt before retrying. MCP with checkpointing is unsupported.
Tell us your framework, SQLite or PostgreSQL choice, and whether conversations need to survive a restart. We’ll help you choose the thread-access and persistence approach. Keep credentials and private application data out of your message.
Email us at hello@openeight.ai.