/pattern/audit-trail/

04 · ProductionGovernance & SafetyExecution LogDecision LogTrace Log

Audit Trail.
Every step, signed and timestamped.

Decisions, tool calls, inputs, outputs, and approvals are written to an append-only, tamper-evident record, so every action a run took can be reconstructed and attributed after the fact.

In practiceAfter a disputed wire transfer, a bank's audit trail surfaces the exact tool call and reasoning that approved it, letting the security team trace accountability and close the gap.

Without itWithout an audit trail, a post-incident investigation has no record of which agent took which action, making root-cause analysis and compliance reporting impossible.

When to reach for it

  • Compliance or debugging demands traceability.
  • Agents trigger external actions.
  • Quality or security analyses must be possible.

When it backfires

  • Logs would store sensitive data without protection.
  • Retention rules are unresolved.
  • Logging only generates unused noise.

The tradeoff

Traceability is achieved against privacy, storage, and governance overhead.

The effect

What it actually does.

Every decision and action leaves a traceable entry.

agentaudit logentry 1entry 2entry 3
Pitfalls

Two ways this pattern will hurt you.

Trails that omit the prompt

The audit trail logs the tool call and response but not the prompt that triggered it. Root-cause analysis is impossible.

Fix · Log the full prompt, model config, and system instructions alongside every action. Treat the prompt as part of the decision record.

Trails that include secrets

The audit trail captures API keys or user PII in plain text. Compliance review becomes a data breach.

Fix · Redact secrets and PII at ingestion. Store raw inputs in a separate secure vault with access controls.

Framework support

Where Audit Trail is native.

OpenAI Agents SDKbuilt-in TracingNative
LangSmith / LangGraphrun + tool logsNative
Microsoft Agent Frameworkactivity logNative
Google ADKevent logsNative
AWS ObservabilityCloudTrail / logsNative

Search

Search patterns, frameworks, and pages.