Examples
Infrastructure Change Approval
What this example shows
Infrastructure change management is high risk by default. This pattern introduces explicit governance checkpoints: AI blast-radius analysis, human SRE approval, and then automation-controlled rollout. Every handoff carries evidence and attributed actors.
Loop diagram
1IDLE --[start_analysis]--> ANALYZING2ANALYZING --[submit_analysis]--> PENDING_APPROVAL3PENDING_APPROVAL --[approve_change]--> APPROVED --[execute_rollout]--> ROLLING_OUT --[complete_rollout]--> COMPLETE4PENDING_APPROVAL --[reject_change]--> REJECTEDActors
| Actor | Type | Role | Guards that apply |
|---|---|---|---|
| change analyzer | ai-agent | Produces blast-radius assessment and recommendation | evidence-required, confidence-threshold |
| sre approver | human | Approves or rejects rollout | human-only |
| deploy controller | automation | Executes approved rollout steps | state/transition constraints |
Key annotated snippet
1"cmt">// @no-typecheck2import Anthropic from "@anthropic-ai/sdk";3import { createLoopSystem } from "@loop-engine/sdk";4import { createAnthropicActorAdapter } from "@loop-engine/adapter-anthropic";5 6const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });7const adapter = createAnthropicActorAdapter(anthropic, { modelId: "claude-opus-4-6" });8const { engine } = await createLoopSystem({ loops: [changeApprovalLoop] });9 10const { actor, decision } = await adapter.createSubmission({11 loopId: "infrastructure.change_approval",12 loopName: "Infrastructure Change Approval",13 currentState: "ANALYZING",14 availableSignals: [{ signalId: "submit_analysis", name: "Submit Analysis" }],15 instruction: "Assess blast radius and rollback readiness.",16 evidence: { changeId: "CHG-10021", service: "payments-api" }17});18 19await engine.transition({20 aggregateId: "chg-2026-03-13-001" as never,21 transitionId: "submit_analysis" as never,22 actor,23 evidence: {24 ...decision,25 blast_radius_score: 0.22,26 affected_services: ["payments-api", "settlement-worker"],27 rollback_plan: "revert migration and recycle workers"28 }29});What emitted events look like
1{2 type: "loop.transition.executed",3 loopId: "infrastructure.change_approval",4 aggregateId: "chg-2026-03-13-001",5 transitionId: "approve_change",6 fromState: "PENDING_APPROVAL",7 toState: "APPROVED",8 actor: { type: "human", id: "sre@company.com" },9 evidence: { approvalTicket: "SRE-4451", approved: true }10}