Documentation Index
Fetch the complete documentation index at: https://docs.openmem.blog/llms.txt
Use this file to discover all available pages before exploring further.
AsyncMemory is the async/await OMP client. It mirrors Memory exactly — same constructor arguments, same method signatures — but every verb is a coroutine that you await. It is designed for use in asyncio-based applications such as FastAPI, LangChain async pipelines, or any async agent framework.
Installation
The async client requires the[async] extras, which pull in asyncpg and httpx:
Import
Importing
openmem itself does not load any async dependencies. AsyncMemory is only resolved when you import it. If asyncpg is not installed, the import raises a clear ImportError with the exact install instruction to run.Constructor
The constructor is identical toMemory:
**config arguments are the same as for Memory. One additional keyword argument is available for async-only tuning:
executor_max_workers (threadwrap providers only)
executor_max_workers (threadwrap providers only)
Maximum number of worker threads in the
ThreadPoolExecutor used for mem0, supermemory, and letta providers. Defaults to the Python default (min(32, os.cpu_count() + 4)). Ignored by native async providers (postgres, passthrough).Context manager (recommended)
The preferred way to useAsyncMemory is as an async context manager. This ensures connection pools and HTTP clients are cleanly shut down when you are done:
close() explicitly:
Methods
All methods onAsyncMemory are coroutines with signatures identical to their Memory counterparts. Every call must be awaited.
Sync (Memory) | Async (AsyncMemory) |
|---|---|
mem.add(...) | await mem.add(...) |
mem.search(...) | await mem.search(...) |
mem.get(id) | await mem.get(id) |
mem.update(id, ...) | await mem.update(id, ...) |
mem.delete(id) | await mem.delete(id) |
mem.list(user_id, ...) | await mem.list(user_id, ...) |
mem.context(query, ...) | await mem.context(query, ...) |
mem.audit(user_id, ...) | await mem.audit(user_id, ...) |
mem.capabilities() | await mem.capabilities() |
Provider async implementation
Different providers use different strategies to deliver async I/O:| Provider | Async backend | Cancellation |
|---|---|---|
postgres | asyncpg (native async) | within 50 ms |
passthrough | httpx async (native async) | within 50 ms |
mem0 | ThreadPoolExecutor wrap | returns to awaiter immediately |
supermemory | ThreadPoolExecutor wrap | returns to awaiter immediately |
letta | ThreadPoolExecutor wrap | returns to awaiter immediately |
For
mem0, supermemory, and letta, the SDK wraps the synchronous adapter in a ThreadPoolExecutor. These providers do not support true async cancellation — asyncio.CancelledError returns control to the awaiter immediately, but the background thread may continue running until the network request completes.Cross-loop safety
AsyncMemory is bound to the event loop on the first verb call (or __aenter__). If you attempt to use the same instance on a different event loop, it raises: