const workflowWithWaits = defineWorkflow<Record<string, any>, void, void>(
{ id: 'workflow-with-waits' },
async (ctx, input) => {
// Step 1: Process (counts toward timeout)
await ctx.step.run('process', () => processData(input));
// Step 2: Wait 1 hour (does NOT count toward timeout)
await ctx.step.waitFor('wait', { hours: 1 });
// Step 3: More processing (counts toward timeout, but resets execution time of step 1)
await ctx.step.run('finalize', () => finalizeData(input));
}
);
// Timeout only counts running time, not waiting time
const client = PolosClient.fromEnv();
const handle = await workflowWithWaits.invoke(
client,
{ /* ... */ },
{ runTimeoutSeconds: 60 } // 60 seconds of continuous running time
);