Workflow instances now support pause(), resume(), restart(), and terminate() methods in local development
Key Points
- pause/resume/restart/terminate available locally
- Test full workflow lifecycle with wrangler dev
- TypeScript instance API supported
Summary
Workflow instance methods pause(), resume(), restart(), and terminate() are now supported in local development when running wrangler dev. Engineers can create workflow instances locally and test full lifecycle transitions before deploying to production.
Key Points
- Available only in local dev via
wrangler dev. - Methods and effects:
pause()— pauses a running workflow instance.resume()— resumes a paused instance.restart()— restarts the instance from the beginning.terminate()— stops the instance immediately.
- Quick usage (TypeScript): const instance = await env.MY_WORKFLOW.create({ id: "my-instance-id" }); await instance.pause(); await instance.resume(); await instance.restart(); await instance.terminate();
- Practical tips:
- Await each call and handle errors to avoid unexpected states.
- Use this to validate lifecycle handling, timeouts, and cleanup logic locally before deploying.