Skip to main content
All Python modules · Import and compatibility guidance

Retention and limits

Storage maintenance

Exports

InMemoryStore

Implement memory in process-local storage that is lost on process exit.

InMemoryStore.delete_all

Erase one explicit namespace through trusted application code only.

InMemoryStore.delete_user

Erase an explicitly authorized owner without registering any endpoint.

InMemoryStore.purge_expired

Sweep a bounded key page without exposing another user’s collection.

InMemoryStore.put

Validate before atomically persisting a deliberate memory write.

InMemoryStore.get

Read only an explicitly scoped live record.

InMemoryStore.list

Page records without loading an unbounded provider collection.
Retrieve explicit literal text matches without model or embedding calls.

InMemoryStore.delete

Remove memory and its indexes with an optional atomic revision fence.

InMemoryStore.start

The process-local reference provider needs no external resources.

InMemoryStore.close

Release no external resources; retained test records stay inspectable.

MemoryCleanupPage

Physical removals in a bounded sweep; continue even when deleted is zero.
Fields (— means no declared default):

MemoryConflictError

A conditional write refers to a stale or missing memory revision.

MemoryPage

A bounded page; pass next_cursor as after, even for an empty page.
Fields (— means no declared default):

MemoryRecord

One deliberate memory; timestamps are UTC epoch seconds. Providers assign opaque revisions and timestamps on writes. Source records provenance, not instructions or authorization. Payloads must be JSON-safe.
Fields (— means no declared default):

MemoryScope

Trusted application/user isolation, with an optional logical namespace.
Fields (— means no declared default):

MemoryStorageError

Memory persistence failed without exposing private provider details.

MemoryStore

Async persistence contract for explicit cross-session memories. Every operation must enforce the complete scope in the datastore. Expired records are invisible. Writes and revision checks are atomic. Reads return detached records. No method may invoke models or extract memories implicitly.

MemoryStore.start

Open owned resources and initialize or validate storage.

MemoryStore.close

Release only resources owned by this provider.

MemoryStore.put

Upsert atomically, preserving creation time and assigning a new revision. None allows an unconditional write. A supplied revision must match a live record, otherwise raise MemoryConflictError, including after deletion.

MemoryStore.get

Read one live record by its fully scoped key.

MemoryStore.list

Page live records in ascending key order; limit is 1 through 100.
Page literal, case-sensitive content matches, not semantic similarity. Apply scope, query, expiry, ordering and limits in the datastore. Bounded scans may yield empty pages with a continuation cursor. Cursors are not snapshots: concurrent edits may change subsequent results.

MemoryStore.delete

Atomically remove the record and index references; return false if absent. A supplied stale revision raises MemoryConflictError. Deletion cannot erase copies already returned to callers or retained in database backups.

MemoryStore.delete_all

Physically erase a namespace, including expired records; return count. Trusted application maintenance only: no HTTP route or model tool is registered. Revoke writes first when using this for erasure, because concurrent new writes may survive. Backups and returned copies remain.

MemoryStore.delete_user

Physically erase all namespaces for one application’s user. Trusted application code must authorize the owner and revoke their writes first. Cleanup may be batched, not one global transaction; on failure retry to remove remaining records. Return the removed count.

MemoryStore.purge_expired

Physically sweep at most limit keys in ascending order for expiry. Continue while a cursor is present, even when deleted is zero. Repeat sweeps for records that expire after the cursor passes. This maintenance operation is provider-only, not automatically scheduled or model-facing.