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 "metaworkers==0.1.0"

The stable package is published on PyPI. 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.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-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metaworkers-0.1.0.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.tar.gz
Algorithm Hash digest
SHA256 0a21b47db464f02d6b810454cf48456afdc4dd5ac10a817f5e1b0b4d1a5a53f4
MD5 757ea9cc519c649299f0c99a8a895ca6
BLAKE2b-256 70a40a868d34bffd16b96c8882de00200ce157fcbc1329cb82e571250dc1b68f

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaworkers-0.1.0.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-py3-none-any.whl.

File metadata

  • Download URL: metaworkers-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for metaworkers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b7b0dcf8565e090e800b0ebb07066eab6740e1a9a97932c909ce88634e0b75d
MD5 35f1d4d05d0db9ca425d7ede8ca981bd
BLAKE2b-256 3488b08a2ebd5820d6b79ec67a44ef20bf78e89e0b7baf24fac1574436b6ce6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaworkers-0.1.0-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