Skip to main content

Prerequisites

Before getting your API key, configure your Memory Space Scenario Mode. It influences how memories are extracted and consolidated. Learn more in the Space Scenario Mode guide.
1

Install the SDK

pip install evermemos
2

Set your API key

from evermemos import EverMemOS

memory = EverMemOS(api_key="your_api_key").v0.memories
Never commit API keys to version control. Use environment variables in production.
3

Add memories

Store conversation messages into your Memory Space for processing and retrieval.
messages = [
    {
        "message_id": "msg_001",
        "create_time": "2025-01-15T10:00:00Z",
        "sender": "user_demo_001",
        "sender_name": "Demo User",
        "group_id": "group_001",
        "content": "I like black Americano, no sugar, the stronger the better!"
    },
    {
        "message_id": "msg_002",
        "create_time": "2025-01-16T10:01:00Z",
        "sender": "user_demo_001",
        "sender_name": "Demo User",
        "group_id": "group_001",
        "content": "Today I want to discuss the project progress.",
        "flush": "true"  # set flush to true if this is the final message of the conversation
    }
]

for msg in messages:
    response = memory.add(**msg)
    print(f"Status: {response.status}, Message: {response.message}, Request ID: {response.request_id}")
4

Retrieve memories

Fetch a user’s stored memories directly by user ID.
response = memory.get(
    extra_query={"user_id": "user_demo_001"}
)

memories = response.result.memories
print(f"Fetched {len(memories) if memories else 0} memories")
5

Search memories

Find relevant memories using keyword, vector, or hybrid retrieval.
response = memory.search(
    extra_query={
        "user_id": "user_demo_001",
        "query": "coffee preference"
    }
)

total = response.result.total_count
print(f"Found {total} memories")

What’s Next?

Need help? Join our community.