Immutable Action Logging for Agents
Append-only logs, cryptographic signatures, and tamper-evident audit trails.
Why Agents Need Immutable Logs
Agents take actions autonomously — often without a human reviewing each step. When something goes wrong, you need to answer: what did the agent do, when, on whose behalf, and why?
An immutable, tamper-evident log makes it impossible to retroactively alter the audit trail.
Log Entry Schema
Every log entry captures: timestamp, agent identity, user identity, action type, parameters, result, and a hash linking it to the previous entry. This structure supports both search and tamper detection.
from dataclasses import dataclass
from typing import Any
@dataclass
class AuditEntry:
timestamp: float # Unix time (UTC)
agent_id: str
user_id: str
action_type: str
parameters: dict
result: dict
session_id: str
prev_hash: str # hash of previous entry
entry_hash: str = '' # computed after constructionAll lessons in this course
- Immutable Action Logging for Agents
- Policy Enforcement for Agent Actions
- Regulatory Compliance: GDPR and SOC2
- Human-in-the-Loop Approval Gates