Examples
OpenClaw Integration
Runtime flow
| Stage | In this example |
| --- | --- |
| Provider | Optional — agent reasoning may live in OpenClaw; governed transitions still pass through Loop Engine |
| Loop + Guards | Approval loop — allowedActors: ['human'], approval_obtained |
| Channel | OpenClaw — WhatsApp/Telegram/Slack/Discord delivery of approval prompts |
| Integration | Downstream PO / ERP trigger after approved transition |
| Evidence | Transition events + messenger reply attribution |
1Provider (optional) → Loop + Guards → Channel (OpenClaw) → Integration → EvidenceOverview
OpenClaw handles delivery and replies across messaging channels, while Loop Engine owns state transitions, actor constraints, and guard decisions.
Approval gates are runtime policy checks, not prompt conventions. Even if an agent asks to self-approve, a transition with allowedActors: ['human'] rejects non-human actors.
Architecture
1User (WhatsApp)2 |3 | "approve rpl-001"4 v5OpenClaw Gateway ------------------------------------.6 | |7 | engine.transition('approve', humanActor) |8 v |9Loop Engine |10 | |11 |- guard: approval_obtained ✅ |12 |- allowedActors: ['human'] ✅ |13 v |14PENDING_BUYER_APPROVAL -> PO_TRIGGERED |15 | |16 '--- loop.transition.executed --------------------'17 "✅ Approved. Loop closed."Using @loop-engine/adapter-openclaw
1"cmt">// @no-typecheck2import { createLoopSystem, LoopBuilder } from '@loop-engine/sdk'3import { OpenClawEventBus } from '@loop-engine/adapter-openclaw'4 5const replenishmentLoop = LoopBuilder6 .create('demo.repl', 'scm')7 .state('A', { isTerminal: true })8 .initialState('A')9 .outcome({ id: 'o', description: 'o', valueUnit: 'o', businessMetrics: [{ id: 'm', label: 'm', unit: '1' }] })10 .build()11 12const { eventBus: inner } = await createLoopSystem({ loops: [replenishmentLoop] })13const eventBus = new OpenClawEventBus(inner, {14 channel: 'whatsapp',15 target: '+15551234567',16 events: ['loop.transition.executed', 'loop.completed', 'loop.guard.failed'],17 approvalStates: ['PENDING_BUYER_APPROVAL']18})19void eventBusThe approval flow
- Demand spike detection starts the loop with
loop.started. - The AI analysis transition moves from
AI_ANALYSIStoPENDING_BUYER_APPROVAL. - OpenClaw receives forwarded loop events and sends:
⚠️ Approval required: rpl-dc-east-001 ... Reply: approve rpl-dc-east-001 | reject rpl-dc-east-001. - A buyer replies
approve rpl-dc-east-001from a phone. - The OpenClaw skill calls
engine.transitionwith a human actor. approval_obtainedpasses and the loop advances toPO_TRIGGERED.- OpenClaw sends
✅ Approved. Loop advanced to: PO_TRIGGERED.
Why guards beat prompts
allowedActors and guard evaluation happen in the runtime transition engine, not in the language model output path. That keeps approval logic deterministic and testable.
Prompt injection can change model text, but it cannot bypass transition authorization or guard failures. This is the security boundary for agentic operations.
Installing the OpenClaw skill
1git clone https:"cmt">//github.com/loopengine/loop-examples2cp -r loop-examples/openclaw-skill ~/.openclaw/skills/loop-engineThe skill supports:
start loop [loop-id]transition [instance-id] [transition-id]approve [instance-id]reject [instance-id]status [instance-id]list loops
Source: loop-examples/openclaw-skill