Skip to main content

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.8+ No additional dependencies beyond httpx.

License

MIT

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

memos_ai-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

memos_ai-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file memos_ai-0.1.0.tar.gz.

File metadata

  • Download URL: memos_ai-0.1.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

Hashes for memos_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8dcac7d3647f8092d922804f6a29c8d1f89f114c7561e9035d33ef4cd9cf9331
MD5 a7da58882b5cbf04ee5fd4664f7c1d85
BLAKE2b-256 3dabe3affe2daf30755b5c69775a8846f3b354386ecdf0139b6cab8192a53988

See more details on using hashes here.

File details

Details for the file memos_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: memos_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for memos_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02906d1c420b9e3df297409ccc924e8b8f4eb68ad483abd5767335bb86889030
MD5 9f35fffeaaadb8a5cce72fc3a05b2b99
BLAKE2b-256 3625cb50031f7416111945666197f821ebf2a4824c73c245d323eed5489af947

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