Governance

Audit log

Antraft records every decision. The tamper-evident logger hash-chains each record so any edit, reorder, or deletion is cryptographically detectable — a requirement for regulated and compliance use.

Tamper-evident logging

audit.py
from antraft.audit.tamper_evident import TamperEvidentAuditLogger
 
log = TamperEvidentAuditLogger("audit.log", secret="signing-key")
# attach to a runtime:
runtime.auditor = log
 
await runtime.run()
print(log.verify()) # VerifyResult(ok=True, count=N, ...)
Note
Each record stores the SHA-256 of (previous_hash + record). With an optional HMACsecret, an attacker who rewrites the whole file still can't forge a valid chain.

Verifying integrity

verify.py
from antraft.audit.tamper_evident import verify_chain
 
res = verify_chain("audit.log", secret="signing-key")
# res.ok -> bool
# res.count -> records verified
# res.broken_index-> first bad record (if any)
# res.detail -> human-readable reason

What gets recorded

EventContains
actionThe action, the decision (allow/deny/pause), and the reason.
cognitiveAgent thoughts / reasoning steps.
drift_warningAnomalous behavior (e.g. tight loops).
tool_errorA tool/validation/RBAC failure (non-fatal).
run_completeTerminal summary: actions, spend, status, final answer.

Session recording & PII redaction

Capture full input/thought/action/output traces for replay, with PII scrubbed:

record.py
Antraft.agent(model, tools, task="...")
.record_session("session.jsonl", redact_pii=True)
.build()