Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.memwal.ai/llms.txt

Use this file to discover all available pages before exploring further.

The Python SDK exposes one relayer-backed client in two forms, plus middleware:
Entry pointImportWhen to use
MemWalfrom memwal import MemWalRecommended default — async-native; relayer handles embeddings, SEAL, and storage
MemWalSyncfrom memwal import MemWalSyncSame API surface, synchronous — scripts, notebooks, non-async apps
with_memwal_langchain / with_memwal_openaifrom memwal import ...Automatic recall + save as middleware around an existing LLM client
Detailed pages:
  • MemWal — the default async/sync client and its core methods
  • Manual methods — lower-level remember_manual / recall_manual / embed
  • with_memwal — LangChain and OpenAI middleware

Async vs Sync

MemWal is async-native. Every API method is a coroutine:
from memwal import MemWal

memwal = MemWal.create(key="...", account_id="0x...", env="prod")
job = await memwal.remember("User prefers dark mode.")
result = await memwal.recall("preferences")
await memwal.close()
MemWalSync wraps it through asyncio.run() — identical methods, no await. It is notebook-safe (detects a running loop and offloads to a worker thread):
from memwal import MemWalSync

client = MemWalSync.create(key="...", account_id="0x...", env="prod")
client.remember("User prefers dark mode.")
result = client.recall("preferences")
client.close()
Both support context managers (async with MemWal.create(...) / with MemWalSync.create(...)) which close the underlying HTTP client on exit.

Namespace Rules

  • Set a default namespace in create(...) when one app or agent uses one boundary
  • Pass namespace= per call when one client needs multiple boundaries
  • If omitted, namespace falls back to the client config, then to "default"
Good namespace examples: todo, personal, password, project-x. Avoid keeping everything in "default" after early testing.

Async Remember Model

remember returns a RememberAcceptedResult (job_id, status) as soon as the relayer accepts the request — the Walrus upload and on-chain commit happen in a background worker. Three ways to consume it:
# 1. Fire and forget the wait — poll later if you need the blob_id
accepted = await memwal.remember("Fact A")

# 2. Submit + poll to completion in one call
done = await memwal.remember_and_wait("Fact B")
print(done.blob_id)

# 3. Poll an earlier job yourself
done = await memwal.wait_for_remember_job(accepted.job_id)
Bulk (up to 20 items per call) follows the same pattern with remember_bulk_async, wait_for_remember_jobs, and remember_bulk_and_wait. Polling uses jittered exponential backoff (1.5× capped at 10s, ±25%) to stay relayer-friendly at scale.