Official Python SDK for MemryAPI — Memory-as-a-Service for AI Applications.
Project description
MemryAPI Python SDK
The Sovereign Persistence Layer for AI Agents.
Installation
pip install memryapi
Quick Start
from memryapi import MemryAPI
client = MemryAPI("your-api-key")
# Store a memory
client.remember("user-123", "Prefers dark chocolate over milk chocolate")
# Recall memories by semantic similarity
result = client.recall("user-123", "What chocolate do they like?")
print(result.results[0].content)
# → "Prefers dark chocolate over milk chocolate"
Session Helper
Avoid repeating user_id on every call:
session = client.session("user-123")
session.remember("Has a golden retriever named Max")
session.remember("Works remotely from Austin, TX")
memories = session.recall("pets")
summary = session.summarize()
LLM Wrapper (Experimental)
Automatically inject memory context into your LLM calls:
from openai import OpenAI
openai = OpenAI()
def ask(context: str) -> str:
response = openai.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": f"User context:\n{context}"},
{"role": "user", "content": "What should I get them for their birthday?"},
],
)
return response.choices[0].message.content
# Recalls memories, passes as context, saves the AI response
answer = client.wrap("user-123", ask, query="preferences interests")
Context Manager
with MemryAPI("your-api-key") as client:
client.remember("user-123", "Some fact")
result = client.recall("user-123", "query")
# HTTP client is automatically closed
API Reference
| Method | Description |
|---|---|
remember(user_id, text, metadata) |
Store a memory |
recall(user_id, query, top_k, threshold, time_weight) |
Semantic recall |
forget(memory_id) |
Delete a specific memory |
forget_all(user_id) |
Delete all user memories |
summarize(user_id, limit, save_as_memory) |
AI-powered summary |
session(user_id) |
Session-scoped client |
wrap(user_id, fn, query) |
Auto memory-augmented LLM calls |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
memryapi-1.0.0.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memryapi-1.0.0.tar.gz.
File metadata
- Download URL: memryapi-1.0.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90d3a084672d9bea19e13c4b114dcf43e244c2848bb71b9191de6a529568e2d3
|
|
| MD5 |
f0458eaa207d29c81d52c63a3eb563d2
|
|
| BLAKE2b-256 |
cfe7fd50b8db59709d9ff8392695887e771fedfc6a81642a70c94fcdc2bddc35
|
File details
Details for the file memryapi-1.0.0-py3-none-any.whl.
File metadata
- Download URL: memryapi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d18ba0b16c702f309c37d393a20cf6bbfadf9e1b70093da0e145a1f6efed62d1
|
|
| MD5 |
1008a73065230d45e379804e43006f4f
|
|
| BLAKE2b-256 |
3f4bed91074433480a92085baf57ccad7c1e67abc0a65001e44f283f6da7a0ac
|