A finished run leaves data behind: the inputs and outputs of the workflow and each of its steps, the payloads on its event log, and anything written to its streams. How long that data is kept is decided by the World you are running on, not by the SDK.
For the Vercel World , retention is documented in the Vercel Workflows docs : how long run payloads stay readable and when they're deleted, how long run metadata is kept, where run data is stored, and how to check whether a run's data has expired.
experimental_retention on start() lets a run ask for a specific retention period, rather than the World's default.
Deleting a run's data as soon as it ends
0 asks the World to delete the run's user data the moment the run completes or fails, rather than keeping it for the World's default window.
Two values are accepted today:
The option is prefixed experimental_ because both its name and the set of values it accepts are expected to change.
What is deleted, and what is not
Deleted: the run's input, output and error; every step's input, output and error; the payloads on the event log; and stream contents.
Kept: the run, step and event records themselves — their ids, timestamps, status, step names, and any attributes you set. They are kept for the World's default period so the run stays visible in the CLI and web UI. A purged run is still listed and still traceable; its payloads simply read back as expired. Its usage still reports what it wrote.
Inspecting a purged run shows it as expired rather than failing. The Workflow CLI renders the run's own input, output and error as :
Step, hook and event payloads read back empty. On the Vercel World they also render as ; on Worlds that clear the stored value outright they simply show as empty. Either way the data is gone — the difference is only in how the absence is labelled.
You cannot read the return value of a run started with experimental_retention: 0 . The deletion races your own read of the result and generally wins, so await run.returnValue throws RunExpiredError instead of resolving.
This is a known limitation. If you need the result, send it somewhere you control, e.g. a step that writes it to your own store, rather than reading it back off the run.
RunExpiredError is not specific to experimental_retention: 0 . Any run read after its retention window has passed throws it, and the error carries runId , runStatus and expiredAt when the World still has them — so a caller can tell a successful run whose result is gone from a failed one whose error is gone. If the run's metadata is gone too, the World reports the run as missing and you get WorkflowRunNotFoundError instead.
Deleting a finished run's data
To delete the data of a run that has already finished, call run.delete() , call deleteRuns() for up to 100 runs at once, or run workflow delete from the CLI . The World deletes the same data a run started with experimental_retention: 0 has deleted when it ends. Metadata is not deleted: the runs stay listed, and so do their steps, events and hooks, with their IDs, names, statuses, timestamps and attributes.
Only finished runs have their data deleted. A run that is still running, sleeping, or waiting on a hook is answered skipped and left untouched: deleting data never cancels a run. To delete an active run's data now, cancel it first, then delete its data. Each run gets its own outcome: deleted , already_deleted (its data was already gone), skipped , not_created , not_found , or failed . A failed outcome with retryable: true can be retried, since deletion is idempotent. Inside a step, a retryable failure throws a RetryableError , so the step retries on its own.
Deleting run data is optional for a World to implement, and there is no fallback: on a World that doesn't support it, run.delete() and deleteRuns() throw, and workflow delete exits with an error. The Local World , the Postgres World and the Vercel World support it. Deleting run data doesn't change how a run is billed; see the Vercel Workflows docs .
Nothing records that a run's data was deleted: the run reads back as expired, the same as a run whose retention ended. If you need a record of the deletion, keep it yourself.
Retention is implemented by the World
The SDK records your preference; it does not enforce it. start() writes the value onto the run as the reserved $retention attribute, and the World decides what to do when the run ends. Attributes are a spec version 4 feature, so experimental_retention: 0 throws against an older World rather than being recorded and ignored. A World that does implement spec version 4 but not retention keeps the data . If you need certainty that a specific World deletes your data, confirm it against that World's own documentation rather than the presence of this option.
