Skip to main content

AI Decision Audit Logging — tamper-evident audit trails for any AI agent

Project description

SealVera Python SDK

Tamper-evident audit trails for AI agents — compliance-ready in minutes.

PyPI version Python License: MIT

SealVera gives every AI decision a cryptographically-sealed, immutable audit log — so you can prove what your agent decided, why it decided it, and that the record hasn't been touched. Built for teams shipping AI in finance, healthcare, legal, and any regulated industry that needs to answer to auditors, regulators, or customers.

EU AI Act · SOC 2 · HIPAA · GDPR · ISO 42001 — SealVera logs are designed to satisfy the explainability and auditability requirements of major AI compliance frameworks.


Why SealVera?

  • 🔒 Tamper-evident logs — every decision is cryptographically hashed and chained; any tampering is detectable
  • 2-line integration — works as a decorator, callback, or context manager
  • 🧠 Explainability built-in — captures inputs, outputs, reasoning, confidence scores, and model used
  • 📊 Real-time dashboard — search, filter, and export your full AI decision history at app.sealvera.com
  • 🚨 Drift detection — get alerted when agent behaviour deviates from its baseline
  • 🌐 Works with any LLM — OpenAI, Anthropic Claude, Google Gemini, Ollama, LangChain, CrewAI, AutoGen, and more
  • 🪶 Zero hard dependencies — stdlib only, no bloat, no vendor lock-in

Installation

pip install sealvera

Quick Start

from sealvera import init, log

# Initialize once (e.g. in your app entry point)
init(
    endpoint="https://app.sealvera.com",
    api_key="sv_your_api_key_here",
    agent="payment-agent"
)

# Log a decision
log(
    action="approve_payment",
    decision="APPROVED",
    input={"amount": 5000, "currency": "USD", "customer_id": "c_123"},
    output={"approved": True, "reason": "Low risk score, verified merchant"},
    reasoning=[
        {"factor": "risk_score", "value": "0.12", "signal": "safe", "explanation": "Below 0.3 threshold"},
        {"factor": "merchant", "value": "verified", "signal": "safe", "explanation": "KYC passed"}
    ]
)
# ✅ Decision logged, hashed, and stored in your tamper-evident audit trail

Get your API key at app.sealvera.com.


LangChain Integration

The easiest way to audit LangChain agents — drop in the callback handler:

from sealvera import init
from sealvera.callbacks import SealVeraCallbackHandler
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage

init(endpoint="https://app.sealvera.com", api_key="sv_your_key", agent="langchain-agent")

model = ChatOpenAI(
    model="gpt-4o",
    callbacks=[SealVeraCallbackHandler(agent="langchain-agent")]
)

response = model.invoke([HumanMessage(content="Should I approve this loan application?")])
# ✅ Full chain logged — every LLM call, tool invocation, and final answer

Decorator Usage

Wrap any agent function with a single decorator:

from sealvera import init, trace

init(endpoint="https://app.sealvera.com", api_key="sv_your_key")

@trace(agent="fraud-detector", action="evaluate_transaction")
def evaluate_transaction(transaction: dict) -> dict:
    # Your agent logic here — LLM call, rules engine, ML model, anything
    risk_score = run_fraud_model(transaction)
    decision = "FLAGGED" if risk_score > 0.8 else "APPROVED"
    return {"decision": decision, "risk_score": risk_score, "reason": "..."}

result = evaluate_transaction({"amount": 9800, "merchant": "Unknown Corp"})
# ✅ Input, output, decision, and timing logged automatically

Context Manager

from sealvera import init, SealVeraClient

init(endpoint="https://app.sealvera.com", api_key="sv_your_key")
client = SealVeraClient()

with client.trace(agent="underwriting-agent", action="evaluate_loan") as ctx:
    ctx.set_input(application)
    result = run_underwriting_model(application)
    ctx.set_output(result)
    ctx.set_decision(result["decision"])
# ✅ Logged on context exit, even if an exception occurs

Autoload (Zero-Code Integration)

Add SealVera to any Python app without modifying source code:

python -m sealvera.autoload your_app.py

Or set via environment variables and import at the top of your entry point:

import sealvera.autoload  # patches LLM clients automatically
SEALVERA_ENDPOINT=https://app.sealvera.com
SEALVERA_API_KEY=sv_your_key_here
SEALVERA_AGENT=my-agent

Async Support

Full async/await support for FastAPI, async LangChain, and any async agent framework:

from sealvera import init, log_async

init(endpoint="https://app.sealvera.com", api_key="sv_your_key")

async def process_claim(claim: dict) -> dict:
    result = await run_claims_model(claim)
    await log_async(
        action="evaluate_claim",
        decision=result["decision"],
        input=claim,
        output=result,
        reasoning=result.get("reasoning", [])
    )
    return result

Decision Vocabulary

Decision Meaning Use for
APPROVED Request approved / allowed Payments, loans, access grants
REJECTED Request blocked / denied Fraud blocks, denials
FLAGGED Needs human review Borderline cases, escalations
COMPLETED Task finished successfully General agent tasks
FAILED Task failed Error paths
ESCALATED Handed to human/higher agent Human-in-the-loop
PASSED Test/check passed CI, health checks

Use Cases

  • Financial services & fintech — log every credit decision, fraud flag, and payment approval for regulatory review (FINRA, OCC, CFPB)
  • Healthcare AI — tamper-evident audit trail for clinical decision support (HIPAA-aligned)
  • Legal tech — record document review, contract analysis, and compliance risk assessments
  • Insurance — log claims triage, underwriting decisions, and anomaly flags
  • HR / hiring tools — demonstrate fair, explainable AI decisions to avoid bias liability
  • Any agentic AI system — multi-step reasoning chains, tool calls, and autonomous decisions

Environment Variables

Variable Description Default
SEALVERA_ENDPOINT SealVera server URL https://app.sealvera.com
SEALVERA_API_KEY Your API key (starts with sv_)
SEALVERA_AGENT Default agent name default
SEALVERA_DEBUG Enable debug logging false

JavaScript / Node.js SDK

Looking for the Node.js version? → npmjs.com/package/sealvera


Links


License

MIT

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

sealvera-0.1.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

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

sealvera-0.1.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file sealvera-0.1.0.tar.gz.

File metadata

  • Download URL: sealvera-0.1.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for sealvera-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d362fd709e136654822a72adf467b17ecdc019030fca0013c56122f8dd6c8bbe
MD5 6630bc1cca85bc4766eeec257862fa5f
BLAKE2b-256 27b11c5e42dde65ce698f3c131ac9e086c02d06c71cafa0f30c0312cc6be5f94

See more details on using hashes here.

File details

Details for the file sealvera-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sealvera-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for sealvera-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db89ead785b686d082b6a8e5c6f7168cda47e638532d3cf1140737497c54e7aa
MD5 f14b2eadb1daa5032b51eb2ad9b71fa6
BLAKE2b-256 d0a929c109c8bf89bd69fb123fd2c5de95d30d887653bafab20f93757cb3d922

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