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.1.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.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sentinel_agent_sdk-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 62dea86e3a747c2e13dd20c9361546a0c94623b5c2fde0909b114805c22b8c7c
MD5 5e402cc882a94af3a5001a669b45173b
BLAKE2b-256 09f865f5f3f657032947ee3164dcf192267142a7f839e9db5c084b86f9fdef85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sentinel_agent_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9caa88e030b498a562d86588068d7e079d7d39766add7eb9a1d901b97c3f24c
MD5 cb835f060ba4698b0f78696ded305228
BLAKE2b-256 5017e7cf2d1a315f99126338b9b6e89fbbcc724285e7c7b300bb4deabfe99c5b

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