sentinel-agent-sdk
v0.1.4
Published
Non-blocking AI agent event logging for compliance teams
Maintainers
Readme
sentinel-agent-sdk
Non-blocking AI agent event logging for Node.js / TypeScript. Every agent action fires a tamper-evident audit event to Sentinel — without adding latency to your agents.
Install
npm install sentinel-agent-sdkRequires Node.js 18+. Zero runtime dependencies.
Quick start
import * as sentinel from 'sentinel-agent-sdk'
// Initialize once at startup
sentinel.init({ apiKey: 'sk_live_...' })
// Option 1 — wrap an async function (auto-logs every call)
const runAgent = sentinel.wrap('payment-agent', 'invoke', async (prompt: string) => {
// your agent logic
return result
})
// Option 2 — log events manually
sentinel.logEvent('payment-agent', 'tool_call', {
durationMs: 120,
inputData: { tool: 'stripe_charge', amount: 2999 },
outputData: { status: 'ok' },
})Events fire via a detached promise — your agent never awaits Sentinel.
Configuration
| Method | How |
|--------|-----|
| Direct | sentinel.init({ apiKey: 'sk_live_...' }) |
| Env var | SENTINEL_API_KEY=sk_live_... |
| Custom URL | sentinel.init({ apiKey: '...', apiUrl: 'https://...' }) |
API
init(opts: { apiKey?: string; apiUrl?: string }) → SentinelClient
Initialize the default client. Call once at startup.
logEvent(agentId, actionType, opts?)
Log a single event. Returns void immediately (fires in background).
sentinel.logEvent('my-agent', 'tool_call', {
durationMs: 45,
inputData: { tool: 'search', query: 'hello' },
outputData: { results: 3 },
framework: 'langchain',
sessionId: 'sess-abc123',
})wrap(agentId, actionType, fn, opts?)
Wrap an async function — logs every invocation automatically.
const wrappedAgent = sentinel.wrap('my-agent', 'invoke', myAsyncFn)
const result = await wrappedAgent(input) // logged automaticallySentinelClient
For multi-tenant apps or multiple API keys:
import { SentinelClient } from 'sentinel-agent-sdk'
const client = new SentinelClient('sk_live_...')
client.logEvent('agent-a', 'invoke')Field stripping
The following fields are automatically stripped from inputData and outputData before sending: prompt, completion, content, messages, text.
CommonJS
const sentinel = require('sentinel-agent-sdk')
sentinel.init({ apiKey: process.env.SENTINEL_API_KEY })License
MIT
