mem0-sgraal
Sgraal memory governance integration for mem0. Validates memory entries with the Sgraal preflight protocol before your agent acts on them.
Install
pip install mem0-sgraal
Quick Start — Preflight Hook
The simplest way to add Sgraal validation to mem0 memories:
from mem0_sgraal import preflight_hook
memories = [
{"id": "m1", "memory": "User prefers fintech", "score": 0.9},
{"id": "m2", "memory": "Account balance $50K", "score": 0.85},
]
safe = preflight_hook(
memories,
domain="fintech",
api_key="sg_demo_playground" # or set SGRAAL_API_KEY env var
)
# safe = only memories that passed preflight (USE_MEMORY)
for m in safe:
print(f"{m['id']}: {m['sgraal_decision']} (omega={m['sgraal_omega']})")
Full Client — mem0 + Sgraal
import os
from mem0_sgraal import Mem0SgraalClient
client = Mem0SgraalClient(
sgraal_api_key=os.environ["SGRAAL_API_KEY"],
mem0_api_key=os.environ["MEM0_API_KEY"]
)
# Search with safety validation
result = client.safe_search(
query="user preferences",
user_id="alice",
domain="fintech",
action_type="irreversible"
)
print(f"Safe: {result['preflight_summary']['safe_count']}/{result['preflight_summary']['total']}")
for m in result["safe_memories"]:
print(f" {m['memory']} (omega={m['sgraal_omega']})")
# Add with validation
client.safe_add(
messages=[{"role": "user", "content": "I prefer email notifications"}],
user_id="alice"
)
Environment Variables
export SGRAAL_API_KEY=sg_live_... # Required
export MEM0_API_KEY=m0-... # Required for Mem0SgraalClient
Demo Key
Use sg_demo_playground for testing Sgraal — no signup needed.
Links
- sgraal.com — Landing page
- mem0.ai — mem0 platform
- github.com/sgraal-ai/core — Source
License
Apache 2.0
Release files for mem0-sgraal 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mem0_sgraal-0.1.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mem0_sgraal-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / mem0_sgraal-0.1.0.tar.gz
| Download URL | mem0_sgraal-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f48659557164b8bd350a8f4c96fbef068f8efe138ee4e0287f035757cdeee793
|
|
BLAKE2b-256 checksum How to use checksums |
a9700dc6d3df38a243cc51fcb2e310f021b993103367e15f6907c72c42b1b35b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / mem0_sgraal-0.1.0-py3-none-any.whl
| Download URL | mem0_sgraal-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e768f47601d2f916923185074b13f8890bd2c83c1ed10c939eddd8e4274f92c
|
|
BLAKE2b-256 checksum How to use checksums |
e5c6a1726354baaf7ff360f326d11e1048d0af3f898cb0bc0c3ce623772f7d29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|