Human-in-the-Loop
AI applications frequently need human judgment at key decision points. A user might approve a deployment, choose between generated options, or provide feedback on a draft. Idyllic supports these patterns through state fields that signal pending input, allowing your system to wait efficiently until the user responds.The Pattern
Set state indicating you’re waiting for input, then return from the action. The Durable Object hibernates with zero compute cost while the user decides. When they respond, their input arrives as a new action call:How It Works
There’s no special pause primitive. When your action setspendingConfirm, that broadcasts to clients. The action completes normally. The Durable Object becomes eligible for hibernation.
On the client, the component re-renders. When pendingConfirm has data, render the dialog. When the user responds, call actions.respond(), which wakes the Durable Object and continues the workflow.
The system can wait indefinitely at zero compute cost.
Confirmation UI
Render based onpendingConfirm state:
Multi-Step Approval
Track approval stages:Timeouts
Useschedule() for timeout behavior:
FAQ
What if the user never responds?
The system waits indefinitely at zero cost. Implement timeouts if needed.How long can the system wait?
Indefinitely. State persists in SQLite. Close your browser, return weeks later—the pending confirmation is still there.Can I resume in a different browser?
Yes. State persists across sessions and devices. Same instance ID shows same state.What about authentication?
Verify user identity in therespond action. Check connection metadata or pass user info as arguments.