OpenProgram Docs

User input requests

Live Workflow questionDeclared Agent question
Callerask_user(question), runtime.ask(...)Agent tool interaction with a declared pre-wait
While waitingSame process, same call stackExecution paused, attempt ended
SavedQuestion, policy, answer. No checkpoint.Checkpoint
After the answerThe function returns from the call. No new attempt, no model or finished tool replayed.Continues from the checkpoint
Browser refreshQuestion drawn again while its owner is activeQuestion drawn again
Worker restartExecution interrupted, stack not restored, nothing replayedStays available
Tool permissionsCannot grant themPermission approvals unchanged

A preapproved wait takes precedence over the live binding and must match the requested presentation exactly.

API and outcomes

from openprogram.programs.tools.interaction.ask_user import ask_user
answer = ask_user("Who wrote this report?")

runtime.ask(prompt=None, *, options=None, multi=False, allow_custom=True,
            questions=None, timeout=300.0, default=None)
Outcomeruntime.askask_user
AnsweredThe answerThe answer
DeclinedUserDeclinedNone
Timed outdefault if given, else AskTimeoutNone
Execution cancelledExecution cancellation exceptionPropagates
Runtime, storage or transport errorPropagatesPropagates
No handler, no usable runtimeNone

runtime.confirm and runtime.form share the question transport.

How ask_user finds an answer
  1. A handler set by run_with_follow_up, scoped to the execution context and inherited by its background thread, or the global CLI handler. The scoped handler neither replaces the frontend handler nor captures another concurrent Workflow's question.
  2. runtime.ask, when the runtime has a question transport or a connected session.
  3. Terminal input, on a TTY.
  4. None.

Each FollowUp accepts one answer; a second fails at once.

Live Workflow ownership

The subprocess runner binds execution ID, attempt ID, generation and producer identity for the call. A runtime without this binding cannot create a live question.

Creating and answering both verify, in one transaction, that the execution is running, the attempt is the current active owner and its lease is valid.

Publish
The child sends question.asked through QueueTransport; the parent builds the frontend event from the stored request and relays the canonical answer notification
Answer authority
The canonical wait store. The registry only wakes a local waiter.
Rejected
Duplicate answers and replies from another execution, by the command protocol

Browser and process lifecycle

EventResult
Session loadOpen questions replayed as the same frame the question card already handles
AnswerQuestion endpoints and the execution answer command use one record and one authorization check
Execution stoppedIts open questions cancelled
Child exitsOnly that producer's live questions closed
Owner lostAbandoned live questions cancelled; a stale reply cannot continue an ended call
Reference designs
SystemTaken from it
opencodeTool calls ctx.ask(...): server Deferred and pending map, permission.asked down, REST reply up, a list endpoint so a reconnecting client recovers pending questions. A rejection may carry text the model sees as the tool error.
Claude CodeAskUserQuestion rides the permission pipeline; options plus an always-present “Other”; a pending request snapshot in session metadata so remote UIs can redraw it, execution stack never saved; interactive tools disabled with no human attached.
openclaw30-minute timeout with an explicit fallback; channel buttons whose value is a plain text command (/approve <id> …), so text-only channels work the same; for channel-started runs the tool returns “pending” and the result is injected later.
MCP elicitationThree outcomes (accept, decline, cancel) and flat-object schema limits for form-style asks.
Verification

Tests use public ask_user with the real Runtime and canonical wait commands: same-call continuation, cancellation, invalid owner or session, transport failure, producer cleanup. Native acceptance needs a question in the installed App, a browser refresh, and an answer that lets the Workflow finish. A returned WAITING_USER object does not show the UI worked.

Last updated · 2026-11-25