aegis.getAuditLog()
Returns all AuditEvent objects recorded in the current session.
In the preview SDK, events are stored in-memory. In the full SDK, events are shipped to the Auditail API and queryable via the dashboard.
Signature
- TypeScript
- Python
aegis.getAuditLog(): AuditEvent[]
aegis.get_audit_log() -> list[AuditEvent]
AuditEvent Schema
interface AuditEvent {
auditId: string;
agentId: string;
userId?: string;
action: string;
payload: Record<string, unknown>;
approved: boolean;
reason?: string;
matchedRule?: string;
tags?: Record<string, string>;
timestamp: string; // ISO 8601 UTC
environment: string;
sdkVersion: string;
}
Example
- TypeScript
- Python
const log = aegis.getAuditLog();
// All blocked events
const blocked = log.filter(e => !e.approved);
// Events by agent
const billingBotEvents = log.filter(e => e.agentId === 'billing-bot-01');
// Print a summary
log.forEach(e => {
const status = e.approved ? '✅' : '🚫';
console.log(`${status} [${e.action}] agent=${e.agentId} id=${e.auditId}`);
});
log = aegis.get_audit_log()
blocked = [e for e in log if not e.approved]
for event in log:
status = "✅" if event.approved else "🚫"
print(f"{status} [{event.action}] agent={event.agent_id} id={event.audit_id}")