Skip to main content

AuditAgent

Drop-in logging, human approvals, and compliance evidence for AI agents.

pip install AudAgent
from audagent import AuditAgent

audit = AuditAgent(api_key="al_live_...", agent_name="support-bot")

@audit.track(action_type="external", action_name="send_email")
async def send_email(to: str, subject: str, body: str):
    return await email_provider.send(to, subject, body)

That's it — every call to send_email is now logged (inputs, output, latency, cost, model, a hash of the prompt) with PII redacted server-side before storage. If your workspace's policy requires approval for action_type: external, the call blocks until a human approves/rejects/edits it in Slack (or via email if Slack isn't configured) — see your dashboard's Policy tab.

Handling rejections

from audagent import ApprovalDeniedError, ApprovalTimeoutError

try:
    await send_email("customer@example.com", "Refund approved", "...")
except ApprovalDeniedError as e:
    print(f"Blocked by {e.decision_by}: {e.note}")
except ApprovalTimeoutError:
    print("Nobody responded in time — treated as denied")

Shutting down cleanly

Logging happens on a background thread so track() adds well under 5ms to the wrapped call. AuditAgent registers an atexit hook automatically, so queued events are flushed on normal process exit without any extra setup.

If you want the queue drained at a specific point instead of waiting for exit — e.g. before a health check reports ready, or between batches in a long-running worker — call audit.flush() or audit.close() yourself (both are safe to call more than once).

Policy

By default the SDK fetches your workspace's active policy from the dashboard at startup. To pin a repo-local policy instead (e.g. for CI, or to review policy changes via pull request):

audit = AuditAgent(
    api_key="al_live_...",
    agent_name="support-bot",
    policy_yaml=open("auditagent.policy.yaml").read(),
)
# auditagent.policy.yaml
rules:
  - match:
      action_type: external
    require_approval: true
  - match:
      action_type: data_access
      action_name: "delete_*"
    require_approval: true

Validate that file (schema + YAML syntax) before committing it, and check what a given action would resolve to under it — both run offline, no API key needed:

audagent validate auditagent.policy.yaml
audagent check auditagent.policy.yaml --action-type external --action-name send_email

What this does not do

Policy enforcement is trust-based: track() checks the policy and calls the approval endpoint itself, but nothing stops a developer from not wrapping a call, or from bypassing the SDK entirely in their own code. AuditAgent's threat model is "give honest teams a governance trail and a real approval gate," not "prevent a malicious developer from evading their own compliance tooling." Treat AuditAgent as you would any other internal logging library.

Download files

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

Source Distribution

audagent-0.2.1.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

audagent-0.2.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file audagent-0.2.1.tar.gz.

File metadata

  • Download URL: audagent-0.2.1.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for audagent-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c62f001811412ccb447f8edd02ceb6a7bbe5c50185b6c2e30d299bddea6391b6
MD5 7ef22cdf1d7cac35fdeccedfe12698a5
BLAKE2b-256 6c24cfa9954d38db46a2dca3e8e7dba8bbd7eb40facd10275d797503a7879728

See more details on using hashes here.

File details

Details for the file audagent-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: audagent-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for audagent-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 30722476ada6439a8633f5c0e7f83c599c39059cbed1951949557d90d4512dda
MD5 27ca61867ef5481173cc342b19ec8485
BLAKE2b-256 d0e8ae42e57515b94108d88d87046ad98fd73b33101b66b3ab9a4e96c276f1ae

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.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