Loop Engine model
Loading
Loading
Open Infrastructure · Apache-2.0
Without governance, AI agents improvise — no approval gates, no audit trail, no accountability.
Loop Engine gives AI finite states, deterministic guards, and structured feedback. Not improvisation - control.
A Loop is a named finite state machine — with typed actors, guard policies, and an immutable evidence trail on every transition.
Install only what you govern.
System context
Most enterprise AI projects hit the same wall: a capable model, a data source it's not allowed to touch directly, and no structure for what happens between a signal and a recorded outcome. Loop Engine is the layer that sits in that gap.
Loop Engine is the execution and control layer inside a larger operational stack. It does not replace your data warehouse, ERP, or application UI. It sits where decisions become actions, enforces bounded transitions, and records evidence on every state change.
In practice: signals detect change, decision logic selects next action, Loop Engine executes inside explicit guardrails, evidence is captured for each transition, and the resulting feedback improves future decisions. This pattern is used in production systems, including the Better Data platform.
Loop Engine model
Better Data system model
Loop Engine anchors the execution boundary while preserving full transition evidence.
Used with Commerce Gateway
Loop Engine governs actions that are executed through Commerce Gateway. It is a control layer for policy, guards, and audit — not a standalone automation tool that replaces your gateway or operators.
Commerce Agent pattern (illustrative — a composition, not a separate product):
Agent → Registry (discover) → Gateway (execute) → Loop Engine (govern) → Recorded outcome
Related from Better Data
Loop Engine stays standalone and OSS-first. Cross-module architecture updates, hosted path guidance, and launch context are published on the Better Data blog.
AI works best when decisions are bounded, outcomes are measurable, and every action leaves evidence. Loop Engine provides that structure.
Human, automation, AI agent - the actor model treats all three identically. No action is anonymous. Every transition has attributed evidence.
Each closed loop emits structured training signals. Forecasts improve. Lead times sharpen. The system gets better automatically.
Integrations
Adapters plug into the control layer — Loop Engine is not a generic “do anything” automation runner. Pair with Commerce Gateway when commerce execution needs the same guardrails.
Apache-2.0 with explicit patent grant — the only governed execution layer in this space with a fully permissive, OSI-approved, patent-safe license. Temporal and Inngest ship under SSPL.
Sonar grounds research with citations; Loop Engine runs the governed incident FSM; PagerDuty delivers human review and escalation. End-to-end audit trail on every step.
OpenClaw is the agent that acts. Loop Engine is the runtime that governs what it's allowed to do.
Wrap any Vercel AI SDK tool call with structural approval gates and audit trails. Drop-in compatible with useChat and streamText.
AI agent actions page your on-call engineer. No new approval UI - your team already lives in PagerDuty.
AI actor decisions with full governance — confidence scoring, prompt attribution, and hard guard enforcement at the runtime level.
Same governance model for GPT-4o and o-series — identical guard enforcement, same audit trail, drop-in alongside Claude in multi-model loops.
Governed AI actors via xAI's Grok API — OpenAI-compatible format, same guard enforcement as other adapters.
Google Gemini as a governed Loop Engine actor — native Google AI SDK, Gemini 1.5 Pro and 2.0 Flash supported.
Grounded web retrieval with cited sources for Loop steps that need verifiable, real-time information — regulatory lookups, supplier news, compliance research.
Stateful approval checkpoints and auditable loop orchestration for n8n automations.
Loop Engine governance hooks for long-running Temporal workflows and human gates.
Quick start
import { parseLoopYaml, validateLoopDefinition } from '@loop-engine/sdk'
const yaml = `
loopId: expense.approval
version: 1.0.0
name: Expense Approval
description: Human approval for submitted expenses
initialState: SUBMITTED
states:
- stateId: SUBMITTED
label: Submitted
- stateId: APPROVED
label: Approved
terminal: true
- stateId: REJECTED
label: Rejected
terminal: true
transitions:
- transitionId: approve
from: SUBMITTED
to: APPROVED
signal: approve
allowedActors: [human]
- transitionId: reject
from: SUBMITTED
to: REJECTED
signal: reject
allowedActors: [human]
`
const definition = parseLoopYaml(yaml)
const checked = validateLoopDefinition(definition)
if (!checked.valid) {
throw new Error(checked.errors.map((e) => e.message).join('; '))
}@loop-engine/sdk
High-level entry point for loop systems.
@loop-engine/core
Canonical types and model contracts.
@loop-engine/runtime
Loop engine execution lifecycle.
@loop-engine/dsl
YAML and builder loop definition APIs.
@loop-engine/events
Event contracts and event bus types.
@loop-engine/guards
Built-in and custom guard registry.
@loop-engine/actors
Actor model and attribution helpers.
@loop-engine/observability
Metrics, timelines, replay.