Skip to main content

UAMS SDK

The official asynchronous Python client and Model Context Protocol (MCP) server for the Unified Agent Memory System.

UAMS gives Codex, Claude, Hermes, OpenClaw, VoiceAI, and custom agents one shared memory for facts, decisions, procedures, exact profiles, entity relationships, and bug-fix history. The SDK provides a common task lifecycle so agents retrieve relevant knowledge before work and store distilled outcomes afterward.

This package is the client and MCP integration layer. It connects to a running UAMS server; it does not bundle PostgreSQL, Qdrant, Ollama, or the Markdown vault.

Installation

pip install uams-sdk

Python 3.11 or newer is required. Install and start the self-hosted UAMS server by following the server installation guide. The default API address is http://127.0.0.1:8000.

Why UAMS Uses Multiple Stores

The server keeps Markdown authoritative and treats its databases as rebuildable projections:

  • PostgreSQL owns exact and current revision truth, full-text retrieval, durable jobs, graph evidence, and exact profiles.
  • Qdrant owns semantic vector similarity, including recall when agents use different wording for the same concept.
  • Markdown remains the canonical human-readable and Git-reviewable memory.

Every normal retrieval result is validated against the current revision in PostgreSQL, so stale, archived, deleted, or superseded vectors are not silently returned as current knowledge.

Python SDK

The client is async-first and includes a small TTL cache for read requests. Writes invalidate the local cache.

import asyncio

from uams_sdk import UAMSClient


async def main() -> None:
    client = UAMSClient(base_url="http://127.0.0.1:8000")
    task = "Fix intermittent session refresh failures"

    # Retrieve task-specific procedures and compressed historical context.
    preflight = await client.begin_task(task, max_tokens=2000)
    print(preflight["procedures"])
    print(preflight["context"])

    # Request targeted recall while working.
    recall = await client.search(
        "previous refresh-token fixes",
        limit=5,
        entities=["Authentication Service"],
        compress=True,
    )
    print(recall["results"])

    # Store only the durable outcome, never a raw conversation transcript.
    await client.end_task(
        task=task,
        outcome="Made refresh-token rotation atomic and added regression coverage.",
        files=["auth/session.py", "tests/test_session.py"],
        decisions=["Keep token invalidation in the same transaction."],
        fixes=["Prevent reuse of the superseded refresh token."],
        entities=["Authentication Service", "Session Refresh Fix"],
        tags=["#bugfix"],
        category="procedural",
    )


asyncio.run(main())

Client Methods

Method Purpose
begin_task Retrieve procedures, compressed context, and the shared memory policy.
search Run hybrid semantic and lexical retrieval with optional entity hints.
retrieve_context Assemble a token-bounded context block for an agent task.
retrieve_procedures Retrieve relevant operating procedures.
store_memory Store a distilled semantic, episodic, or procedural memory.
end_task Store a structured task outcome with files, decisions, fixes, and entities.
distill_memory Ask the server to summarize retrieved memory about a topic.
related_entities Retrieve an evidence-backed graph neighborhood.
get_identity Read an optional identity-kernel profile.
inject_identity Retrieve optional identity context for reasoning.
extract_identity Extract optional identity traits from supplied memories.
memory_quality Score the structure and metadata of a Markdown memory.

MCP Server

The package installs the uams-mcp stdio server:

UAMS_API_URL=http://127.0.0.1:8000 uams-mcp

Register it in a JSON-based MCP client:

{
  "mcpServers": {
    "uams": {
      "command": "uams-mcp",
      "env": {
        "UAMS_API_URL": "http://127.0.0.1:8000"
      }
    }
  }
}

The recommended protocol is:

begin_task -> act / search_memory -> end_task

MCP Capabilities

UAMS SDK 1.1 exposes 14 MCP tools:

Tool Purpose
health Check API reachability and shallow component health.
begin_task Retrieve procedures, context, and the default memory policy.
search_memory Run hybrid retrieval with optional entity hints and compression.
get_context Build a token-bounded context block for a task.
get_procedures Retrieve task-relevant operating rules.
remember Store a distilled atomic memory.
end_task Store a structured task-outcome memory.
store_fix_summary Store an issue, cause, resolution, files, and linked entities.
get_related_entities Retrieve an evidence-backed graph neighborhood.
summarize_memory Retrieve context and generate an optional LLM summary.
get_identity Read an optional identity-kernel profile.
inject_identity Produce optional identity context for agent reasoning.
extract_identity Extract optional identity traits from supplied memories.
memory_quality Score a Markdown memory's structure and metadata.

It also exposes:

  • resource uams://memory-policy with the read-before-work and write-after-work rules;
  • prompt use_uams_memory for applying the protocol to a task.

Identity-kernel tools are optional and distinct from the server's exact PostgreSQL-backed agent, user, and project profiles.

Configuration

Variable Default Purpose
UAMS_API_URL http://localhost:8000 Base URL used by the MCP server.

For direct Python use, pass base_url to UAMSClient. The client uses a 15-second request timeout with a 5-second connection timeout and a 300-second cache TTL by default.

Compatibility

  • Python 3.11+
  • UAMS server 1.1 recommended
  • MCP Python SDK >=1.12.4,<1.13
  • API transport through httpx

UAMS is local-first and the default server has no API authentication. Keep it bound to loopback or place an authenticated reverse proxy in front of it before remote access.

License

MIT

Metadata

Release files for uams-sdk 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uams-sdk 1.3.0
File Size Uploaded Provenance Actions
uams_sdk-1.3.0.tar.gz 19.3 kB Without provenance Details for uams_sdk-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uams-sdk 1.3.0
File Interpreter ABI Platform Actions
uams_sdk-1.3.0-py3-none-any.whl Python 3 none any Details for uams_sdk-1.3.0-py3-none-any.whl

Total release size: 40.6 kB

Release files / uams_sdk-1.3.0.tar.gz

Download URL uams_sdk-1.3.0.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
23662c3a24aea43cb6c423e7d4b685615262101f5ce0850a810d85757f4a8430
BLAKE2b-256 checksum
How to use checksums
cbc5a9e03f76d3889fd24b8a120c6010c5b554f547bce85eb7dc4bf618d78c3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / uams_sdk-1.3.0-py3-none-any.whl

Download URL uams_sdk-1.3.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4760202b015c38bcc7a41f1264569ef5d2569991d10bfac9adc34507cfc28b6f
BLAKE2b-256 checksum
How to use checksums
ad648925667258076a5729e90380ba7b8d038ca8e38ff12c326fe297e633a709
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for uams-sdk 1.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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