Skip to content
AgentEnsemble AgentEnsemble
Get Started

Leveled Audit Trail

AgentEnsemble v3.0.0 provides a leveled audit trail with dynamic rule-based escalation for production observability and compliance.


LevelWhat is recorded
OFFNothing (dev/test)
MINIMALCross-ensemble delegation events only
STANDARD+ task start/complete/fail, review decisions
FULL+ tool I/O, LLM token events

Ensemble.builder()
.chatLanguageModel(model)
.auditPolicy(AuditPolicy.builder()
.defaultLevel(AuditLevel.STANDARD)
.build())
.auditSink(AuditSink.log())
.task(Task.of("Process payment"))
.build()
.run();

Audit level can escalate based on conditions:

AuditPolicy policy = AuditPolicy.builder()
.defaultLevel(AuditLevel.MINIMAL)
.rule(AuditRule.when("task_failed")
.escalateTo(AuditLevel.FULL)
.on("*")
.duration(Duration.ofMinutes(10))
.build())
.build();

When a task fails, audit level escalates to FULL for 10 minutes, then reverts to MINIMAL automatically.


.auditSink(AuditSink.log())

Records are written as structured log entries with MDC context:

  • audit.level — the audit level
  • audit.category — event category (e.g., task.start, tool.call)
  • audit.ensemble — ensemble ID
  • audit.traceId — correlation trace ID

All audit records are immutable and contain:

FieldDescription
timestampWhen the event occurred
levelAudit level at the time of recording
ensembleIdWhich ensemble produced the event
categoryEvent category (e.g., task.start)
summaryHuman-readable summary
traceIdCorrelation ID for distributed tracing
detailsImmutable map of event-specific details