Skip to main content

mnemosyne-sdk

PyPI version Python versions License: MIT CI

The official Python client for the Mnemosyne memory substrate. Synchronous and async APIs, container-scoped storage, hybrid BM25+vector recall, full type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx.

Mnemosyne gives any AI system persistent identity, episodic recall, contradiction resolution, metacognition, and a self-model that compounds across sessions. This SDK is the thin HTTP client that talks to a Mnemosyne Cloud or self-hosted Mnemosyne instance.

Install

pip install mnemosyne-sdk
# or
uv add mnemosyne-sdk
# or
poetry add mnemosyne-sdk

Quick start

from mnemosyne_sdk import Mnemosyne

mn = Mnemosyne(
    api_key="mn_...",  # from your Mnemosyne dashboard
    # base_url="https://api.mnemosyne.geasslabs.xyz",  # default
)

# Save a memory
memory = mn.add(
    "The dock-A camera lost calibration at 14:32 UTC",
    container_tag="fleet-ops",
    metadata={"severity": "high"},
)
print(memory.id)

# Search
results = mn.search("when did dock A fail?", container_tag="fleet-ops")
for r in results:
    print(f"{r.score:.3f}  {r.content}")

# Get / delete
one = mn.get(memory.id)
mn.delete(memory.id)

Async client

import asyncio
from mnemosyne_sdk import AsyncMnemosyne

async def main():
    async with AsyncMnemosyne(api_key="mn_...") as mn:
        await mn.add("...", container_tag="fleet-ops")
        results = await mn.search("query", container_tag="fleet-ops")

asyncio.run(main())

The async client shares the same httpx connection pool and is recommended for high-throughput agents.

Function-calling tools

from mnemosyne_sdk import TOOLS, execute_tool

# Pass TOOLS to any OpenAI-compatible function-calling API
response = client.chat.completions.create(
    model="gpt-4",
    messages=[...],
    tools=TOOLS,
)

# Execute a tool call from the model's response
for call in response.choices[0].message.tool_calls:
    result = execute_tool(
        call.function.name,
        call.function.arguments,
        base_url="https://api.mnemosyne.geasslabs.xyz",
        api_key="mn_...",
    )

Framework adapters

This package is the core client. For framework-specific integrations, install one of the dedicated adapter packages:

Framework Package Install
LangChain / LangGraph mnemosyne-langchain pip install mnemosyne-sdk[langchain]
CrewAI mnemosyne-crewai pip install mnemosyne-sdk[crewai]
AutoGen v0.4 mnemosyne-autogen pip install mnemosyne-sdk[autogen]
OpenAI Agents SDK mnemosyne-openai-agents pip install mnemosyne-sdk[openai-agents]

Or install everything: pip install mnemosyne-sdk[all].

Error handling

from mnemosyne_sdk import Mnemosyne, AuthenticationError, RateLimitError

mn = Mnemosyne(api_key="...")

try:
    mn.add("...")
except AuthenticationError:
    ...  # bad API key
except RateLimitError as e:
    time.sleep(e.retry_after or 1)
    ...  # back off

All errors inherit from MnemosyneError.

Configuration

Env var Description Default
MNEMOSYNE_API_KEY API key (overridden by constructor) -
MNEMOSYNE_BASE_URL Server URL https://api.mnemosyne.geasslabs.xyz
MNEMOSYNE_CONTAINER Default container tag default

Development

git clone https://github.com/synet-systems/mnemosyne
cd mnemosyne/packages/mnemosyne-sdk-python
uv sync --all-extras
uv run pytest

License

MIT © Geass Labs. The Mnemosyne engine this SDK talks to is licensed under the Mnemosyne Source-Available License v1.0. See NOTICE for the dual-license arrangement.

Metadata

Release files for mnemosyne-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mnemosyne-sdk 0.1.1
File Size Uploaded Provenance Actions
mnemosyne_sdk-0.1.1.tar.gz 7.2 kB Without provenance Details for mnemosyne_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mnemosyne-sdk 0.1.1
File Interpreter ABI Platform Actions
mnemosyne_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for mnemosyne_sdk-0.1.1-py3-none-any.whl

Total release size: 14.6 kB

Release files / mnemosyne_sdk-0.1.1.tar.gz

Download URL mnemosyne_sdk-0.1.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
805b3e232edf827e8b1bae6e65e4221ade1c482dd2701e629b570a33ef72e183
BLAKE2b-256 checksum
How to use checksums
6b84abdaa3164a331fe7df9d3bd1e38bc71cfe06774ac1c12aa86647bf8422dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / mnemosyne_sdk-0.1.1-py3-none-any.whl

Download URL mnemosyne_sdk-0.1.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5049875ace2b643a607fbfb1eb1b719f23c6af963d19b9ec0ec278d7acf0ced4
BLAKE2b-256 checksum
How to use checksums
03407b0028a9e7cf924b3f2f2ae1dc00cfde5943923bba634fed8fcf0966c77e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for mnemosyne-sdk 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page