Interrupt Awaiter
Suspends until the next RUN_FINISHED { outcome = "interrupt" } arrives on events, then exposes the interrupts and a resolver so the UI can collect the user's decision.
The resume contract per the AG-UI draft is a new run whose request body carries resume: [{ interruptId, status, payload? }]. ApprovalResponse models that payload; the transport-side concern of starting the new run lives in the calling app.
See also
Types
Link copied to clipboard
data class ApprovalResponse(val interruptId: String, val status: InterruptAwaiter.ApprovalResponse.Status, val payload: JsonObject? = null)
Functions
Link copied to clipboard
suspend fun awaitApproval(events: Flow<AguiEvent>): Pair<List<Interrupt>, CompletableDeferred<List<InterruptAwaiter.ApprovalResponse>>>
Collect until the first interrupt arrives, then suspend for the user's response.