-
Notifications
You must be signed in to change notification settings - Fork 11.8k
feat: Add Cloudflare Workflows integration for Agents #27893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: production
Are you sure you want to change the base?
Conversation
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
Preview URL: https://7d26e18f.preview.developers.cloudflare.com Files with changes (up to 15) |
6bea7d3 to
77ec271
Compare
|
Updated documentation with comprehensive Workflows integration guide. This update completely rewrites the Key additions:
All content follows Cloudflare style guidelines and uses appropriate components (TypeScriptExample, WranglerConfig, Type). |
a546468 to
a0b4961
Compare
d01f229 to
5a16074
Compare
Updated DocumentationThis PR has been updated with comprehensive Workflows integration documentation that includes: New Content Added
Documentation StructureThe updated documentation follows the Diátaxis framework:
All content has been adapted to follow Cloudflare docs style conventions, including proper use of TypeScriptExample and WranglerConfig components. The documentation now provides developers with everything they need to integrate Cloudflare Workflows with Agents for durable, multi-step background processing. |
c46d773 to
724f82a
Compare
|
CI run failed: build logs |
---
title: Kick off long-running Workflows from your Agents
description: The Agents SDK now has first-class support for Cloudflare Workflows, enabling durable multi-step background processing with automatic tracking and bidirectional communication.
products:
- agents
- workflows
date: 2026-01-28
---
import { TypeScriptExample } from "~/components";
The Agents SDK now has first-class support for [Cloudflare Workflows](/workflows/), allowing you to kick off durable, long-running async tasks from your Agent. Track workflow progress, sync state back to your Agent, and implement human-in-the-loop approval flows—all with automatic tracking in SQLite.
Use the new `AgentWorkflow` class to define workflows with typed access to your Agent:
<TypeScriptExample>
```ts
import { AgentWorkflow } from "agents";
import type { AgentWorkflowEvent, AgentWorkflowStep } from "agents";
export class ProcessingWorkflow extends AgentWorkflow<MyAgent, TaskParams> {
async run(event: AgentWorkflowEvent<TaskParams>, step: AgentWorkflowStep) {
// Report progress to Agent
await this.reportProgress({ step: "process", percent: 0.5 });
// Call Agent methods via RPC
await this.agent.updateStatus(event.payload.taskId, "processing");
const result = await step.do("process", async () => {
return processData(event.payload.data);
});
await step.reportComplete(result);
return result;
}
}
```
</TypeScriptExample>
Start workflows from your Agent with `runWorkflow()` and handle lifecycle events:
<TypeScriptExample>
```ts
export class MyAgent extends Agent {
async startTask(taskId: string, data: string) {
// Automatically tracked in Agent database
const workflowId = await this.runWorkflow("PROCESSING_WORKFLOW", { taskId, data });
return { workflowId };
}
async onWorkflowProgress(workflowName: string, workflowId: string, progress: unknown) {
this.broadcast(JSON.stringify({ type: "progress", progress }));
}
async onWorkflowComplete(workflowName: string, workflowId: string, result?: unknown) {
console.log(`Workflow ${workflowId} completed`);
}
}
```
</TypeScriptExample>
Key capabilities:
- **Automatic tracking** in the Agent SQLite database
- **Progress reporting** with typed progress objects
- **Bidirectional communication** between Agents and Workflows via RPC
- **State synchronization** from Workflows back to Agents (broadcasts to clients)
- **Human-in-the-loop** with `waitForApproval()` and `approveWorkflow()`/`rejectWorkflow()`
For the complete API reference and patterns, see [Integrate with Cloudflare Workflows](/agents/guides/workflows-integration/). |
66899ed to
31e18cf
Compare
31e18cf to
7d26e18
Compare
Summary
Syncs documentation for Cloudflare Workflows integration with Agents from cloudflare/agents PR #799.
This PR adds comprehensive documentation for the new AgentWorkflow integration that enables seamless interaction between Cloudflare Agents and Cloudflare Workflows for durable, multi-step background processing.
Changes
New guide: Integrate Cloudflare Workflows with Agents
/agents/guides/cloudflare-workflows-integration/Updated API reference: Run Workflows
/agents/api-reference/run-workflows/Key Features Documented
Related
Source PR: cloudflare/agents#799
🤖 Generated with Claude Code