Skip to main content

AI agent pauses for World ID approval before booking a flight

Human-in-the-loop lets an AI agent pause mid-execution and wait for a real, verified human to approve an action before continuing. Every approval is cryptographically bound to the action via World ID — no bots, no spoofing, no replay. Built on the Workflow SDK and the Vercel AI SDK.

Install

Environment variables

Get these from the World developer portal by creating an app.

Step 1: Define the workflow

Step 2: Register the approval tool

The default action is the unique toolCallId. For a sensitive operation, your backend must bind the approval to the intended operation and its parameters, independently verify the proof, and consume the approval once before performing the side effect. A required approval input is not proof of authorization — tool inputs are LLM-generated. See the flight booking example for proof verification and parameter binding.

Step 3: Render the approval on the client

This example uses the <HumanApproval> component, if you want to customize the UI you can use the useHumanApproval hook instead.

Flight booking example

Check out Flight booking example for a complete implementation of a human-in-the-loop workflow with World ID approval.