Audit Logging Kit
Immutable decision trail for compliance. Every agent action, tool call, and reasoning step is logged with tamper-evident hashes.
Total Entries
30
Errors
5
Blocked
3
Avg Latency
2719ms
Decision Log
30 entriesIntegration Code
import { createAuditLogger, HashChain } from 'agent-tools-kit/safety'
const audit = createAuditLogger({
// Tamper-evident hash chain (SHA-256)
integrity: new HashChain({ algorithm: 'sha256' }),
// Storage adapters
storage: {
primary: new PostgresAdapter(process.env.AUDIT_DB_URL),
backup: new S3Adapter({ bucket: 'audit-logs', region: 'us-east-1' }),
},
// What to capture
capture: ['tool_calls', 'model_calls', 'decisions', 'errors', 'reasoning'],
// Retention policy
retention: { days: 365, compress: true },
// Real-time streaming
stream: {
enabled: true,
destinations: ['websocket', 'cloudwatch'],
}
})
// Auto-instrument your agent
agent.use(audit.middleware())
// Manual logging for custom decisions
audit.log({
action: 'custom_decision',
agentId: agent.id,
input: userRequest,
decision: 'allowed',
reasoning: 'No policy violations detected',
metadata: { sessionId, conversationTurn: 5 },
})
// Query logs for compliance review
const violations = await audit.query({
level: 'audit',
decision: 'blocked',
dateRange: { from: '2025-01-01', to: '2025-03-31' },
})
// Verify integrity of the chain
const isValid = await audit.verifyChain()
// => { valid: true, entries: 15420, gaps: 0 }