Core Concepts
Loop Engine vs Workflow Engines
Two Different Problems
Workflow engines like Temporal solve durable execution: retries, timers, distributed coordination, and fault tolerance.
Loop Engine solves decision governance: actor authorization, policy enforcement, evidence capture, and decision audit trail.
These are different problems. Both can exist in the same system.
Temporal's Responsibilities
- Durable workflow execution
- Activity retries with backoff
- Long-running process coordination
- Saga pattern and distributed transactions
- Timer and scheduling primitives
Loop Engine's Responsibilities
- Defining who can trigger each transition
- Enforcing guard policies before allowing state changes
- Capturing evidence attached to each decision
- Attributing every action to a named actor
- Emitting structured events for audit and learning
When to Use Each
Use Temporal when: you need fault-tolerant execution of multi-step operations.
Use Loop Engine when: you need governed, attributable decision checkpoints.
Use both when: AI agents make recommendations inside durable workflows that require human approval, policy enforcement, and audit trail.
Combined Architecture
1AI Agent2 ↓3Loop Engine <- decision governance layer4 ↓5Temporal <- durable execution layer6 ↓7InfrastructureThe agent proposes an action. Loop Engine governs whether it is allowed and by whom. Temporal durably executes the approved action.
Code Example
1import { createLoopSystem } from "@loop-engine/sdk";2import type { ActorRef, TransitionId } from "@loop-engine/core";3 4type TemporalActivityInput = {5 aggregateId: string;6 transitionId: TransitionId;7 actor: ActorRef;8};9 10export async function runApprovedOperation(input: TemporalActivityInput) {11 const { engine } = createLoopSystem({ loops: [/* registered loop definitions */] });12 13 const decision = await engine.transition({14 aggregateId: input.aggregateId as never,15 transitionId: input.transitionId,16 actor: input.actor,17 evidence: { source: "temporal-activity" }18 });19 20 if (decision.status !== "executed") {21 throw new Error(`Operation blocked by governance: ${decision.status}`);22 }23 24 "cmt">// Durable execution happens in workflow engine after approval.25}