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.

Project Links

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uams_sdk-1.1.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

uams_sdk-1.1.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file uams_sdk-1.1.1.tar.gz.

File metadata

  • Download URL: uams_sdk-1.1.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for uams_sdk-1.1.1.tar.gz
Algorithm Hash digest
SHA256 73bf7fb1fc5510b38a557286359aafcfebb933284407685a230a8b9d439cb321
MD5 892dec88d1ed01dfee4b744a1bcb7286
BLAKE2b-256 7efe559ba4642a60cbf3c02e97880e57bb2a3203668668a22546dd2ec91e0115

See more details on using hashes here.

File details

Details for the file uams_sdk-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: uams_sdk-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for uams_sdk-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4231a87af532b883de16661c8978ba75f5bb58baa36a87e0fac4ac7829c6966
MD5 6083b17864609644258cdd4ff7aa42b3
BLAKE2b-256 16e885b34e3cb5d7b8ba093ab03726532ba7c7cf8a643fb7285780db63682ddb

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.2

2 files

This release

1.1.1 This release

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page