Skip to main content

Memory governance SDK for AI agents

Project description

sgraal

Memory governance SDK for AI agents. Validates memory state before agent actions using the Sgraal preflight protocol.

Install

pip install sgraal

Quick Start

from sgraal import SgraalClient

client = SgraalClient(api_key="sg_demo_playground")

result = client.preflight(
    memory_state=[{
        "id": "mem_001",
        "content": "User prefers wire transfers under $10,000",
        "type": "preference",
        "timestamp_age_days": 14,
        "source_trust": 0.91,
        "source_conflict": 0.04,
        "downstream_count": 3
    }],
    domain="fintech",
    action_type="irreversible"
)

action = result["recommended_action"]  # USE_MEMORY | WARN | ASK_USER | BLOCK
omega = result["omega_mem_final"]      # 0-100 risk score

if action == "BLOCK":
    raise RuntimeError(f"Memory too risky: omega={omega}")

MemCube v2 Entry Format

from sgraal import MemoryEntry

entry = MemoryEntry(
    id="mem_001",
    content="Account balance: $50,000",
    type="tool_state",
    timestamp_age_days=3,
    source_trust=0.92,
    source_conflict=0.08,
    downstream_count=5
)

result = client.preflight(
    memory_state=[entry.to_dict()],
    domain="fintech",
    action_type="irreversible"
)

Methods

preflight(memory_state, domain, action_type, **kwargs)

Run a preflight check. Returns omega score, decision, component breakdown, repair plan, and 80+ analytics fields.

heal(entry_id, action, agent_id=None)

Apply a repair action: REFETCH, VERIFY_WITH_SOURCE, REBUILD_WORKING_SET.

explain(preflight_result, audience, language)

Get a natural language explanation. Audiences: developer, compliance, executive.

compare_grok(sgraal_decision, grok_decision, omega)

Compare Sgraal and Grok decisions for the same input.

propagation_trace(agent_id, memory_state, domain)

Trace memory propagation across agents. Returns cascade risk and affected agent count.

fidelity_certify(memory_state, domain)

Certify memory fidelity with a cryptographic proof.

Demo Key

Use sg_demo_playground for testing — no signup needed. Limited to /v1/preflight and /v1/explain.

Links

License

Apache 2.0

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

sgraal-0.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

sgraal-0.2.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file sgraal-0.2.0.tar.gz.

File metadata

  • Download URL: sgraal-0.2.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sgraal-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f9f12d488874630518a5d1a2541bf53e487bebba7287024641258ede597ff52
MD5 0635b0db50c405fa4313940f513c26c2
BLAKE2b-256 492948cfebfa437e8ae0b4b9d15722338bfc4a913f7e000230d0581495fcf0e7

See more details on using hashes here.

File details

Details for the file sgraal-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sgraal-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sgraal-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8408855f7344eca737c714cff6a895667eb7037320a6f500549ddfff51141994
MD5 d89ce92e35a81943c20a666d60f28f46
BLAKE2b-256 cce95fcc304dafa8889cb550d38d8c6e9274b117d506384ec5dd79440ad75935

See more details on using hashes here.

Supported by

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