Loop Engine

Ai And Automation

Confidence Evidence

Why evidence matters

Evidence is persisted in every TransitionRecord.
For AI actions, evidence is the audit answer to: why was this recommendation accepted?.

buildActorEvidence()

From @loop-engine/actors:

1buildActorEvidence(actor: Actor, baseEvidence: Evidence): Evidence

For all actor types, it merges:

  • actor_type
  • actor_id

For ai-agent, it also merges:

  • ai_agent_id
  • ai_confidence (if present in base evidence)
  • ai_reasoning (if present in base evidence)

Confidence policy

Loop Engine stores confidence but does not enforce policy thresholds itself.
Implement thresholds in your app layer:

  • >= 0.90: can auto-execute when authorized
  • 0.70 - 0.89: execute with review workflow
  • < 0.70: recommend only, require human gate

Reasoning best practices

  • include concrete numeric drivers
  • include threshold context
  • keep concise for audit readability

Good:

1Stock 18% below reorder point (82 units). Lead time 12d. Trigger threshold: 95 units.

Reading AI evidence from history

1const history = await engine.getHistory(aggregateId)
2 
3for (const row of history) {
4 if (row.actor.type !== 'ai-agent') continue
5 console.log(row.evidence.ai_confidence, row.evidence.ai_reasoning)
6}