Skip to main content

Official Python SDK for the MemoClaw memory API

Project description

MemoClaw Python SDK

Official Python SDK for the MemoClaw memory API — semantic memory for AI agents.

Installation

pip install memoclaw

To enable automatic x402 payments (when free tier is exhausted):

pip install "memoclaw[x402]"

Quickstart

from memoclaw import MemoClaw

# Uses MEMOCLAW_PRIVATE_KEY env var, or pass directly
client = MemoClaw(private_key="0x...")

# Store a memory
result = client.store(
    "User prefers dark mode and tabs over spaces",
    importance=0.8,
    tags=["preferences", "editor"],
)
print(result.id)  # mem-abc-123

# Recall memories by semantic search
memories = client.recall("code editor preferences", limit=5)
for m in memories.memories:
    print(f"{m.content} (similarity: {m.similarity:.2f})")

# Update a memory
updated = client.update(result.id, importance=0.95)

# Delete a memory
client.delete(result.id)

Authentication

MemoClaw uses Ethereum wallet signatures for authentication. You need a private key (any Ethereum key works — no ETH balance needed for the free tier).

# Generate a new key (one-time)
python -c "from eth_account import Account; a = Account.create(); print(f'MEMOCLAW_PRIVATE_KEY={a.key.hex()}')"

Set the environment variable:

export MEMOCLAW_PRIVATE_KEY=0x...

Every wallet gets 1,000 free API calls. After that, the SDK automatically handles x402 micropayments if x402 extras are installed.

Async Support

from memoclaw import AsyncMemoClaw

async def main():
    async with AsyncMemoClaw() as client:
        result = await client.store("Async memory")
        memories = await client.recall("async")

All Methods

Method Description
store(content, **kwargs) Store a single memory
store_batch(memories) Store up to 100 memories
recall(query, **kwargs) Semantic search
list(**kwargs) List memories with pagination
update(memory_id, **kwargs) Update a memory
delete(memory_id) Delete a memory
ingest(**kwargs) Auto-extract facts from conversation
extract(messages, **kwargs) Extract structured facts via LLM
consolidate(**kwargs) Merge similar memories
suggested(**kwargs) Get proactive memory suggestions
create_relation(memory_id, target_id, relation_type) Create a relationship
list_relations(memory_id) List relationships
delete_relation(memory_id, relation_id) Delete a relationship
status() Check free tier remaining calls

Error Handling

from memoclaw import MemoClaw, NotFoundError, RateLimitError

client = MemoClaw()

try:
    client.delete("nonexistent-id")
except NotFoundError as e:
    print(f"Memory not found: {e.message}")
except RateLimitError as e:
    print(f"Rate limited: {e.message}")

Configuration

client = MemoClaw(
    private_key="0x...",               # or MEMOCLAW_PRIVATE_KEY env var
    base_url="http://localhost:3000",   # for local development
    timeout=60.0,                       # request timeout in seconds
)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memoclaw-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memoclaw-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file memoclaw-0.1.0.tar.gz.

File metadata

  • Download URL: memoclaw-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for memoclaw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 784a6ecbb51b80ff5102a32346b4242f939e6eee526cafefa7a0ab85a5c53990
MD5 848d85eb0f004cdc17afdb7046bda031
BLAKE2b-256 0cedfa0c0bb0f94f54a4ea46bd14e0883f94a653c2cfed91f4b3d9f1f7ef6ef5

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoclaw-0.1.0.tar.gz:

Publisher: publish-python.yml on anajuliabit/memoclaw-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memoclaw-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: memoclaw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for memoclaw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b3ba908ad883b8fb61199aac85e1e0238b03425c52896904b982844cd16557d
MD5 58f0c5a1ec48ef595c57fc3ccd2bc7c6
BLAKE2b-256 bad69c58cec7d9aabe2d5a0cade7e202143ab8f80cdb24b720ce6c89ccdb2add

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoclaw-0.1.0-py3-none-any.whl:

Publisher: publish-python.yml on anajuliabit/memoclaw-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page