Skip to main content
Glama

LoopIn

AIエージェントのためのヒューマン・イン・ザ・ループ割り込みAPI

LoopInを使用すると、AIエージェントは重要な判断ポイントで一時停止し、人間のレビューを要求し、その判断に基づいて実行を再開できます。エージェントが単独で重大な決定を下すことはもうありません。


なぜLoopInなのか?

自律型エージェントは強力ですが、人間なしでは下すべきではない判断に直面することがあります。LoopInは、すべてのエージェントに安全な出口を提供します:

  1. エージェントが判断ポイントに到達 → POST /interrupts を呼び出す

  2. LoopInが人間に通知 → Webhookまたは直接のレビューURL経由

  3. 人間が承認または拒否 → レビューページまたは POST /interrupts/:id/decide 経由

  4. エージェントが判断をポーリング → GET /interrupts/:id

  5. エージェントが再開 → 判断(および人間が提供した修正済みパラメータ)を使用して実行


Related MCP server: turn-mcp-web

エンドポイント

POST /interrupts

新しい割り込みリクエストを作成します。

リクエスト:

{
  "agentId": "agent-payments-v2",
  "userId": "user-123",
  "action": "Transfer $4,200 to vendor account ending in 9821",
  "context": {
    "vendor": "Acme Supplies",
    "amount": 4200,
    "currency": "USD",
    "invoiceId": "INV-2024-0892",
    "accountLast4": "9821"
  },
  "urgency": "high",
  "expiresIn": 1800,
  "callbackUrl": "https://my-agent.example.com/webhooks/loopin"
}

レスポンス:

{
  "interruptId": "3f4e2a1b-...",
  "status": "pending",
  "expiresAt": "2024-04-12T14:30:00Z",
  "reviewUrl": "http://localhost:3002/review/3f4e2a1b-..."
}

GET /interrupts/:interruptId

現在のステータスと判断をポーリングします。

レスポンス (保留中):

{
  "interruptId": "3f4e2a1b-...",
  "status": "pending",
  "action": "Transfer $4,200 to vendor account ending in 9821",
  "context": { ... },
  "urgency": "high",
  "createdAt": "2024-04-12T13:00:00Z",
  "expiresAt": "2024-04-12T14:30:00Z",
  "reviewUrl": "http://localhost:3002/review/3f4e2a1b-..."
}

レスポンス (解決済み):

{
  "interruptId": "3f4e2a1b-...",
  "status": "approved",
  "decision": "approved",
  "decidedAt": "2024-04-12T13:07:22Z",
  "reason": "Invoice verified, proceed."
}

POST /interrupts/:interruptId/decide

人間の判断を送信します。

リクエスト:

{
  "decision": "approved",
  "reason": "Invoice verified, proceed.",
  "modifiedParams": { "amount": 4200 }
}

レスポンス:

{
  "interruptId": "3f4e2a1b-...",
  "status": "resolved",
  "decision": "approved",
  "decidedAt": "2024-04-12T13:07:22Z"
}

GET /interrupts/pending/:userId

ユーザーのレビューを待機しているすべての保留中の割り込みを一覧表示します。

レスポンス:

[
  {
    "interruptId": "3f4e2a1b-...",
    "action": "Transfer $4,200 to vendor...",
    "urgency": "high",
    "createdAt": "...",
    "expiresAt": "...",
    "reviewUrl": "..."
  }
]

DELETE /interrupts/:interruptId

保留中の割り込みをキャンセルします(エージェントがその判断を必要としなくなった場合)。


GET /analytics/:userId

利用統計情報。

レスポンス:

{
  "userId": "user-123",
  "totalInterrupts": 47,
  "approvalRate": 0.83,
  "avgResponseTimeMs": 142000,
  "byStatus": { "approved": 39, "rejected": 8 },
  "byUrgency": { "high": 12, "medium": 28, "low": 7 },
  "topActionTypes": [
    { "action": "Send payment", "count": 18 },
    { "action": "Delete records", "count": 9 }
  ]
}

レビューページ

すべての割り込みには、人間が読める形式のレビューURLが発行されます:

GET /review/:interruptId

これには以下の内容を表示するHTMLページがレンダリングされます:

  • エージェントが実行しようとしていること

  • すべてのコンテキストデータ(フォーマット済みJSON)

  • 緊急度バッジ

  • 承認 / 拒否 ボタン

  • オプションの理由入力フィールド

このURLをリクエストのレビューが必要な相手に共有してください。デフォルトではログインは不要です。


MCPツール

LoopIn MCPサーバーは、MCP互換のAIクライアント(Claude Desktop、Cursorなど)で使用できる6つのツールすべてを公開しています:

ツール

説明

create_interrupt

エージェントが新しい割り込みリクエストを作成

get_interrupt_status

エージェントが判断をポーリング

list_pending_interrupts

人間がレビューが必要な項目を確認

decide_interrupt

人間が承認または拒否

cancel_interrupt

エージェントが保留中のリクエストをキャンセル

get_interrupt_analytics

利用統計

MCPサーバーのセットアップ (stdio)

{
  "mcpServers": {
    "loopin": {
      "command": "npx",
      "args": ["-y", "@colossal-api/loopin-mcp"],
      "env": {
        "LOOPIN_API_URL": "https://your-loopin-instance.railway.app",
        "LOOPIN_API_KEY": "your-key"
      }
    }
  }
}

エージェントの利用パターン

1. Agent reaches a decision point
   → POST /interrupts { agentId, userId, action, context, urgency }
   ← { interruptId, reviewUrl }

2. Agent saves interruptId and pauses
   → (optionally: notify human via other channels with reviewUrl)

3. Agent polls until resolved
   → GET /interrupts/:interruptId
   ← { status: "pending" }   ← keep polling
   ← { status: "approved", decision, modifiedParams }  ← resume

4. Agent resumes execution
   → use modifiedParams if provided, otherwise proceed as planned

人間の利用パターン

オプションA — レビューURL(最も簡単)

  1. エージェントから reviewUrl を受け取る(メール、Slackなど経由)

  2. ブラウザでURLを開く

  3. コンテキストを確認し、承認または拒否をクリックし、必要に応じて理由を追加する

  4. 完了 — エージェントは次回のポーリングで判断を取得します

オプションB — 保留中リスト(ダッシュボード)

  1. GET /interrupts/pending/:userId — すべてのオープンなリクエストを確認

  2. 個別の reviewUrl を開くか、直接 POST /interrupts/:id/decide を呼び出す


環境変数

変数

デフォルト

説明

PORT

3002

APIサーバーのポート

LOOPIN_BASE_URL

http://localhost:3002

レビューリンク用の公開ベースURL

API_KEY_SECRET

(なし)

オプション: すべてのリクエストに X-API-Key ヘッダーを要求


Colossal APIポートフォリオ

LoopInは、AIエージェント向けのインフラストラクチャAPIスイートである Colossal API の一部です:

  • SubRadar — サブスクリプションの検出とキャンセル

  • MeetSync — カレンダーの調整とスケジュール設定

  • LoopIn — ヒューマン・イン・ザ・ループの割り込みと承認

すべての製品は同じ設計哲学を共有しています。つまり、エージェントがネイティブに使用できるように、MCPサーバーラッパーを備えたシンプルなREST APIです。

Related MCP Connectors

Related MCP Servers