Skip to main content

Python SDK for Wytness — audit logging for AI agents with cryptographic signing and chain integrity

Project description

Wytness Python SDK

Audit logging for AI agents. Every action your AI agent takes is cryptographically signed, hash-chained, and streamed to the Wytness platform for compliance and observability.

Installation

pip install wytness-sdk

Quick Start

from wytness import AuditClient, audit_tool

# Initialize the client
client = AuditClient(
    agent_id="my-agent",
    human_operator_id="user-123",
)

# Decorate any tool your agent calls
@audit_tool(client=client)
def send_email(to: str, subject: str, body: str):
    # Your tool implementation
    pass

# Every call is automatically logged, signed, and chained
send_email(to="team@company.com", subject="Report", body="Weekly summary")

Features

  • Cryptographic signing — every event is signed with Ed25519
  • Hash chaining — tamper-evident chain of events per agent session
  • Automatic redaction — secrets in parameters are automatically redacted
  • HTTP transport — stream events to api.wytness.dev over HTTPS
  • File fallback — events are saved locally if the API is unreachable

HTTP Emitter (Recommended)

Send events directly to the Wytness API using your API key:

client = AuditClient(
    agent_id="my-agent",
    human_operator_id="user-123",
    http_endpoint="https://api.wytness.dev",
    http_api_key="aa_live_...",
)

API

AuditClient(agent_id, **kwargs)

Parameter Type Default Description
agent_id str required Unique identifier for the agent
agent_version str "0.1.0" Version of the agent
human_operator_id str "unknown" ID of the human overseeing the agent
signing_key str|None None Base64-encoded Ed25519 private key (for serverless)
signing_key_path str "./keys/signing.key" Path to Ed25519 private key (auto-generated if missing). Ignored when signing_key is set.
http_api_key str|None None API key for HTTP endpoint
http_endpoint str "https://api.wytness.dev" HTTP API endpoint URL
fallback_log_path str "./audit_fallback.jsonl" Local fallback file path

@audit_tool(client, task_id="default")

Decorator that wraps a function to automatically log audit events. Works with both sync and async functions. Captures:

  • Function name, parameters (with secret redaction), and return value hash
  • Execution duration, success/failure status, and error codes
  • Cryptographic signature and hash chain link

client.session_id

Read-only property returning the UUID for this client instance.

client.flush(timeout=5.0)

Wait for pending HTTP requests to complete. Call before process exit in serverless/short-lived environments.

hash_value(value)

SHA-256 hash of any JSON-serialisable value. Use this when recording events manually to compute inputs_hash / outputs_hash.

from wytness import hash_value

result = my_tool(data)
outputs_hash = hash_value(result)

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

wytness_sdk-0.3.0.tar.gz (272.9 kB view details)

Uploaded Source

Built Distribution

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

wytness_sdk-0.3.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file wytness_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: wytness_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 272.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wytness_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f733b71e19d3323547bc766ca15df2ed0c3e335492a133a75eb130f4ee4e9011
MD5 b9189be935d3ac819399f62db01bc2ba
BLAKE2b-256 7d8884e6135e936e1a4eedbab160c8a220f2b93e4b9675c9d1b4d9461cb1ca12

See more details on using hashes here.

Provenance

The following attestation bundles were made for wytness_sdk-0.3.0.tar.gz:

Publisher: publish-python-sdk.yml on imwickkd/wytness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wytness_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: wytness_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wytness_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71837c083ce001a9759a9d1201a5606fbcf5a3e99e639784c5d4b239461d1b18
MD5 46d54e4851ef1eaa4e8dcccc5e4548df
BLAKE2b-256 8d3941eccbda688b201e51d2cdbc204b83631a320323c2d84276a7878252964b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wytness_sdk-0.3.0-py3-none-any.whl:

Publisher: publish-python-sdk.yml on imwickkd/wytness

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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