Wrangler Workflow bindings configure default instance retention
Introduced 2026-08-25 · score 0.94
HOW TO USE IT
When a Workflow’s instances need a per-Workflow retention default, add optional `default_retention` to its Wrangler `workflows` binding. Set `success_retention` and/or `error_retention` to a duration string or whole number of milliseconds; instances with their own retention keep that setting.
{
"workflows": [
{
"binding": "<BINDING_NAME>",
"name": "<WORKFLOW_NAME>",
"class_name": "<CLASS_NAME>",
"default_retention": {
"success_retention": "3 days",
"error_retention": "7 days"
}
}
]
}WHY THIS HELPS
Set default retention periods for instances of a Workflow in Wrangler configuration.
REQUIREMENTS AND LIMITATIONS
- Version: 4.126.0
- workflows[].binding (required): Binding name used to refer to the Workflow; must be a valid JavaScript variable name.
- workflows[].name (required): Name of the Workflow.
- workflows[].class_name (required): Exported Workflow class name; must match the class exported from the Worker.
- workflows[].default_retention: Default retention for instances that do not set their own retention; capped at the account retention limit.
- workflows[].default_retention.success_retention: Retention for successfully completed or terminated instances; accepts a duration string or whole number of milliseconds.
- workflows[].default_retention.error_retention: Retention for instances that end in an errored state; accepts a duration string or whole number of milliseconds.
- Each retention side is optional.
- Durations are interpreted by the Workflows API, which caps them at the account's retention limit.
- The per-Workflow default applies to instances that do not specify their own retention.
FIRST-PARTY EVIDENCE
- https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.126.0
- https://developers.cloudflare.com/workers/wrangler/configuration/
Check the installed version and the source before using it. Entry JSON