Skip to main content

Thin Python client for a self-hosted GovernedMemory REST API server

Project description

metaworkers

Thin Python client for a self-hosted GovernedMemory REST API server.

No third-party dependencies — stdlib urllib.request only. This talks to a running server over HTTP; it doesn't touch Postgres or any governance logic directly. Run the server first (see the main repo's deploy/docker-compose.yml), then:

python -m pip install "git+https://github.com/Metaworkers-ai/governedmemory.git@main#subdirectory=sdk/python"

The first PyPI release is not live yet. For local source changes, use python -m pip install -e ./sdk/python from the repository root. The package is stdlib-only and does not install Postgres, FastAPI, or a local embedding stack.

from metaworkers import GovernedMemory, Source

mem = GovernedMemory(base_url="http://localhost:8000", api_key="some-secret-key")

mem.write(
    customer_id="cust-1", agent_id="cx-1", session_id="s-1",
    content="customer prefers email contact",
    source=Source(type="user", ref="msg-1001", confidence=0.9),
    purpose=["cx_support"],
)

results = mem.retrieve(
    query="how does this customer want to be contacted?",
    agent_id="cx-1", session_id="s-1", purpose="cx_support", k=5,
)

mem.quarantine("mem-uuid")
mem.delete("mem-uuid")
events = mem.audit()

# E6 — provenance lineage + cascade purge
lineage = mem.provenance("mem-uuid")          # {memory_id, ancestors, descendants}
plan = mem.cascade_preview("mem-uuid")        # dry run: what cascade delete would remove
mem.delete("mem-uuid", cascade=True)          # hard-delete it and everything derived from it

# Listing (no query/ranking/gate — plain reads)
customers = mem.list_customers()
memories = mem.list_memories("cust-1")

Status

Covers every route the server (E7) exposes: write, retrieve, quarantine, delete (including cascade=True, backed by E6's provenance graph), cascade_preview, provenance, audit, list_customers, and list_memories.

Errors

Any non-2xx response raises metaworkers.GovernedMemoryError, with .status_code and .detail from the server's response. Connection-level failures (server unreachable, timeout) raise the underlying urllib.error.URLError instead.

Mem0 adapter

For the supported synchronous Mem0 OSS client, see docs/integrations/mem0.md. The adapter keeps Mem0 as the memory system of record and adds GovernedMemory evaluation, external-ID bindings, quarantine, and audit metadata around the existing add() and search() calls.

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

metaworkers-0.1.0.dev1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

metaworkers-0.1.0.dev1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file metaworkers-0.1.0.dev1.tar.gz.

File metadata

  • Download URL: metaworkers-0.1.0.dev1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for metaworkers-0.1.0.dev1.tar.gz
Algorithm Hash digest
SHA256 cfe55bb9d53764a10a8198cf1683d684c7d1e3d334db5c6fc907c5afccaa4dad
MD5 c434d7cf76465e8016b8d61b4ee6db25
BLAKE2b-256 c2fb0d65811dad5b99988728a4fc506af7eb0afce65bb56add142f5ac6610477

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaworkers-0.1.0.dev1.tar.gz:

Publisher: publish-python.yml on Metaworkers-ai/governedmemory

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

File details

Details for the file metaworkers-0.1.0.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for metaworkers-0.1.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 8bd18797c383846bbdabded92fd26522429c8cd48604717bfe0d7ab0498b29a3
MD5 824141be9df19fbf03d68cd088a34268
BLAKE2b-256 5ebb0c24da88257422635bc4821be7adb5d0babbf01ad539efef93486efbbcbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaworkers-0.1.0.dev1-py3-none-any.whl:

Publisher: publish-python.yml on Metaworkers-ai/governedmemory

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