Python SDK for memos — persistent brain framework for AI agents
Project description
MEMOS Python SDK
Python SDK for MEMOS — persistent brain framework for AI agents.
Installation
pip install memos-ai
Publish Verification
python3 -m venv verify
source verify/bin/activate
pip install memos-ai
python3
from memos import MemosClient
print(MemosClient)
Expected output:
<class 'memos.client.MemosClient'>
Quick Start
from memos import MemosClient
client = MemosClient(
api_key="your_api_key",
agent_id="your_agent_id"
)
# Store a memory
memory = client.store_memory(
content="User prefers Python over JavaScript",
type="semantic",
importance=4
)
# Search memories
results = client.search("language preferences")
for r in results:
print(f"{r.score:.2f} — {r.content}")
# Ask with memory context
response = client.query("What language does this user prefer?")
print(response.answer)
# Trigger dream consolidation
dream = client.trigger_dream()
print(f"Created {dream.new_memories_created} new memories")
Authentication
Get your API key and agent ID from https://memos.io/dashboard
Methods Reference
| Method | Parameters | Returns | Description |
|---|---|---|---|
store_memory |
content (str), type (str="episodic"), importance (int=3), tags (list[str]=None) |
Memory |
Store a new memory for the agent |
list_memories |
None | list[Memory] |
List all memories for the agent |
delete_memory |
memory_id (str) |
bool |
Delete a specific memory by ID |
search |
query (str), search_type (str="keyword"), limit (int=10) |
list[SearchResult] |
Search agent memories |
query |
question (str), include_sources (bool=True), conversation_history (list[dict]=None) |
RAGResponse |
Ask a question using RAG |
trigger_dream |
None | DreamResult |
Trigger a dream consolidation cycle |
list_skills |
None | list[Skill] |
List all available skills in the marketplace |
execute_skill |
skill_id (str), input (str) |
SkillResult |
Execute a skill |
run_pipeline |
steps (list[dict]), input (str) |
dict |
Run a multi-step pipeline |
get_identity |
None | dict |
Get the agent's identity and reputation |
Error Handling
from memos import MemosError, AuthError, RateLimitError
try:
client.store_memory("...")
except AuthError:
print("Check your API key at memos.io/profile")
except RateLimitError:
print("Rate limit hit — slow down requests")
except MemosError as e:
print(f"API error {e.status_code}: {e.message}")
Context Manager
with MemosClient(api_key="...", agent_id="...") as client:
client.store_memory("...")
# HTTP connection closed automatically
Requirements
Python 3.11+
No additional dependencies beyond httpx.
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
memos_ai-0.2.0.tar.gz
(8.0 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 memos_ai-0.2.0.tar.gz.
File metadata
- Download URL: memos_ai-0.2.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096539ab688725fe06b6340d57ed3f0a6ad7f19061140db705f0135dd0252cff
|
|
| MD5 |
4c96c04b46ca0000f4b87f44d30d7278
|
|
| BLAKE2b-256 |
a95c70f2d9e6e11eefe1c0f06747ec70afa9f3ffe0dc76b41c8d9d75934e9af6
|
File details
Details for the file memos_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: memos_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84b2b46c89f84803bc53826c2b447dc89c55209b2db420cc52d01eef11c8fbd3
|
|
| MD5 |
659f6bd6711d793e5005a9f335151370
|
|
| BLAKE2b-256 |
a89f8e9e3cf24a7e6c2190ea58ec92aa95d26efe83c801a8a0ca7d585fd0ce9a
|