Cloudflare Workflows adds pause(), resume(), restart() methods to local development
New Instance Lifecycle Methods in Local Development
Cloudflare Workflows now supports four essential instance management methods in local development environments using wrangler dev:
pause()- Pauses a running workflow instanceresume()- Resumes a paused instancerestart()- Restarts the instance from the beginningterminate()- Terminates the instance immediately
Testing the Full Workflow Lifecycle
Developers can now test the complete workflow instance lifecycle locally before deploying to production. This enables comprehensive testing of workflow control flow, state management, and error handling scenarios within the local development environment.
const instance = await env.MY_WORKFLOW.create({
id: "my-instance-id",
});
await instance.pause(); // pauses a running workflow instance
await instance.resume(); // resumes a paused instance
await instance.restart(); // restarts the instance from the beginning
await instance.terminate(); // terminates the instance immediately
Getting Started
These methods are immediately available when using wrangler dev for local Workflows development. No additional configuration or updates are required—simply use these methods in your local test code.