← All patterns

Human-in-the-Loop Checkpoint

Repo Migration

The Problem

Fully autonomous agent pipelines are powerful but risky for irreversible actions — pushing code, sending emails, modifying production data. You need to trust but verify: let agents do the work, but give a human the final say at specific moments before execution continues.

The Pattern

Stage 1 (automated)
      │
      ▼
┌──────────────────┐
│  CHECKPOINT      │  ← execution pauses here
│  "outline-       │
│   approved"      │
└────────┬─────────┘
         │
   ┌─────┴──────┐
   ▼            ▼
Approve       Reject
   │            │
   ▼            ▼
Stage 2      Halt / retry
(automated)

When to Use

When NOT to Use

Code Example

import { QueueAI } from "@queueai/sdk"

const queue = new QueueAI({ apiKey: process.env.QUEUEAI_API_KEY })

const task = await queue.submit({
  name: "repo-migration",
  input: {
    repoUrl: "https://github.com/your-org/your-repo",
    migration: "pages-router-to-app-router",
  },
  model: { primary: "anthropic/claude-opus-4-8" },
  budget: { maxCostUsd: 10.00 },
  checkpoints: ["plan-approved", "diff-approved"],
})

// The task pauses at each checkpoint.
// Approve via the dashboard or the SDK:
await task.approveCheckpoint("plan-approved")
from queueai import QueueAI

queue = QueueAI(api_key=os.environ["QUEUEAI_API_KEY"])

task = queue.submit(
    name="repo-migration",
    input={
        "repo_url": "https://github.com/your-org/your-repo",
        "migration": "pages-router-to-app-router",
    },
    model={"primary": "anthropic/claude-opus-4-8"},
    budget={"max_cost_usd": 10.00},
    checkpoints=["plan-approved", "diff-approved"],
)

task.approve_checkpoint("plan-approved")

See it in action: This pattern powers the Repo Migration template in QueueAI.