cloudflare / cloudflare/agents

Track upstream: Workflows API "waiting for event" status

Open
#824 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
5.6k
Forks
711
Avg merge
1d 20h
Merged PRs (30d)
53

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.