Agent Run Workflows
The agent analyzes user input and automatically selects tools for execution. Some tools (plan / report / matrix) include Human-in-the-Loop (HITL) checkpoints that require human confirmation before proceeding. This page describes all execution patterns, their event flows, and the API operations needed at each state.Common Flow
All executions start with the same pattern:Tool Selection
The agent analyzes input viachat-routing and automatically selects from these tools:
Pattern 1: Direct Answer
The agent responds with text without using any tools.Pattern 2: search (Web Search)
Pattern 3: browse (Browser Automation)
maxBrowsingSteps parameter to control the step limit.
When browse needs human input
Browse is usually fully automatic, but it can ask a human for help on login pages, cookie prompts, or pages where a decision is needed. This is different from the plan/report/matrix HITL flow./agent/run/{runId}/plan/answer or the other run HITL endpoints for this state. Use the websocketInfo.session_id from the browse-start event and answer through the browser control API.
/browser/answer-question-with-files when the answer needs files.
/browser/spontaneous-input to steer it. Examples: “Open the pricing page next” or “Do not submit that form.”
GET /agent/run/{runId}/status can show browseState.askHumanQuestion, so you can detect that the browser is waiting. The answer still requires sessionId; API clients should store browse-start.payload.websocketInfo.session_id when it appears in the SSE stream.Pattern 4: skill (Sandbox Execution)
Pattern 5: plan (Research Plan) — HITL
Step 1: Check status
Step 2: Confirmation action (choose one)
Answer questions to revise the draft:regenerated_plan event is returned, and the draft is pending review again.
Confirm the plan:
plan_confirmed is returned.
Skip questions and confirm:
Step 3: Resume execution
Pattern 6: report (Report Generation) — HITL
Step 1: Check status
Step 2: Confirmation action
Answer questions:Step 3: Resume → Automatic section generation
Pattern 7: matrix (Matrix Generation) — HITL
Step 1: Check status
Step 2: Confirmation action
Answer questions:Step 3: Resume → Automatic data extraction
Compound Pattern: plan → report
A single execution may trigger multiple HITL checkpoints:pendingReportDraft → confirm → resume loop.
Status Quick Reference
Skill secret requests
When a skill needs external API keys or other secrets, the SSE stream emitsskill-ask-secret, and GET /agent/run/{runId}/status exposes the missing keys in skillState.pendingSecretKeys.
/secret.
/agent/run/stream/{runId} again. Keep reading the same SSE stream, or poll GET /agent/run/{runId}/status until pendingSecretKeys is empty.
Answering plan / report / matrix drafts
pendingPlanDraft, pendingReportDraft, and pendingMatrixDraft all mean that a draft is waiting for review. If you want changes, send feedback to /answer and review the regenerated draft. When the draft is acceptable, call /confirm, then resume execution with /agent/run/stream/{runId}.
/answer request body
Plan, Report, and Matrix /answer endpoints use the same body shape.
Example:
/confirm and /skip request body
Confirmation endpoints only need runId.
plan/skip means “confirm the plan without additional feedback.” Report and Matrix do not have skip endpoints.
Basic API Loop
plan, report, and matrix pause the whole agent run, so you resume with /agent/run/stream/{runId} after confirming. A browse question pauses the browser session, so answer with /browser/answer-question and let the same run continue.