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 MemWal Python SDK (memwal on PyPI) gives your app persistent, encrypted memory — store, recall, and analyze context across sessions. It mirrors the TypeScript MemWal client: same relayer, same Ed25519 auth, same methods.
Entry pointImportWhen to use
MemWalfrom memwal import MemWalRecommended default — async-native, relayer handles embeddings, SEAL, and storage
MemWalSyncfrom memwal import MemWalSyncScripts, notebooks, and non-async apps — same API, runs through asyncio.run()
with_memwal_langchain / with_memwal_openaifrom memwal import ...You already use LangChain or the OpenAI SDK and want memory as middleware

Installation

pip install memwal
Optional integrations:
pip install memwal[langchain]
Requires Python 3.9+. Core dependencies are httpx and PyNaCl (Ed25519 signing).

Configuration

Before wiring the SDK into your app:
  • Generate a MemWal account ID and delegate private key for your client using the hosted endpoint:
    • Production (mainnet): https://memwal.ai
    • Staging (testnet): https://staging.memwal.ai
  • Choose a relayer:
    • Use the managed relayer, selected with the env preset
    • Or pass an explicit server_url to your own relayer
MemWal.create takes the following arguments:
ArgumentTypeRequiredDefaultDescription
keystrYesEd25519 delegate private key in hex
account_idstrYesMemWalAccount object ID on Sui
server_urlstrNohttp://localhost:8000Explicit relayer URL — wins over env
namespacestrNo"default"Default namespace for memory isolation
envstrNoRelayer preset: prod / dev / staging / local

Environment presets

Instead of hardcoding a URL, pass env. Same shorthand as the TypeScript SDK and MCP package.
envRelayer URL
prodhttps://relayer.memwal.ai
devhttps://relayer.dev.memwal.ai
staginghttps://relayer.staging.memwal.ai
localhttp://127.0.0.1:8000
Precedence: an explicit non-default server_url > env > the default. An unknown preset raises ValueError.

First Memory

remember returns as soon as the relayer accepts the job (~500ms); the upload + on-chain commit run in the background. Use remember_and_wait to block until it is fully persisted.
import asyncio
import os
from memwal import MemWal

async def main():
    memwal = MemWal.create(
        key=os.environ["MEMWAL_PRIVATE_KEY"],
        account_id=os.environ["MEMWAL_ACCOUNT_ID"],
        env="prod",
        namespace="demo",
    )

    await memwal.health()
    await memwal.remember_and_wait("I live in Hanoi and prefer dark mode.")

    result = await memwal.recall("What do we know about this user?")
    for memory in result.results:
        print(memory.text, f"(distance: {memory.distance:.3f})")

    await memwal.close()

asyncio.run(main())
Prefer a synchronous style? Swap MemWal for MemWalSync and drop the awaits — see Usage.

Next Steps

  • Usage — async vs sync, namespace rules, manual methods, and middleware
  • API Reference — full method signatures and result types
  • Changelog — release history for memwal