Skip to main content
MemLayer is a Memory-as-a-Service API that gives your AI agents a persistent memory layer across every conversation. Instead of starting from scratch on each session, your agent stores, retrieves, and scores memories so it always knows who it’s talking to and what matters most. One API key is all you need to get started.

Introduction

Learn how MemLayer works, what memory types are available, and why persistent memory transforms your agent’s usefulness.

Quick Start

Install the SDK, store your first memory, and retrieve it with semantic search — all in under 5 minutes.

API Reference

Explore every endpoint: store, recall, context, update, forget, and more — with full request and response schemas.

Guides

Follow practical, goal-oriented guides for common patterns like session context injection and duplicate detection.

Get up and running in three steps

1

Sign up for a free account

Visit memlayer.online and create your account. The free plan activates instantly — no credit card required. Copy your API key from the dashboard; it starts with ml_live_.
2

Install the Python SDK

Install the MemLayer SDK from PyPI with a single command.
pip install memlayer-py
3

Store and retrieve your first memory

Initialize the client with your API key, store a memory, and immediately retrieve it with a semantic query.
from memlayer import MemLayerClient

client = MemLayerClient(
    api_key="ml_live_xxx",
    base_url="https://memlayer.online"
)

# Store a memory for a specific user and agent
result = client.remember(
    "User prefers dark mode and concise replies",
    user_id="user_123",
    agent_id="support_bot",
    memory_type="semantic",
    importance=0.8
)
print(result.id)           # unique memory ID
print(result.is_duplicate) # True if memory already existed

# Retrieve relevant memories with a natural-language query
memories = client.recall(
    "what are this user's preferences?",
    user_id="user_123",
    agent_id="support_bot"
)

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