Skip to main content

Python SDK for the MemAura memory service

Project description

MemAura Python SDK

memaura is the Python SDK for MemAura. It lets an AI application store conversations and retrieve the relevant memories later.

Languages: English | 中文

Install

pip install memaura

Before You Start

Create an API key in the MemAura dashboard. If your account uses a bring-your-own-model policy, configure an LLM provider and model there before writing memory.

Quick Start

from memaura import Memory

memory = Memory(api_key="qbk_xxx")

job = memory.add("conv-001", [
    {"role": "user", "content": "Caroline is visiting Seattle next week."},
    {"role": "assistant", "content": "I will remember that."},
])

awaited = memory.jobs.wait(job.job_id)

# Processing is asynchronous. Use wait=True when the next step needs the result now.
result = memory.search("Where is Caroline going next week?")
for item in result:
    print(item.text)

API

Memory

Memory(api_key, *, endpoint=None, device_no=None, timeout_s=30.0)
Parameter Description
api_key Required MemAura API key.
endpoint Optional MemAura-compatible gateway URL. The default is the cloud gateway.
device_no Optional device identifier. When present, requests use the device-scoped memory namespace.
timeout_s Per-request timeout in seconds.

add(conversation_id, messages, *, commit_id=None, group_id=None, group_name=None, device_no=None, wait=False, timeout_s=60.0)

Stores a complete conversation and always returns an AddResult acknowledgement with the ingest job_id, session_id, status, and status_url. With wait=True, completed is true only for successful terminal statuses such as succeeded or accumulated.

Each message accepts role, content, optional turn_id, timestamp, name, and refer_list. The Router-compatible aliases id / uuid and referList are accepted too.

result = memory.add(
    "conv-002",
    [{"role": "user", "content": "I prefer morning meetings."}],
    commit_id="conv-002:turn-1",
    wait=True,
)
if result and result.completed:
    print(result.job_id)

search(query, *, limit=10, group_id=None, session_id=None, fail_silent=False)

Retrieves account-scoped memory. group_id narrows the search to the supplied memory group; session_id remains a compatibility alias. With fail_silent=True, errors return an empty SearchResult whose error field explains the failure.

search() always uses the regular retrieval endpoint. Use search_hybrid() explicitly when hybrid retrieval is intended; this remains true even when a default device_no is configured.

result = memory.search("What meeting time do I prefer?", group_id="conv-002")
print(result.to_prompt())

search_hybrid(query, *, device_no=None, limit=10, group_id=None, session_id=None, fail_silent=False)

Runs device-scoped hybrid retrieval. Supply device_no here or when creating Memory.

result = memory.search_hybrid(
    "What did this device remember?",
    device_no="device-001",
)

memory.jobs.get(job_id) and memory.jobs.wait(job_id, *, timeout_s=60.0, poll_interval_s=0.5)

Reads or waits for an ingest job without submitting another write. Waiting stops at both successful (succeeded, accumulated, completed) and unsuccessful terminal statuses; inspect status to distinguish them.

status = memory.jobs.get(job.job_id)
terminal = memory.jobs.wait(job.job_id, timeout_s=60)

Conversation Buffer

Use a buffer when messages arrive one at a time.

with memory.conversation("conv-003") as conversation:
    conversation.add({"role": "user", "content": "I enjoy coffee."})
    conversation.add({"role": "assistant", "content": "Noted."})

Leaving the context commits buffered messages. conversation.commit(wait=True) waits for the corresponding ingest job.

Result Models

Model Description
MemoryItem Compatibility projection with text, score, timestamp, source, and entities.
EvidenceDetail Normalized Router evidence with event, group, role, speaker, facts, and timestamp.
SearchResult Iterable result container with items, evidence_details, latency, error, and to_prompt().
AddResult Ingest acknowledgement with conversation, job, session, status, and completion fields.

Error Handling

from memaura import MemAuraClientError, MemAuraRateLimitError

try:
    memory.search("recent preferences")
except MemAuraRateLimitError as exc:
    print(exc.retry_after_s)
except MemAuraClientError as exc:
    print(exc)

Project Docs

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

memaura-0.0.1.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

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

memaura-0.0.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file memaura-0.0.1.tar.gz.

File metadata

  • Download URL: memaura-0.0.1.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memaura-0.0.1.tar.gz
Algorithm Hash digest
SHA256 95f2d5b0ae4bd7827c333c53e9f1fa9e590a3fc6bec42f28ea7621a924e5087e
MD5 dd6374c927f4a11e7761ff277b921f28
BLAKE2b-256 13c2ba611edc86055359d0ba38cf073a3d41e7c0f982c2300976edcb52c15781

See more details on using hashes here.

Provenance

The following attestation bundles were made for memaura-0.0.1.tar.gz:

Publisher: python-sdk-pypi-release.yml on Omnimemory/python-sdk

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

File details

Details for the file memaura-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: memaura-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memaura-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fd3bce5f9d06f567148088faede6bdb4141409d89e8cebc7bfff525cdbfccde
MD5 8481d315fdd35ad1f5cf378b29949b22
BLAKE2b-256 fa903a818036e0a8ba1e64a60be770a092acd58ff40a6e197154138f696b1732

See more details on using hashes here.

Provenance

The following attestation bundles were made for memaura-0.0.1-py3-none-any.whl:

Publisher: python-sdk-pypi-release.yml on Omnimemory/python-sdk

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