Skip to main content

Sasana

Your AI agent logs are not evidence. Sasana makes them defensible.

Every major observability tool — LangSmith, Arize, Langfuse — stores logs in mutable, operator-controlled storage. An administrator with file-system or database access can modify or delete a record with no detectable trace. Those logs satisfy a reporting requirement. They do not prove what happened.

Sasana records a SHA-256 hash-chained audit trail where any modification — to any byte, in any historical event — is detectable. Raw content never leaves your machine: only hashes are stored.

$ sasana verify session.jsonl --trust-key <archeion-pubkey>

Sasana Verifier v1.0.0
File     : session.jsonl
Session  : 3f8a2c1d-…
Events   : 7
Evidence : AUTHORITATIVE_EVIDENCE

[1/5] Structural validity  ... PASS
[2/5] Sequence integrity   ... PASS
[3/5] Hash chain integrity ... PASS
[4/5] Session completeness ... PASS
[5/5] Seal signature       ... PASS

Result: INTACT ✅

Who this is for

Teams deploying AI agents in regulated environments — fintech, healthtech, HR tech. Specifically:

  • Compliance engineers implementing EU AI Act Article 12 (tamper-evident logging for high-risk AI systems)
  • Security teams who need a cryptographically verifiable audit trail for incident response
  • DevSecOps engineers who need to prove a session log has not been touched since it ended

If you are building an AI agent for a use case that falls under GDPR, SOC 2, HIPAA, or EU AI Act audit requirements, Sasana is the audit layer.


What it produces

A completed session produces a JSONL file. The verifier checks five properties and returns one of three results:

Result Meaning
INTACT All checks pass. The log has not been modified.
PARTIAL Hash chain intact but events were dropped during the session.
COMPROMISED Hash chain broken. Log has been modified after the fact.

Exit codes: 0 (INTACT), 1 (COMPROMISED), 2 (PARTIAL), 3 (ERROR) — suitable for CI pipeline integration.

The evidence class tells you how strong the guarantee is:

Class Meaning
AUTHORITATIVE_EVIDENCE Independent sealing authority verified this log. The agent could not have forged this.
SIGNED_NON_AUTHORITATIVE Ed25519 signatures present. Requires private key to forge.
NON_AUTHORITATIVE_EVIDENCE Hash chain intact. Proves no post-hoc modification.

Install

pip install sasana

Install via OpenClaw

# Via GitHub URL
openclaw skill install https://github.com/sahiee-dev/Sasana

# Via skills.sh shorthand (when listed in the registry)
openclaw skill install sahiee-dev/Sasana/sasana

Every session automatically produces ~/.openclaw/sasana/<session_id>.jsonl. No configuration required.


Quick start

from sasana.sqlite_ledger import SqliteLedger
import hashlib

def sha256(text: str) -> str:
    return hashlib.sha256(text.encode()).hexdigest()

ledger = SqliteLedger(db_path="session.db")
ledger.connect()
ledger.open_session(session_id="my-session", agent_id="my-agent")
ledger.record("LLM_CALL",     {"prompt_hash":   sha256(prompt)})
ledger.record("LLM_RESPONSE", {"response_hash": sha256(response)})
ledger.close_session(status="success")
ledger.export_jsonl("session.jsonl")
ledger.close()

Verify:

sasana verify session.jsonl

Passive observer (zero code changes required):

pip install sasana[observer]
sasana observe  # auto-detects OpenClaw WebSocket port

Already using OpenTelemetry? Keep your existing tracing (LangSmith, Langfuse, Datadog, OTLP) and get a tamper-evident evidence ledger underneath — one session per trace:

pip install sasana[otel]
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from sasana.integrations.otel import SasanaSpanExporter

provider.add_span_processor(BatchSpanProcessor(SasanaSpanExporter()))

Evidence packs

Turn any verified session into the artifact an auditor actually reads — a self-contained report plus a machine-readable manifest anyone can re-verify:

sasana evidence-pack session.jsonl --standard eu_ai_act

Writes <session>_eu_ai_act_art12.html (the report) and .json (re-verifiable independently with sasana verify). Standards: eu_ai_act, soc2, hipaa, siem. Exit codes 0 (compliant) / 2 (gaps) / 3 (error) for CI.

Try it with no install at sasana.site/verify — paste a session and the hash chain + Article 12 checks run live in your browser.


Authority sealing

For regulatory submissions and legal proceedings, NON_AUTHORITATIVE_EVIDENCE means the operator is attesting their own logs. That is insufficient when the operator is a party to a dispute.

Archeion is a sealing server that runs inside your security perimeter, controlled by your security team — structurally separate from the agent process. The agent cannot forge a seal. The sealed log carries AUTHORITATIVE_EVIDENCE.

# Start Archeion (self-hosted, inside your perimeter)
docker compose up -d

# Seal a completed session
sasana seal session.jsonl --server http://localhost:8747

# Verify with key pinning
sasana verify session.jsonl --trust-key <archeion-pubkey>

See docs/DEPLOYMENT.md for the full deployment guide — key lifecycle, network isolation, and what to tell a security reviewer.


How it works

Each event is stored with:

  • SHA-256 hash over RFC 8785 canonical JSON — any mutation changes the hash
  • prev_hash — each event commits to all prior events, forming a chain
  • Ed25519 signature — optional per-session keypair; or Archeion's independent key

Raw content is never stored — only hashes. You cannot reconstruct what the agent said from a Sasana log.

A Rust binary (sasana-rs/) verifies sessions without a Python dependency — for forensic environments where Python is not present or trusted.


Compliance mapping

Regulation Requirement addressed
EU AI Act Article 12 Tamper-evident automatic recording for high-risk AI systems
SOC 2 CC7.2 System monitoring with cryptographically verifiable audit trail
HIPAA §164.312(b) Audit control for healthcare AI; raw PHI never recorded

What Sasana does not do

  • Does not record raw content. Hashes only — you cannot reconstruct prompts or responses.
  • Does not prevent tampering. Detects it. Detection and prevention are different.
  • Does not replace LangSmith or Arize. Those tools are for observability. Sasana is for evidence production. They are complementary.
  • Does not have a managed cloud offering. Self-hosted only.

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

sasana-1.1.0.tar.gz (68.9 kB view details)

Uploaded Source

Built Distribution

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

sasana-1.1.0-py3-none-any.whl (65.1 kB view details)

Uploaded Python 3

File details

Details for the file sasana-1.1.0.tar.gz.

File metadata

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

File hashes

Hashes for sasana-1.1.0.tar.gz
Algorithm Hash digest
SHA256 96dc048c73fe03132540d1f9bfff49b0a1d722b9be4fe9d90132519d5651a9c1
MD5 4818fdc4ada9ec149cd211c5d40a52a5
BLAKE2b-256 8027654e1642e3f53490e33f38f332a2fb4ab2f48e3246b1ca4d40d79ddc4e83

See more details on using hashes here.

File details

Details for the file sasana-1.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for sasana-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51d0aa6a5dfea0515600f3ed22ceb97aa1bf351187c3a92a79a60b00519377a2
MD5 40dec250d2edf738dd9c0f2239d7a00e
BLAKE2b-256 646c75d4edabd242ffa121d5a1e002e866750a501b9706bec9896600082ed79f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page