Skip to main content
Built-in - Framework-level agent. Configure only - cannot modify source.

Overview

The HITL (Human-in-the-Loop) agent suspends workflow execution for manual approval. It leverages Cloudflare Durable Objects for stateful, reliable state persistence across workflow suspensions and resumptions, enabling truly durable human-in-the-loop workflows that can pause for hours or days without losing state. Features:
  • Durable Object storage for reliable state persistence across suspensions
  • Stateful workflow resumption - workflows pause and resume seamlessly
  • Multiple notifications: Slack, Email (via MailChannels), Webhook
  • Configurable timeouts with auto-expiry
  • Approval/rejection with comments

Required Bindings

Add this to your wrangler.toml:

Actions

The HITL agent supports two primary actions for controlling workflow execution:

suspend

Pauses workflow execution and waits for human approval. The workflow state is persisted to a Durable Object, allowing it to resume from the exact same point later.

resume

Resumes a suspended workflow with approval/rejection data. This is typically called via the callback URL mechanism.

Durable Objects Integration

The HITL agent uses Cloudflare Durable Objects to provide stateful human-in-the-loop workflows: Why Durable Objects?
  • State persistence - Workflow state survives across Worker invocations
  • Global consistency - Each workflow gets a unique Durable Object instance
  • Long-lived workflows - Support for approvals that take hours or days
  • Automatic cleanup - State is removed after approval/rejection or timeout
How it works:
  1. When suspend is called, workflow state is serialized to a Durable Object
  2. A unique token is generated for resumption
  3. Notifications are sent with callback URLs containing the token
  4. When the callback URL is invoked, the Durable Object state is retrieved
  5. Workflow resumes from the exact point where it was suspended
  6. State is cleaned up after resumption or timeout

Basic Usage

Inputs

Configuration

Single Approver

Multiple Approvers

With Timeout

With Metadata

Complete Workflows

Content Approval

Transaction Approval

Code Review

Output Schema

Notification Channels

The HITL agent supports three notification channels to alert approvers:

Slack Notifications

Slack notifications include:
  • Formatted approval request with emoji
  • Execution ID and approval data
  • Approve/Reject buttons as URLs
  • Expiration countdown

Email Notifications (via MailChannels)

Email notifications use the MailChannels API which is free for Cloudflare Workers. The sender email must be from a domain you control.

Webhook Notifications

Webhook payload:

Callback URLs

When a workflow is suspended for approval, Conductor generates a unique resumption token. The approval/rejection is handled via callback URLs:
The base path (/callback) is configurable via APIConfig.hitl.resumeBasePath.

Security Model

The callback URLs use token-based authentication - the token itself IS the auth (like a password reset link):
  • Token is cryptographically generated (crypto.randomUUID())
  • Token is one-time use (deleted after resumption)
  • Token has expiration (configured via timeout)
  • Token is delivered via secure channel (notification to authorized user)

Example: Custom Approval UI

Best Practices

1. Set Reasonable Timeouts
2. Handle Timeouts Gracefully
3. Provide Context
4. Use Appropriate Approver Counts
5. Track Rejections

Common Use Cases

Expense Approval

Marketing Campaign

Data Export

Limitations

  • Max timeout: 7 days (default: 24 hours)
  • Notification channels: Slack, Email, Webhook (no Teams yet)
  • No delegation: Approvers can’t delegate to others
  • Single state per token: Each suspension creates a unique token

Next Steps

RAG Agent

Retrieval-augmented generation

Built-in Overview

All built-in agents