Skip to main content

Mnemexa — Python SDK

PyPI Python License: MIT

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

License

MIT

Release files for mnemexa 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 mnemexa 0.1.1
File Size Uploaded
mnemexa-0.1.1.tar.gz 16.1 kB Details

Built distribution (wheel)

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

Total release size: 33.1 kB

Release files / mnemexa-0.1.1.tar.gz

Download URL mnemexa-0.1.1.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c5e9111a9dd5c8a39933b91bea709779b362be020d3e02cda1383bd908880bfe
BLAKE2b-256 checksum
How to use checksums
fb3299b39849f4ae8cae772d8854cf3a4c0e72029a2f71be72c88092e782b4be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 15, 2026.

Transparency log

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

Download URL mnemexa-0.1.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a33e6fa683b01705b6c67498fda553f73c2934e54c8dc969496df4149346eec
BLAKE2b-256 checksum
How to use checksums
dd514483be1ed579f7539f09f1598464da6ba89d85cb4064392ebdf8ffcc41af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.1

2 release files

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