Skip to main content

Official Python SDK for Mnemexa — the Intelligent Memory OS for AI.

Project description

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

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

mnemexa-0.1.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

mnemexa-0.1.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

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

Hashes for mnemexa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5e9111a9dd5c8a39933b91bea709779b362be020d3e02cda1383bd908880bfe
MD5 2bf959b15176280e52274d0540610ea0
BLAKE2b-256 fb3299b39849f4ae8cae772d8854cf3a4c0e72029a2f71be72c88092e782b4be

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnemexa-0.1.1.tar.gz:

Publisher: publish.yml on mnemexa/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for mnemexa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a33e6fa683b01705b6c67498fda553f73c2934e54c8dc969496df4149346eec
MD5 68b9a65a4ebf40cbb7503a3190b51f17
BLAKE2b-256 dd514483be1ed579f7539f09f1598464da6ba89d85cb4064392ebdf8ffcc41af

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnemexa-0.1.1-py3-none-any.whl:

Publisher: publish.yml on mnemexa/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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