Skip to content
Proud to collaborate with Microsoft for Startups

agents.end-user.ask-stream ​

Ask the app's agent a question and stream the answer token-by-token. Same bounded end-user session as agents.end-user.ask (its tools are exactly the app's exposed compositions, every call re-authorized); the answer also returns in the terminal state.

Streaming twin of agents.end-user.ask.

Identical end-user gate, principal binding, quotas and app-pinned config — the ONLY differences are:

  1. PENDING is auto_advance_async so the exposed composition wrapping this step returns its run id to the browser IMMEDIATELY (non-terminal), giving the browser an id to open GET /api/workflows/<id>/stream on before the answer exists. (Synchronous agents.end-user.ask returns the answer inline and cannot be streamed.)
  2. It threads the composition run id (this step's parent_workflow_id) down to the runner via the session-launch context, so ai.chat.complete publishes token deltas under the id the browser is streaming — gated on AgentOrgSettings.streaming_enabled.
  3. Principal binding is async-safe: because execute runs on the Kafka consumer, metadata['end_user'] is gone, so _resolve_principal falls back to the engine-stamped end_user_uuid column (+ ancestry walk).

The final answer still returns in the terminal state (the composition maps it to state_data.agent.answer); tokens are the live overlay.

Overview ​

PropertyValue
Workflow typeLinear
LibraryApp-agents
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
organization_uuidstringYes——
questionstringYes——
request_idstringNo——
conversation_uuidstringNo—Work the continuation grant is scoped to; defaults to identity_app_uuid

Output Schema ​

FieldTypeRequiredDefaultDescription
answerstringNo——
session_uuidstringNo——
questionstringNo——
launch_workflow_idstringNo——
wait_phasestringNo——
launch_deadline_epochintegerNo——
answer_deadline_epochintegerNo——
wait_poll_countintegerNo——
request_idstringNo——
conversation_uuidstringNo——
continuation_grant_uuidstringNo——
continuation_issue_workflow_idstringNo——
continuation_redeem_workflow_idstringNo——
continuation_tokenstringNo——
continuation_redeemedbooleanNo——
failure_reasonstringNo——
failed_atstringNo——
failed_at_statestringNo——
failed_stepstringNo——
failed_layerintegerNo——
errorstringNo——
error_typestringNo——
organization_uuidjsonNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
waitingNoNo———
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutewaiting—
waitingpollwaiting—
waitingcompletecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "agents.end-user.ask-stream",
  "initial_data": {
    "organization_uuid": "value",
    "question": "value"
  }
}