Skip to main content

MemoryMesh SDK for durable runtime memory, checkpoints, recovery, and adapters for agent frameworks.

Project description

MemoryMesh Python SDK

MemoryMesh gives AI agents durable working memory, inspectable run receipts, checkpoints, and recovery state. The Python SDK is dependency-free by default and works in agent workers, notebooks, internal automation, or backend services.

Install

pip install memorymesh-sdk

Quick Start

import os

from memorymesh import MemoryMeshClient

client = MemoryMeshClient(
    base_url="https://api-two-blue-75.vercel.app",
    api_key=os.environ.get("MEMORYMESH_API_KEY"),
    default_memory_backend="cognee_cloud",
)

receipt = client.run_agent(
    agent_id="research",
    task="Compare durable memory options for coding agents.",
)

print(receipt["final_output"])
print(receipt["memory_operations"])

Memory

client.remember(
    text="The build agent should preserve project constraints before editing.",
    dataset="agent-lessons",
)

matches = client.recall(
    query="What should the build agent remember before editing?",
    dataset="agent-lessons",
    top_k=3,
)

Auth

The SDK defaults to the production MemoryMesh API header, X-MemoryMesh-API-Key.

client = MemoryMeshClient(
    base_url="https://your-memorymesh-api.example.com",
    api_key=os.environ["MEMORYMESH_API_KEY"],
)

For gateways that expect bearer auth:

client = MemoryMeshClient(
    base_url="https://your-memorymesh-api.example.com",
    api_key=os.environ["MEMORYMESH_API_KEY"],
    api_key_header="Authorization",
)

Tool Tracing

from memorymesh import MemoryMeshClient, ToolWrapperConfig, trace_tool

client = MemoryMeshClient("http://localhost:8000")
run = client.start_run(
    agent_id="support-agent",
    task="Investigate payment failures.",
)

@trace_tool(
    client,
    run["task_id"],
    ToolWrapperConfig(
        tool_name="fetch_tickets",
        validation=lambda args, kwargs, result: {"records": len(result)},
        checkpoint_after=True,
    ),
)
def fetch_tickets(status: str):
    return [{"id": "ticket_1", "status": status}]

fetch_tickets("open")

Error Handling

from memorymesh import MemoryMeshError

try:
    client.memory_status("cognee_cloud", probe=True)
except MemoryMeshError as error:
    print(error.status, error.detail or error.body)

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

memorymesh_sdk-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

memorymesh_sdk-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memorymesh_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for memorymesh_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3cfb5c72e817040eb388d8a1142bd6b164fb0a409f5e745c593ef512e608459
MD5 b018a0870031fdd6da97956f72e180b3
BLAKE2b-256 8949780195b79298118f986481e4b94697b96c346543b156098f11a26aabbcf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: memorymesh_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for memorymesh_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab50b0438013aceb11ad97a593c1e7bc4fb15f92609a750e348e1b90442e0785
MD5 9a9845d930d62cffb0c9b6ee10ebba34
BLAKE2b-256 3d418754167c6b0c65d080bf8c599b6163f97fe440fb4ae5e80f764585ddb503

See more details on using hashes here.

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