Skip to main content

Agent Memory Relay — persistent long-term memory for AI agents

Project description

MrMemory — Agent Memory Relay

PyPI License Docs

Persistent long-term memory for AI agents. One line to install, three lines to integrate.

Docs · API Reference · Website

Install

pip install mrmemory

# With LangChain/LangGraph support:
pip install mrmemory[langchain]

Quickstart

from amr import AMR

amr = AMR("amr_sk_...")  # or set AMR_API_KEY env var

# Store a memory
amr.remember("User prefers dark mode and vim keybindings")

# Semantic recall
memories = amr.recall("What are the user's preferences?")
for m in memories:
    print(m.content, m.score)

# Forget a memory
amr.forget(memories[0].id)

LLM Auto-Remember

Extract memories from conversations automatically using GPT-4o-mini:

# Extract and store memories from a conversation
result = amr.auto_remember([
    {"role": "user", "content": "I love hiking and my favorite language is Rust"},
    {"role": "assistant", "content": "Great choices!"},
], sync=True)

print(result)  # {"extracted": 2, "created": 2, "duplicates_skipped": 0, ...}

Supports async mode (fire-and-forget), deduplication, and BYOK (bring your own OpenAI key).

Memory Compression

Compress related memories into denser representations:

# Compress memories in a namespace (dry run first)
result = amr.compress(namespace="default", sync=True, dry_run=True)
print(f"Would compress {result['groups_compressed']} groups")

# Actually compress
result = amr.compress(namespace="default", sync=True)
print(f"Reduced {result['before_count']}{result['after_count']} memories")

LangChain / LangGraph Integration

Drop-in checkpointer and store for LangGraph:

from mrmemory.langchain import MrMemoryCheckpointer, MrMemoryStore
from langgraph.graph import StateGraph

checkpointer = MrMemoryCheckpointer(api_key="amr_sk_...")
store = MrMemoryStore(api_key="amr_sk_...")

graph = StateGraph(...).compile(checkpointer=checkpointer, store=store)

Async Support

from amr import AsyncAMR

async with AsyncAMR("amr_sk_...") as amr:
    await amr.remember("User prefers dark mode")
    memories = await amr.recall("What does the user prefer?")

Configuration

amr = AMR(
    api_key="amr_sk_...",       # or set AMR_API_KEY env var
    agent_id="my-assistant",    # default agent ID
    namespace="default",        # default namespace
    timeout=10.0,               # seconds
    max_retries=3,              # retry on transient failures
)

API Endpoints

All requests go to https://amr-memory-api.fly.dev.

Method Endpoint Description
POST /v1/remember Store a memory
POST /v1/recall Semantic search
DELETE /v1/forget/:id Delete a memory
GET /v1/memories List all memories
POST /v1/memories/auto LLM auto-remember from conversations
POST /v1/memories/compress Compress related memories
GET /v1/ws WebSocket real-time events

Auth: Authorization: Bearer amr_sk_...

Pricing

Starts at $5/mo — 10K memories, 50K API calls. Sign up →

Links

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

mrmemory-0.4.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

mrmemory-0.4.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file mrmemory-0.4.0.tar.gz.

File metadata

  • Download URL: mrmemory-0.4.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for mrmemory-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1bcce82356d55117aad21a254c8a7bb619fe8384d9fcde796d169454f0e94a3b
MD5 3a7d1a65af91427fc96e881ba9be452a
BLAKE2b-256 c611f34ea34e9deaf6d85ee3646aa39f827ef850bb72b389919eceb9e610e607

See more details on using hashes here.

File details

Details for the file mrmemory-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: mrmemory-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for mrmemory-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e495b35defbbf1b08d4d91a3abf1478bb1bec12e4b87b63fed556ce274d758b
MD5 bebba0de3cd18f20f9c203f86edcee51
BLAKE2b-256 1d580aed7eb870a562775d176bd0acb58fb7516b4ccfec3290304cf27fee6d9e

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