Skip to main content

auditagent

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

pip install auditagent
from auditagent 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 auditagent 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:

auditagent validate auditagent.policy.yaml
auditagent 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.1.0.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.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: audagent-0.1.0.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.1.0.tar.gz
Algorithm Hash digest
SHA256 22d8893276291ba7dab2fe9aebefb8de9234d4861d46fbdab7c12fecf2cf1453
MD5 68810344d3c0d1eafc59beb69a110b66
BLAKE2b-256 243678ed1f211ba90a396cd5e57bce06e91b11f5da7643a54fe7ace9ddfa7d23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: audagent-0.1.0-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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03fd9f7a8c7e026d9f636140091898ede97d525d267bc41588b4976ace6374cf
MD5 6866b026dcd5e7228a9a88626dff1211
BLAKE2b-256 e53ee448bee5f4c8b8883ace079e4b7a2a988cdefb7185705433da769882f9db

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

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