Metadata-Version: 2.4
Name: sentinel-agent-sdk
Version: 0.1.3
Summary: Non-blocking AI agent event logging for compliance teams
License: MIT
Project-URL: Homepage, https://www.trysentinelagent.com
Project-URL: Repository, https://github.com/happymario123/sentinel
Keywords: ai,agents,compliance,audit,logging
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# sentinel-agent-sdk

Non-blocking AI agent event logging for Python. Every agent action fires a tamper-evident audit event to [Sentinel](https://www.trysentinelagent.com) — without adding latency to your agents.

## Install

```bash
pip install sentinel-agent-sdk
```

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

## Quick start

```python
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:

```python
# 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:

```python
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
