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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sentinel_agent_sdk-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 904584fed64d2232167a8215a105dfbf6383d492fd636fd137cc086370b895cc
MD5 d4c5a57987902f6247fbbffe232852c8
BLAKE2b-256 1f98680d2f396ed7be57aa1e71481c860dae3b78f8323d45fa380c0533eafff8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sentinel_agent_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ebb285869bb35ce8db99aeb3767d5c73a23f5753d209ab9c758295b2fd26b70f
MD5 383d832b2c8e140fc8a4e0957085f762
BLAKE2b-256 a47d8c0e4068a77000c078dd87ef878207b900b5dafc1e6e30c885979396f6dd

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