Skip to main content

Non-blocking AI agent event logging for compliance teams

Project description

sentinel-agent-sdk

Non-blocking AI agent event logging for Python. Every agent action fires a tamper-evident audit event to Sentinel — without adding latency to your agents.

Install

pip install sentinel-agent-sdk

Requires Python 3.9+. Zero dependencies (stdlib only).

Quick start

import sentinel

# Initialize once at startup
sentinel.init(api_key="sk_live_...")

# Option 1 — decorator (auto-logs every call)
@sentinel.wrap("payment-agent", "invoke")
def run_agent(prompt: str) -> str:
    ...  # your agent logic
    return result

# Option 2 — log events manually
sentinel.log_event(
    "payment-agent",
    "tool_call",
    duration_ms=120,
    input_data={"tool": "stripe_charge", "amount": 2999},
    output_data={"status": "ok"},
)

Events fire in daemon threads — your agent never waits for Sentinel.

Configuration

Method How
Direct sentinel.init(api_key="sk_live_...")
Env var SENTINEL_API_KEY=sk_live_...
Custom URL sentinel.init(api_key=..., api_url="https://...")

API

sentinel.init(api_key, api_url=None) → SentinelClient

Initialize the default client. Call once at startup.

sentinel.log_event(agent_id, action_type, *, input_data=None, output_data=None, duration_ms=None, framework=None, session_id=None)

Log a single event. Returns immediately (fires in background thread).

sentinel.wrap(agent_id_or_fn, action_type="invoke", *, framework=None)

Wrap a callable to auto-log every invocation. Supports two forms:

# Decorator with explicit IDs
@sentinel.wrap("my-agent", "process")
def my_fn(...): ...

# Direct wrap — agent_id inferred from function name
wrapped = sentinel.wrap(my_fn)

SentinelClient

For multi-tenant apps or multiple API keys:

from sentinel import SentinelClient

client = SentinelClient(api_key="sk_live_...")
client.log_event("agent-a", "invoke")

Field stripping

The following fields are automatically stripped from input_data and output_data before sending to protect sensitive data: prompt, completion, content, messages, text.

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

sentinel_agent_sdk-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

sentinel_agent_sdk-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sentinel_agent_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sentinel_agent_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df8f4aee7c9732ba1ac7f5ad503be5cd3e97f17783a80b51950a9f5ed82bfe8d
MD5 fe63879d6e1352e0a61b4df1f6bfcd29
BLAKE2b-256 5abdf312ca6888e90528ec19a5771676d57e2d55e6b628c21921bb05af1acddb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sentinel_agent_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f424eb945301c1d4b70b494ddc13591c413f7480fede1f34964bccb3439f97d7
MD5 7daba86540f9f75a3a827c7eb7e1f49b
BLAKE2b-256 5d3b682ff2ced5269f5db08f75a487734319cb14a52aa422a8424704fe71e252

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