Skip to content

Add retention support for workflows - #1948

Merged
ericclemmons merged 4 commits into
mainfrom
codex/workflow-retention-tracking
Aug 14, 2026
Merged

Add retention support for workflows#1948
ericclemmons merged 4 commits into
mainfrom
codex/workflow-retention-tracking

Conversation

@ericclemmons

@ericclemmons ericclemmons commented Jul 14, 2026

Copy link
Copy Markdown
Member

tl;dr – Pass Workflow instance retention through Agent.runWorkflow().

Workflow.create() supports retention for automatically disposing of success/error instances:

https://developers.cloudflare.com/workflows/build/workers-api/#workflowinstancecreateoptions

Agent.runWorkflow() does not currently support retention:

https://developers.cloudflare.com/agents/runtime/execution/run-workflows/#runworkflowworkflowname-params-options

This adds the native, strongly typed retention option and forwards it unchanged to the underlying Workflow binding.

Agent-local tracking behavior is unchanged. However, a follow-up PR will automatically reconcile the Agent's DB based on retention. This will remove the need for https://developers.cloudflare.com/agents/runtime/execution/run-workflows/#cleanup-strategy based on time.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ea30dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agents Minor
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1948

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1948

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1948

hono-agents

npm i https://pkg.pr.new/hono-agents@1948

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1948

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1948

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1948

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1948

commit: 6ea30dd

@ericclemmons ericclemmons self-assigned this Jul 14, 2026
@ericclemmons
ericclemmons force-pushed the codex/workflow-retention-tracking branch from c5acfeb to 314a8b2 Compare July 27, 2026 22:39
@ericclemmons ericclemmons changed the title Pass Workflow retention through Agent.runWorkflow() so that tracking expiry matches instance state Pass Workflow retention through Agent.runWorkflow() so that callers can control instance retention Jul 27, 2026
@ericclemmons
ericclemmons changed the base branch from codex/workflow-tracking-retention to main July 27, 2026 22:40
@ericclemmons ericclemmons added enhancement New feature or request javascript Pull requests that update javascript code ready-for-review-and-merge PR is ready for review and/or merge labels Aug 13, 2026
@ericclemmons ericclemmons changed the title Pass Workflow retention through Agent.runWorkflow() so that callers can control instance retention Add retention support for workflows Aug 13, 2026
@ericclemmons
ericclemmons marked this pull request as ready for review August 13, 2026 20:21

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@ericclemmons
ericclemmons force-pushed the codex/workflow-retention-tracking branch 2 times, most recently from 05181d6 to 4884a81 Compare August 14, 2026 17:56
@ericclemmons
ericclemmons force-pushed the codex/workflow-retention-tracking branch from 45eeb85 to 6ea30dd Compare August 14, 2026 19:28
@ericclemmons
ericclemmons merged commit aed6d8f into main Aug 14, 2026
14 checks passed
@ericclemmons
ericclemmons deleted the codex/workflow-retention-tracking branch August 14, 2026 20:22
@ericclemmons

Copy link
Copy Markdown
Member Author

Needed to land this to work on automatically pruning workflows. :yolo:

@github-actions github-actions Bot mentioned this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code ready-for-review-and-merge PR is ready for review and/or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant