Python REST client for the memory-layer server
Project description
memory-layer-client
Python client for the memory-layer HTTP service.
Install
pip install memory-layer-client
For local development and tests:
pip install -e '.[dev]'
pytest
Quick Start
from memory_layer_client import MemoryClient, MemoryRuntimeClient, MemoryScope
client = MemoryClient(
"http://localhost:3100",
api_key="dev-key",
default_scope=MemoryScope(
tenant_id="acme",
system_id="python-worker",
collaboration_id="release-42",
scope_id="run-42",
),
)
runtime = MemoryRuntimeClient(client)
result = runtime.run_turn(
"Remember that deployments must stay blue-green.",
lambda prepared: "Stored. I will keep rollout constraints in memory.",
)
print(result.prepared.prompt)
Async Client
import asyncio
from memory_layer_client import AsyncMemoryClient, AsyncMemoryRuntimeClient
async def main() -> None:
client = AsyncMemoryClient("http://localhost:3100", api_key="dev-key")
runtime = AsyncMemoryRuntimeClient(client)
result = await runtime.run_turn(
"Track migration status.",
lambda prepared: "I will keep the migration status in memory.",
)
health = await client.health()
print(result.prepared.context.token_estimate, health.active_turn_count)
await client.aclose()
asyncio.run(main())
Scope Resolution
Each request can inherit a default scope and override it per call. This matches the multi-tenant routing model used by the HTTP server.
MemoryScope also supports collaboration_id, so Python clients can participate in shared multi-agent workspaces the same way the TypeScript server and SDK do.
Hosted Runtime And Changes
from memory_layer_client import MemoryClient, MemoryRuntimeClient
client = MemoryClient("http://localhost:3100")
runtime = MemoryRuntimeClient(client)
knowledge = client.list_knowledge(limit=20)
detail = client.inspect_knowledge(knowledge.items[0]["id"])
changes = client.poll_changes("2026-03-01T00:00:00Z", scope_level="workspace")
cross_scope = client.search_cross_scope("rollback", scope_level="workspace")
prepared = runtime.before_model_call("What changed in the shared workspace?")
print(prepared.prompt)
for event in client.stream_events(event_types=["knowledge_change"], scope_level="workspace"):
print(event.type, event.meta)
break
CLI
memory-layer-client --base-url http://localhost:3100 health
memory-layer-client --base-url http://localhost:3100 search "rollback checklist"
memory-layer-client --base-url http://localhost:3100 inspect-knowledge --limit 10
memory-layer-client --base-url http://localhost:3100 run-reverification --admin-key secret
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
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 ai_memory_layer_client-4.0.0.tar.gz.
File metadata
- Download URL: ai_memory_layer_client-4.0.0.tar.gz
- Upload date:
- Size: 30.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2618637902d955062a2c3c1671c2ca49ec823c0ac45bf3bd8b688ce2d3c2b2e8
|
|
| MD5 |
7305f223f3259c5288820c0905043b4a
|
|
| BLAKE2b-256 |
77a9766facec15a4f8fc0ee8a627c77330ae9e5ba062374bb67bf46ee0381b6d
|
Provenance
The following attestation bundles were made for ai_memory_layer_client-4.0.0.tar.gz:
Publisher:
release.yml on GregStarling/memory-layer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_memory_layer_client-4.0.0.tar.gz -
Subject digest:
2618637902d955062a2c3c1671c2ca49ec823c0ac45bf3bd8b688ce2d3c2b2e8 - Sigstore transparency entry: 1250661173
- Sigstore integration time:
-
Permalink:
GregStarling/memory-layer@3fe662e4d07336239fc6133027cf09dfe278b6bf -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/GregStarling
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3fe662e4d07336239fc6133027cf09dfe278b6bf -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_memory_layer_client-4.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_memory_layer_client-4.0.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfc0a54fe2dc016b34de2da9229b2a4d3cb9116fdb2e4f4d8fc8a200c05ddb52
|
|
| MD5 |
27ecc50ccfe5a768de4e196be749f115
|
|
| BLAKE2b-256 |
5e975cba33ab13416c9fa2d6d7c1eb4b303d206fb55f373ebd999fb9dc82888f
|
Provenance
The following attestation bundles were made for ai_memory_layer_client-4.0.0-py3-none-any.whl:
Publisher:
release.yml on GregStarling/memory-layer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_memory_layer_client-4.0.0-py3-none-any.whl -
Subject digest:
cfc0a54fe2dc016b34de2da9229b2a4d3cb9116fdb2e4f4d8fc8a200c05ddb52 - Sigstore transparency entry: 1250661216
- Sigstore integration time:
-
Permalink:
GregStarling/memory-layer@3fe662e4d07336239fc6133027cf09dfe278b6bf -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/GregStarling
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3fe662e4d07336239fc6133027cf09dfe278b6bf -
Trigger Event:
push
-
Statement type: