Official Python SDK for Mnemexa — the Intelligent Memory OS for AI.
Project description
Mnemexa — Python SDK
Official Python SDK for Mnemexa — the Intelligent Memory OS for AI.
pip install mnemexa
Quick start
import mnemexa
client = mnemexa.Client() # reads MNEMEXA_API_KEY from the environment
# Store a memory
result = client.memory.store(text="The customer's name is Maya.")
print(result.memory_id)
# Retrieve relevant memories
recall = client.memory.retrieve(query="who is the customer?", top_k=3)
for memory in recall.memories:
print(memory.score, memory.text)
# Check workspace memory health
health = client.optimize.health()
print(f"Quality: {health.quality_score}/100, total: {health.signals.total_memories}")
Async
The same surface is mirrored under mnemexa.AsyncClient:
import asyncio
import mnemexa
async def main() -> None:
async with mnemexa.AsyncClient() as client:
result = await client.memory.store(text="The customer's name is Maya.")
print(result.memory_id)
asyncio.run(main())
Configuration
All client kwargs are optional. Precedence is explicit kwarg > environment variable > default.
| Setting | Constructor arg | Env var | Default |
|---|---|---|---|
| API key | api_key= |
MNEMEXA_API_KEY (falls back to BIZX_API_KEY) |
raises AuthenticationError |
| Base URL | base_url= |
MNEMEXA_BASE_URL (falls back to BIZX_BASE_URL) |
https://api.mnemexa.com |
| Timeout | timeout= |
— | 30.0 seconds |
| Max retries | max_retries= |
— | 2 |
client = mnemexa.Client(
api_key="mnx_...",
base_url="https://api.mnemexa.com",
timeout=15.0,
max_retries=3,
)
Endpoints
The SDK currently wraps four endpoints — full API documentation lives at docs.mnemexa.com.
| Resource | Method | Returns |
|---|---|---|
client.memory.store(text, meta) |
POST /v1/memory/store |
MemoryStoreResponse |
client.memory.retrieve(query, top_k, min_score) |
POST /v1/memory/retrieve |
MemoryRetrieveResponse |
client.optimize.health() |
GET /v1/optimize/health |
OptimizeHealthResponse |
client.status() |
GET /v1/status |
StatusResponse |
All response objects are Pydantic models with extra="allow" — future server-side fields surface automatically without breaking your code.
Error handling
Every error raised by the SDK inherits from mnemexa.MnemexaError. The hierarchy maps HTTP status codes to typed exceptions you can catch precisely:
import mnemexa
try:
client.memory.store(text="...")
except mnemexa.AuthenticationError: # 401 — invalid API key
...
except mnemexa.PermissionError: # 403 — suspended workspace
...
except mnemexa.ValidationError: # 422 — bad request body
...
except mnemexa.RateLimitError as e: # 429 — back off and retry
print(f"Retry after {e.retry_after}s")
except mnemexa.ServiceUnavailableError: # 5xx — backend transient
...
except mnemexa.MnemexaError as e: # catch-all
print(e.request_id) # always populated when available
Every error carries status_code, request_id, and the parsed response body for easy support escalation.
Retry policy
The SDK auto-retries with exponential backoff (capped at 8 seconds) on:
- Network errors and timeouts
- HTTP
502,503,504
The SDK never auto-retries 401, 403, 404, 422, or 429. For 429, inspect RateLimitError.retry_after and back off on your own schedule.
Logging
The SDK logs to a logger named mnemexa. By default no handler is attached — the host application's logging configuration is respected. Auth headers are always redacted from log lines.
import logging
logging.getLogger("mnemexa").setLevel(logging.DEBUG)
Links
- Homepage: mnemexa.com
- Documentation: docs.mnemexa.com
- Source: github.com/mnemexa/python
- Issues: github.com/mnemexa/python/issues
- Changelog: CHANGELOG.md
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
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 mnemexa-0.1.1.tar.gz.
File metadata
- Download URL: mnemexa-0.1.1.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e9111a9dd5c8a39933b91bea709779b362be020d3e02cda1383bd908880bfe
|
|
| MD5 |
2bf959b15176280e52274d0540610ea0
|
|
| BLAKE2b-256 |
fb3299b39849f4ae8cae772d8854cf3a4c0e72029a2f71be72c88092e782b4be
|
Provenance
The following attestation bundles were made for mnemexa-0.1.1.tar.gz:
Publisher:
publish.yml on mnemexa/python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnemexa-0.1.1.tar.gz -
Subject digest:
c5e9111a9dd5c8a39933b91bea709779b362be020d3e02cda1383bd908880bfe - Sigstore transparency entry: 1547611497
- Sigstore integration time:
-
Permalink:
mnemexa/python@5bf27fe2b3a370fb7fe89f2adbaeff69c2ed4ca5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mnemexa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5bf27fe2b3a370fb7fe89f2adbaeff69c2ed4ca5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mnemexa-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mnemexa-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a33e6fa683b01705b6c67498fda553f73c2934e54c8dc969496df4149346eec
|
|
| MD5 |
68b9a65a4ebf40cbb7503a3190b51f17
|
|
| BLAKE2b-256 |
dd514483be1ed579f7539f09f1598464da6ba89d85cb4064392ebdf8ffcc41af
|
Provenance
The following attestation bundles were made for mnemexa-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on mnemexa/python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mnemexa-0.1.1-py3-none-any.whl -
Subject digest:
3a33e6fa683b01705b6c67498fda553f73c2934e54c8dc969496df4149346eec - Sigstore transparency entry: 1547612378
- Sigstore integration time:
-
Permalink:
mnemexa/python@5bf27fe2b3a370fb7fe89f2adbaeff69c2ed4ca5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mnemexa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5bf27fe2b3a370fb7fe89f2adbaeff69c2ed4ca5 -
Trigger Event:
push
-
Statement type: