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-policywith the read-before-work and write-after-work rules; - prompt
use_uams_memoryfor 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uams_sdk-1.1.0.tar.gz.
File metadata
- Download URL: uams_sdk-1.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e5d3a1bb6d1f3fa979b3e5c48ea14fea68ec5b92213c87c3be047888d2d5c65
|
|
| MD5 |
647b10b367615ba343d9afa6712b492b
|
|
| BLAKE2b-256 |
41719e3f182caacd30c5d21d29adac4d945e3309cd707d14f0be6b9038496ef8
|
File details
Details for the file uams_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: uams_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9f69a442127078b262f7495e5b3592ac79e520ad3fd364dda819525b428c78
|
|
| MD5 |
19b4a9b04675344a866ec542fc29c635
|
|
| BLAKE2b-256 |
5c457f6912f4fb182f8e7cbc6e3fadfb8bd62eb96add8928e9bc78afc52de18e
|