- requests can move between service instances
- local disks are temporary or unreliable
- your application must control access, encryption, backups, or retention
How it works
Quick start
UseInMemorySessionStore to verify the flow before connecting real storage. It keeps data only in the current process and loses it when the process exits.
session_id as resume and provide the same store again:
cwd so the SDK identifies requests as belonging to the same project.
Connect your storage
The SDK does not ship a production-ready external store. Your application implements theSessionStore protocol against shared storage of its choice.
A minimal implementation needs two async methods:
Implement the following methods only when their features are needed:
Treat
key and entries as opaque SDK data. Store and return them without interpreting the message content.
Storage implementation checklist
Only developers implementing a SessionStore need to handle these requirements:- Preserve append order for each key, and return the complete history from
load. - Keep data for different keys isolated.
- The SDK may retry a failed
append; production implementations must account for repeated delivery. - Return Unix epoch milliseconds in
list_sessions().mtime, and list main sessions only. - Deleting a main session must also delete its child data.
- Return relative identifiers from
list_subkeys; never return absolute paths or paths containing.or... - If multiple processes can write one session, serialize those writes in the storage layer.
run_session_store_conformance from qoder_agent_sdk.testing to check common behavior, and add backend-specific concurrency and retry tests. Connection management, access control, encryption, backup, migrations, and retention remain the application’s responsibility.
Use it in your application
Pass the store inQoderAgentOptions.session_store for every query that should save or restore an external session.
- Known session ID: use
resume - Most recent session for the project: use
continue_conversation=Trueand implementlist_sessions - Session management: use
list_sessions_from_store,get_session_messages_from_store,rename_session_via_store,tag_session_via_store,fork_session_via_store, ordelete_session_via_store - Import an existing local session: use
import_session_to_store
Limitations and operations
- An external write failure does not stop the current conversation. The SDK emits
SDKMirrorErrorMessageafter the final failure; monitor this message when completeness matters. - External reads wait up to 60 seconds by default. Configure this with
load_timeout_ms. session_store_flushdefaults to"batched";"eager"writes sooner but makes more storage requests.- If an explicitly resumed session is absent from the store, the SDK can still try a local session with the same ID.
- Python session storage cannot be combined with file checkpointing, a custom transport, or the experimental Cloud Agent runtime. It requires the built-in subprocess transport.
- SessionStore saves session history only. It does not save authentication state, application configuration, file checkpoints, or retention policy.