Skip to main content

foxy-audit (SDK)

Governance-as-Code for AI. One decorator -> a tamper-evident, content-blind audit trail.

The SDK creates customer-keyed HMAC commitments for supported LLM inputs and outputs locally, throws raw text away before upload, and durably spools only metadata to the Foxy Audit backend. It also fires a best-effort local UDP ping so the desktop "fox" companion shows local capture activity and backend grading alerts.

Install

pip install -e .            # from this sdk/ folder, for local development

Runtime dependency: requests only.

Use

import os
from foxy_audit import FoxyClient

foxy = FoxyClient(api_key=os.getenv("FOXY_API_KEY"))   # or just rely on the env var

@foxy.audit(policy="hipaa_basic")
def ask_model(prompt: str) -> str:
    return llm_client.generate(prompt)     # your existing code — unchanged

Every call to ask_model is now hashed, logged, and graded. Or use the module-level decorator, which builds a client from the environment:

from foxy_audit import audit

@audit(policy="soc2")
def summarize(text: str) -> str:
    ...

Attributing the model (agent)

Pass agent= to record which model produced the interaction. The backend folds it into the tamper-evident hash chain, so the attribution can't be altered after the fact:

@foxy.audit(policy="soc2", agent="gpt-4o")
def ask_model(prompt: str) -> str:
    ...

agent is optional — rows logged without it hash exactly as before, so existing chains keep verifying.

Configuration

Setting Kwarg Env var Default
API key api_key FOXY_API_KEY (none → HTTP disabled)
Backend URL endpoint FOXY_BACKEND_URL http://127.0.0.1:8000
Desktop ping desktop_ping True (127.0.0.1:9999)
Commitment key commitment_key FOXY_COMMITMENT_KEY API key when omitted
Durable spool spool_path FOXY_SPOOL_PATH ~/.foxy-audit/spool.sqlite3
Stable client id client_id FOXY_CLIENT_ID persisted in the local spool when omitted
Required capture audit_required FOXY_AUDIT_REQUIRED False

With no API key the SDK is a graceful no-op for the cloud path: it still runs your function and still pings the desktop fox, but skips the HTTP upload. In the default mode, delivery is best-effort; for regulated workflows, set audit_required=True so the decorator waits for a server receipt and raises when durable delivery cannot be confirmed.

Guarantees

  • Default path is asynchronous — the HTTP upload runs on a background daemon thread after a local durable enqueue.
  • Retries do not discard events — failed uploads remain in the SQLite/WAL spool.
  • Content-blind by design — commitments, token counts, policy tags, and bounded identifiers leave the host; raw text is not sent by the SDK.
  • Works with sync, async, and generator functions; host return values are passed through unchanged.

What gets sent

To the backend (POST /v1/logs, Authorization: Bearer <key>):

{"event_id": "<uuid>", "client_id": "...", "client_seq": 1, "commitment_alg": "hmac-sha256", "prompt_hash": "<64 hex>", "response_hash": "<64 hex>", "token_count": 123, "policy_tag": "hipaa_basic"}

To the desktop fox (UDP 127.0.0.1:9999):

{"event": "hash_ok", "policy": "hipaa_basic", "tokens": 123, "ts": 1719300000}
{"event": "policy_breach", "reason": "...", "risk_score": 87, "policy": "hipaa_basic", "ts": ...}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foxy_audit-1.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

foxy_audit-1.1.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: foxy_audit-1.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for foxy_audit-1.1.0.tar.gz
Algorithm Hash digest
SHA256 697d81cdeb01b8d15413cfc06bc7d1b7626d45605ef8851b5bf50e2d2ef50269
MD5 5341502f7d86845d714fec59e5f48534
BLAKE2b-256 38141e0c8624f861f815903105bccfb028c4dbb2f2d0cdc502bfcbbfd835d38d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: foxy_audit-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for foxy_audit-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e360ee5c4af748f9d8c2b20abd7d4bdaa1eb328bbdd7ede0f1c66d90db2980f
MD5 de4ca1492610d02a792c6c6a919063de
BLAKE2b-256 cf27550128b824d21a53c04b0c18142ea6f1faff99b27acc71213827e7b7f22b

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 Sentry Error logging StatusPage Status page