Skip to content

Track upstream: Workflows API "waiting for event" status #824

@threepointone

Description

@threepointone

When building UIs for human-in-the-loop workflows, we need to distinguish between workflows that are actively processing vs. blocked waiting for an event (e.g., approval). Currently, the Cloudflare Workflows API returns "running" for both states.

Current Workaround

In the Agents SDK, we persist waitingForApproval in metadata.uiState when a workflow signals it's waiting (via reportProgress), and clear it when the event is sent. See examples/workflows for the implementation.

Upstream Dependency

This depends on the Workflows team exposing a distinct status (e.g., "waiting" or "waiting_for_event") from WorkflowInstance.status() when a workflow is blocked on step.waitForEvent().

When Resolved

Once the Workflows API exposes this status:

  1. Update WorkflowStatus type in packages/agents/src/workflow-types.ts
  2. Remove uiState.waitingForApproval workaround from examples/workflows
  3. Update mapStatus() to use the native status
  4. Update documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions