Skip to main content

Cryptographic notarization SDK for LLM interactions

Project description

AgentSystems Notary

PyPI version

Audit logging infrastructure for AI systems

AgentSystems Notary provides tamper-evident audit trails for AI systems. It creates cryptographically verifiable logs of all LLM interactions with dual-write architecture: your S3 bucket (raw logs) + Notary ledger (hash receipts).

Features

  • Multi-Framework Support: LangChain and CrewAI adapters (extensible to other frameworks)
  • Dual-Write Architecture: Organization S3 (raw logs) + Notary API (hash receipts)
  • Cryptographic Verification: SHA-256 hashes with JCS canonicalization (RFC 8785)
  • Tenant Isolation: Multi-tenant support for SaaS applications
  • Audit Trail Architecture: Designed with verifiability and auditability in mind

Disclaimer

This SDK provides technical infrastructure for audit logging. It does not guarantee regulatory compliance, which depends on your specific jurisdiction, industry, policies, and operational practices. This SDK does not constitute legal, compliance, or regulatory advice. Consult with qualified legal and compliance professionals for your specific requirements.

Installation

# Install with LangChain support
pip install agentsystems-notary[langchain]

# Install with CrewAI support
pip install agentsystems-notary[crewai]

# Install with both
pip install agentsystems-notary[all]

Quick Start

LangChain

from agentsystems_notary import LangChainNotary
from langchain_anthropic import ChatAnthropic

# 1. Create notary callback
notary = LangChainNotary(
    api_key="sk_asn_prod_...",        # From notary.agentsystems.ai
    slug="tnt_acme_corp",             # Your tenant slug
    org_bucket_name="acme-llm-logs"   # Your S3 bucket
)

# 2. Add to any LangChain model
model = ChatAnthropic(
    model="claude-sonnet-4-5-20250929",
    callbacks=[notary]
)

# 3. Use normally - logs are automatic
response = model.invoke("What is AIUC-1 compliance?")

CrewAI

from agentsystems_notary import CrewAINotary
from crewai import Agent, Task, Crew

# 1. Initialize notary (registers hooks automatically)
notary = CrewAINotary(
    api_key="sk_asn_prod_...",
    slug="tnt_acme_corp",
    org_bucket_name="acme-llm-logs"
)

# 2. Create crew normally
agent = Agent(role="Research Analyst", goal="...", backstory="...")
task = Task(description="Research AIUC-1 compliance", agent=agent)
crew = Crew(agents=[agent], tasks=[task])

# 3. All LLM calls are logged automatically
crew.kickoff()

How It Works

  1. Capture: Intercepts LLM requests/responses via LangChain callbacks
  2. Canonicalize: Deterministic JSON serialization (JCS/RFC 8785)
  3. Hash: SHA-256 of canonical bytes
  4. Dual-Write:
    • Your S3 bucket: Full canonical JSON (verifiable by re-hashing)
    • Notary API: Hash receipt (immutable ledger)

Configuration

Environment Variables

# AWS credentials (for organization S3 bucket)
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION=us-east-1

Debug Mode

notary = LangChainNotary(
    api_key="sk_asn_prod_...",
    slug="tnt_acme_corp",
    org_bucket_name="acme-llm-logs",
    debug=True  # Prints canonical JSON and hashes
)

Multi-Tenant Setup

For SaaS applications serving multiple end-customers:

# Each end-customer gets their own tenant
notary_bank_a = LangChainNotary(
    api_key="sk_asn_prod_...",
    slug="tnt_bank_a",              # Bank A's logs
    org_bucket_name="your-logs"
)

notary_bank_b = LangChainNotary(
    api_key="sk_asn_prod_...",
    slug="tnt_bank_b",              # Bank B's logs (isolated)
    org_bucket_name="your-logs"
)

API Keys

Generate API keys at notary.agentsystems.ai.

S3 Bucket Structure

Organization bucket (your S3):

logs/
  {slug}/
    {session_id}/
      1.json
      2.json
      3.json

Each file contains canonical JSON that can be re-hashed to verify the hash receipt.

Verification

To verify a log entry:

import hashlib
import jcs

# 1. Download from your S3 bucket
log_data = s3.get_object(Bucket="your-bucket", Key="logs/tnt_acme/session-123/1.json")

# 2. Re-hash
canonical_bytes = log_data["Body"].read()
computed_hash = hashlib.sha256(canonical_bytes).hexdigest()

# 3. Compare with Notary receipt
assert computed_hash == notary_receipt_hash  # Proof of integrity

Support

License

Licensed under the Apache-2.0 license.

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

agentsystems_notary-0.3.3.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

agentsystems_notary-0.3.3-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file agentsystems_notary-0.3.3.tar.gz.

File metadata

  • Download URL: agentsystems_notary-0.3.3.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for agentsystems_notary-0.3.3.tar.gz
Algorithm Hash digest
SHA256 69c493be87d46b96acfcf580338ac44694c5eab6b04f1c3f4e9a1ea283ef22e6
MD5 db2c0d7e45d141c1e1fe58066f23b4e6
BLAKE2b-256 50e2c4ff03f749f125013a0d3258852901e2f5411d026beaa15a9b716350b857

See more details on using hashes here.

File details

Details for the file agentsystems_notary-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for agentsystems_notary-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 259e4dd6542f372ad0b9d60126d0ad9a37a85870c4562c86b21a375c7d01b84d
MD5 f1f83363f8d263498f2f114f6318aede
BLAKE2b-256 c99cfc0c5d4736f00345e3710c00dcc03eaa54a0cf7eb366ffdbd1eeba6b230c

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