01
Find the order
A tool loads order #4831 from the application service.
A support agent loads order #4831, checks the return policy, streams a typed recommendation, and waits for approval before it issues the refund.
Read interrupts and resumeRefund request #4831
MAYA LOPEZ · 12 DAYS SINCE DELIVERY
Customer message
“I received the US keyboard layout instead of the Spanish one. The box is still sealed. Can I get a refund?”
Eligible for a full refund
The request is inside the 30-day window and the item is unopened. Refund to the original payment method.
Issue $84.00 refund?
What happens in the runtime
01
A tool loads order #4831 from the application service.
02
A focused node compares delivery date, condition, and return rules.
03
useReason streams a schema-validated recommendation into React.
04
The run checkpoints before money moves or product data changes.
05
The approved run continues once and records the final outcome.
Human input in one node
Resume replays node code from a checkpoint. Keep side effects after the interrupt or protect them with an idempotency key. useInterrupt marks that checkpoint in the node.
// approve-refund.node.ts
const action = await useInterrupt({
id: "refund-approval",
request: {
kind: "choice",
question: "Issue the $84 refund?",
options: [approve, escalate],
},
});
return {
condition: action,
data: { orderId, action },
};Runtime events in the interface
Load the order through request-scoped tools or an application service.
Validate the recommendation before it appears as product state.
Tie the approval control to the exact checkpoint and request.
Issue the refund after the resumed run reaches the write node.
Rollback and fork the server workflow together with the visible messages.
Larger open-source example
Connect your services to the same workflow, interrupt, and resume APIs used in this example.