Skip to main content

Persistent memory for AI agents — one API key, your agent remembers everything.

Project description

remem-py

A lightweight Python SDK for Remem — persistent memory storage and retrieval for AI agents.

PyPI version Python 3.10+ License: MIT


Install

pip install Remem-py

Quick Start

from remem import RememClient

client = RememClient(api_key="remem_live_xxx")

# Store a memory
result = client.remember(
    "User prefers dark mode",
    user_id="user_123",
    agent_id="support_bot",
)
print(result.id)

# Recall relevant memories
memories = client.recall(
    "What does this user prefer?",
    user_id="user_123",
    agent_id="support_bot",
)

for memory in memories:
    print(memory.content, memory.score)

Async Support

Use AsyncRememClient for async apps and frameworks like FastAPI or LangGraph:

from remem import AsyncRememClient

async with AsyncRememClient(api_key="remem_live_xxx") as client:
    await client.remember(
        "User prefers concise responses",
        user_id="user_123",
        agent_id="support_bot",
    )

    memories = await client.recall(
        "What are this user's preferences?",
        user_id="user_123",
        agent_id="support_bot",
    )

Client Methods

Method Description
remember(...) Store a memory for a user+agent pair
recall(...) Semantic search — returns top-k memories by hybrid score
context(...) Load contextual memories at session start
list(...) List all stored memories with pagination
update(...) Update an existing memory with new content
forget(...) Delete a single memory by ID
forget_all(...) Wipe all memories for a user+agent pair
is_duplicate(...) Check whether a memory already exists before storing

Configuration

client = RememClient(
    api_key="remem_live_xxx",   # required
    base_url="https://api.remem.online",  # default
    timeout=30.0,               # seconds
)

Error Handling

from remem import (
    RememClient,
    AuthenticationError,
    PlanLimitError,
    MemoryNotFoundError,
    DuplicateMemoryError,
    RememError,
)

client = RememClient(api_key="remem_live_xxx")

try:
    result = client.remember(
        "User prefers dark mode",
        user_id="user_123",
        agent_id="support_bot",
    )

except AuthenticationError:
    print("Invalid API key")

except PlanLimitError:
    print("Memory limit reached — upgrade your plan at remem.online")

except DuplicateMemoryError:
    print("This memory already exists — skipped")

except MemoryNotFoundError:
    print("Memory ID not found")

except RememError as e:
    print(f"API error {e.status_code}: {e.detail}")

Context Manager

# Sync
with RememClient(api_key="remem_live_xxx") as client:
    client.remember("User is in Lagos", user_id="u1", agent_id="bot")

# Async
async with AsyncRememClient(api_key="remem_live_xxx") as client:
    await client.remember("User is in Lagos", user_id="u1", agent_id="bot")

LangGraph Integration

from langgraph.graph import StateGraph, MessagesState
from remem import AsyncRememClient

remem = AsyncRememClient(api_key="remem_live_xxx")


async def load_memory(state: MessagesState):
    """Load memories before the agent responds."""
    last_message = state["messages"][-1].content

    result = await remem.recall(
        query=last_message,
        user_id=state["user_id"],
        agent_id="my_agent",
    )

    context = "\n".join(m.content for m in result)
    # inject context into your prompt here
    return state


async def save_memory(state: MessagesState):
    """Save what the agent learned after responding."""
    last_message = state["messages"][-1].content

    await remem.remember(
        content=last_message,
        user_id=state["user_id"],
        agent_id="my_agent",
        memory_type="episodic",
    )
    return state


# Wire into your graph
builder = StateGraph(MessagesState)
builder.add_node("load_memory", load_memory)
builder.add_node("agent", your_agent_node)
builder.add_node("save_memory", save_memory)

builder.add_edge("load_memory", "agent")
builder.add_edge("agent", "save_memory")

Pricing

Plan Memories Requests/day Price
Free 500 100 $0/mo
Pro 50,000 10,000 $19/mo
Enterprise Unlimited Unlimited $99+/mo

Enterprise includes BYOD (Bring Your Own Database) — your data never leaves your Supabase instance.


REST API

Every method maps to a REST endpoint:

# Store
curl -X POST https://api.remem.online/memories \
  -H "X-API-Key: remem_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"content": "User prefers dark mode", "user_id": "u1", "agent_id": "bot"}'

# Search
curl "https://api.remem.online/memories/search?query=preferences&user_id=u1&agent_id=bot" \
  -H "X-API-Key: remem_live_xxx"

# Context
curl "https://api.remem.online/memories/context?user_id=u1&agent_id=bot" \
  -H "X-API-Key: remem_live_xxx"

Full API reference at remem.online/docs.


Links


Package Info

  • Package: Remem-py
  • Version: 0.1.4
  • Import: from remem import RememClient

License

MIT — see LICENSE for details.

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

remem_py-0.1.4.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

remem_py-0.1.4-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file remem_py-0.1.4.tar.gz.

File metadata

  • Download URL: remem_py-0.1.4.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for remem_py-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2dfebabde7ba39d2d930d5e0e6ec3e489e31dc9d29e9caadf8afb371235417df
MD5 ee2d9db869b5030e005ad908619cfe36
BLAKE2b-256 6c32aa109e04f0a702f5a88f1fb327a55349b7f532a7ef35d964f6525f2748cf

See more details on using hashes here.

File details

Details for the file remem_py-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: remem_py-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for remem_py-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 19b7447d8b37d4e6c34443abcef081d06b8d3f1f33799a0a5c76a4a1e64932ff
MD5 8803f50773b6030eb25088074f18a74e
BLAKE2b-256 7631ad98d1285b1053a0e649d66aa730c8af4685d4e55ffac92a576f6e02811c

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