For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK Reference

The Membase Python API at a glance (unibase-membase-sdk). Import everything from the top-level package:

from unibase_membase import Membase, Wallet

Wallet

Call
Returns
Notes

Wallet.from_env()

Wallet

from MEMBASE_PRIVATE_KEY

Wallet.from_key("0x…")

Wallet

from a raw private key

Wallet.generate()

Wallet

fresh keypair

wallet.address

str

the agent's identity (0x…)

Agent

agent = Membase(wallet, config=None, *, hub=None, server_url="")
  • config — optional Config / dict (see below); defaults otherwise.

  • hub — inject a custom storage backend; defaults to the official Hub.

  • server_url — set to enable metering / settlement via a Membase Server.

  • agent.address — the wallet address. agent.close() — flush & release.

Memory — key-value

agent.private()                       # → handle for this wallet's private domain
handle.set(key: str, value)           # value: JSON-serializable
handle.get(key: str, *, author=None)  # → value | None

key is a path-like string (e.g. "notes/today"). private() is a single-member domain — only this wallet can decrypt.

Memory — recall

ingest / answer need the recovery,runtime extras + an LLM key. query_date (ISO YYYY-MM-DD) scopes results to facts valid on that date.

Domains (shared memory)

See Domains & Encryption.

Cooperation (multi-agent)

The agent-direct protocol (signed logs, sessions, games) lives under unibase_membase.core.protocol and unibase_membase.games (rps, vote, auction, compare). For a server-mediated coordination API use Cooperation / MembaseClient. See Cooperation Protocol and examples/04_protocol.py.

Settlement (server-mediated)

See Settlement.

Configuration

Pass a dict or Config instead of env vars (secrets stay in env):

Config.from_json("path.json") and Config.from_dict({...}) also work. Unknown keys raise (typos won't pass silently).

Full, runnable examples: examples/ (grouped by layer: persistence → recovery → runtime → cooperation).

Last updated