Skip to content

add task management and workflow integration#683

Closed
whoiskatrin wants to merge 22 commits into
mainfrom
task-with-options
Closed

add task management and workflow integration#683
whoiskatrin wants to merge 22 commits into
mainfrom
task-with-options

Conversation

@whoiskatrin

@whoiskatrin whoiskatrin commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

Addded task-runner example here

Shows how to run long-running background tasks from an Agent using Cloudflare Workflows.

Two patterns demonstrated:

  • Quick analysis - runs in the Agent, good for fast tasks (<30s)
  • Deep analysis - runs in a Workflow, durable with automatic retries
    The workflow sends progress updates back to the Agent, which syncs to connected clients via WebSocket.

Files:

  • examples/task-runner/src/server.ts - Agent that dispatches to workflows
  • examples/task-runner/src/workflows/analysis.ts - Durable workflow with step-based checkpointing
  • examples/task-runner/src/App.tsx - React UI with real-time progress

@changeset-bot

changeset-bot Bot commented Nov 27, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 961d5ba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@683

commit: 961d5ba

@claude

This comment was marked as outdated.

agents-git-bot Bot pushed a commit to cloudflare/cloudflare-docs that referenced this pull request Nov 27, 2025
This syncs documentation from cloudflare/agents PR #683 which adds a task management system with lifecycle tracking to the Agents SDK.

Changes include:
- New concept page explaining tasks and their lifecycle
- API reference documentation for the Tasks API
- Tutorial guide for building a task-based agent
- Examples of using @task() decorator and TaskContext
- Client-side task tracking with useTask() hook

Related PR: cloudflare/agents#683
@claude

This comment was marked as outdated.

@whoiskatrin whoiskatrin changed the title add task management system with lifecycle tracking add task management and workflow integration Dec 14, 2025
… provides retry semantics, use AgentWorkflow for fine-grained checkpoints
agents-git-bot Bot pushed a commit to cloudflare/cloudflare-docs that referenced this pull request Dec 14, 2025
Syncs documentation for cloudflare/agents PR #683 which adds:
- @task() decorator for tracked background operations
- Task management API (get, list, cancel, delete)
- Durable tasks with Cloudflare Workflows integration
- Real-time task updates via WebSocket

Related to: cloudflare/agents#683
@whoiskatrin
whoiskatrin marked this pull request as ready for review December 29, 2025 16:46
agents-git-bot Bot pushed a commit to cloudflare/cloudflare-docs that referenced this pull request Dec 29, 2025
Documents how to integrate Cloudflare Workflows with Agents SDK for running long-running background tasks. Covers both quick analysis (Agent-based) and deep analysis (Workflow-based) patterns with real-time progress tracking.

Based on PR #683: add task management and workflow integration
cloudflare/agents#683

Generated with Claude Code https://claude.com/claude-code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment thread examples/task-runner/src/workflows/analysis.ts Outdated
Comment thread examples/task-runner/src/workflows/analysis.ts Outdated

@deathbyknowledge deathbyknowledge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quick and deep analysis are effectively doing the same... Imo we should try to do more with the workflow so the benefits are clearer

@whoiskatrin

Copy link
Copy Markdown
Contributor Author

The quick and deep analysis are effectively doing the same... Imo we should try to do more with the workflow so the benefits are clearer

Added some more workflow specific features liek human in the loop if finds critical issues and sleep steps.

@deathbyknowledge deathbyknowledge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, covers most features of workflows

import { defineConfig } from "vite";

export default defineConfig({
plugins: [cloudflare()]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come it works without the react plugin? I thought it was required

@threepointone

Copy link
Copy Markdown
Contributor

this looks good, let's chat before landing this

@deathbyknowledge

Copy link
Copy Markdown
Contributor

We can close this since #799 got merged right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants