I haven't had any issues so far but also

I haven't had any issues so far but also haven't played with hibernation much so far 😅 ... but I want to know if my assumption is correct. Rules of workflows stating that you should not depend on state define solely outside of a step, and workflows can use outputs of steps across their execution. So... would somethint like this be OK?
export class MyWorkflow extends WorkflowEntrypoint {
let someState = await step.do('define-state', async() => ....)

while (x of someState) {
await step.do('some execution', async() => ...)
step.sleep('xxx', '1 day') // or enough time to hibernate for example
someState = await step.do('re-define state', async() => ...) // this sets someState to false
}

await step.do('we end the flow', async () => ...)
}
export class MyWorkflow extends WorkflowEntrypoint {
let someState = await step.do('define-state', async() => ....)

while (x of someState) {
await step.do('some execution', async() => ...)
step.sleep('xxx', '1 day') // or enough time to hibernate for example
someState = await step.do('re-define state', async() => ...) // this sets someState to false
}

await step.do('we end the flow', async () => ...)
}
2 Replies
fforres
fforresOP•2w ago
or maybe sleep/hibernation coming last in the loop (after we update someState) 🤔 the TLDR for this is: Love agents and the work Sunil & team has put there, but observability DX/UX of workflows is really good also, so trying to see how to combine them better for agent execution-loops 🙂
ItsWendell
ItsWendell•2w ago
If I undestand it correctly, when a Workflow re-initializes after sleep, retries or any other reason, the promises of your await step.do calls that were already successfully executed would just instantly resolve. That means that re-defining state should be fine and your workflow should work as expected!

Did you find this page helpful?