Centralized, governed memory for AI agents
Project description
memoryhub
Centralized, governed memory for AI agents.
MemoryHub provides a persistent memory layer for AI agents running on OpenShift AI, with scope-based access control, multi-tenant isolation, and an immutable audit trail. It works with any agent framework — LlamaStack, LangChain, Claude Code, Cursor, and more.
Status: Alpha (v0.1.0). Core operations are stable; curation and relationship APIs may evolve.
Installation
pip install memoryhub
Requires Python 3.10+.
Quick start
import asyncio
from memoryhub import MemoryHubClient
async def main():
client = MemoryHubClient(
url="https://mcp-server.apps.example.com/mcp/",
auth_url="https://auth-server.apps.example.com",
client_id="my-agent",
client_secret="my-secret",
)
async with client:
# Search memories
results = await client.search("deployment patterns", max_results=5)
for memory in results.results:
print(f"[{memory.scope}] {memory.content[:80]}")
# Write a memory
written = await client.write(
"FastAPI is the preferred web framework",
scope="project",
weight=0.85,
)
print(f"Created: {written.memory.id}")
# Read it back
memory = await client.read(written.memory.id)
print(memory.content)
# Update it
updated = await client.update(written.memory.id, weight=0.9)
print(f"Version: {updated.version}")
asyncio.run(main())
Environment variables
Instead of passing credentials directly, use MemoryHubClient.from_env():
export MEMORYHUB_URL="https://mcp-server.apps.example.com/mcp/"
export MEMORYHUB_AUTH_URL="https://auth-server.apps.example.com"
export MEMORYHUB_CLIENT_ID="my-agent"
export MEMORYHUB_CLIENT_SECRET="my-secret"
client = MemoryHubClient.from_env()
Sync usage
For non-async contexts, use the _sync variants:
from memoryhub import MemoryHubClient
client = MemoryHubClient(
url="https://mcp-server.apps.example.com/mcp/",
auth_url="https://auth-server.apps.example.com",
client_id="my-agent",
client_secret="my-secret",
)
results = client.search_sync("deployment patterns")
API reference
Core operations
| Method | Description |
|---|---|
search(query, *, scope, max_results, ...) |
Semantic similarity search |
read(memory_id, *, depth, include_versions) |
Read a memory by ID |
write(content, *, scope, weight, parent_id, ...) |
Create a new memory |
update(memory_id, *, content, weight, metadata) |
Update an existing memory |
Lifecycle
| Method | Description |
|---|---|
get_history(memory_id, *, max_versions) |
Version history |
report_contradiction(memory_id, observed_behavior, *, confidence) |
Flag stale memories |
Relationships and curation
| Method | Description |
|---|---|
get_similar(memory_id, *, threshold) |
Find similar memories |
get_relationships(node_id, *, relationship_type, direction) |
Get memory relationships |
create_relationship(source_id, target_id, relationship_type) |
Create a relationship |
suggest_merge(memory_a_id, memory_b_id, reasoning) |
Suggest merging duplicates |
set_curation_rule(name, *, tier, action, config) |
Configure curation rules |
Authentication
The SDK uses OAuth 2.1 client_credentials grant under the hood. Token management is fully automatic — the SDK fetches, caches, and refreshes JWT access tokens transparently. You never need to handle tokens directly.
Links
Project details
Release history Release notifications | RSS feed
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 memoryhub-0.1.0.tar.gz.
File metadata
- Download URL: memoryhub-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0909ea328d36a012cdb11648f29509c8db854e81d7cdc35b70f468fcdff99cd
|
|
| MD5 |
379c476d45e580127e29aefa4f0e9ccd
|
|
| BLAKE2b-256 |
ebf6e42732d3c4e8d63dc85b9dcdcaee51caae364ab5ffc22df87cd127402fed
|
Provenance
The following attestation bundles were made for memoryhub-0.1.0.tar.gz:
Publisher:
release.yml on rdwj/memory-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memoryhub-0.1.0.tar.gz -
Subject digest:
c0909ea328d36a012cdb11648f29509c8db854e81d7cdc35b70f468fcdff99cd - Sigstore transparency entry: 1240367417
- Sigstore integration time:
-
Permalink:
rdwj/memory-hub@515179096e27f684d2fd078e3f4b6877ef4fcf8b -
Branch / Tag:
refs/tags/sdk/v0.1.0 - Owner: https://github.com/rdwj
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@515179096e27f684d2fd078e3f4b6877ef4fcf8b -
Trigger Event:
push
-
Statement type:
File details
Details for the file memoryhub-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memoryhub-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c18f12bcda98378a52359201ca7b79f23c74ea82cc91ba187c02fab2f2e274a
|
|
| MD5 |
b8cdac6c76945b9022e8b1e747f00c0b
|
|
| BLAKE2b-256 |
1940cf14490aba61d1448b80fbb97e7a2faf24a560934ae91426811c12a494b2
|
Provenance
The following attestation bundles were made for memoryhub-0.1.0-py3-none-any.whl:
Publisher:
release.yml on rdwj/memory-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memoryhub-0.1.0-py3-none-any.whl -
Subject digest:
7c18f12bcda98378a52359201ca7b79f23c74ea82cc91ba187c02fab2f2e274a - Sigstore transparency entry: 1240367532
- Sigstore integration time:
-
Permalink:
rdwj/memory-hub@515179096e27f684d2fd078e3f4b6877ef4fcf8b -
Branch / Tag:
refs/tags/sdk/v0.1.0 - Owner: https://github.com/rdwj
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@515179096e27f684d2fd078e3f4b6877ef4fcf8b -
Trigger Event:
push
-
Statement type: