Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Uipath maestro flow/Hitl
Reference · Uipath maestro flow

Hitl

Part of Uipath maestro flow. Install the skill and your agent reads this page when it needs the depth.

Human-in-the-Loop

Exact signatures, fields, and defaults: hitl().

Pause a Flow for a person with the default inline form, quick-form node, deployed Action App, or document-validation station.

Signature: hitl({ variant?: 'quick-form' | 'action-app' | 'document-validation', app?, document?, title?, priority?, labels?, recipient?, fields?, outcomes, outcomePorts?, exposeError?, legacyCompleted? }).

.var('status', types.string)
.stepSwitch('review', hitl({ title: 'Review invoice',
  fields: [{ id: 'comment', type: 'text', direction: 'output' }],
  outcomes: ['Approve', 'Reject'] }), [
  { value: 'Approve', body: (b) => b.step('pay', script({ … }), { updates: { status: lit('approved') } }) },
  { value: 'Reject', body: (b) => b.step('notify', script({ … }), { updates: { status: lit('rejected') } }) },
])
.return({ status: v('status') })

Each outcome exits as outcome-<slug>; a task with outcomes never emits completed. On the default node, multiple outcomes route automatically. .stepSwitch provides one arm per outcome on the default node, quick-form, or pinned task; do not combine it with outcomePorts: false (STEP_SWITCH_NO_EXITS); drop the flag, or keep it and route on out('<step>', 'Action'), sending every outcome value somewhere: an unhandled Reject continues down the main path. Arms behave like .switch() arms: terminal .return() arms end, others CONVERGE, so later steps fan in. That is what makes the single .return() above correct, and what a flow VARIABLE is for: each arm assigns it with { updates } and the one return reads it. Wire every outcome. A missing arm compiles to an End that leaves outputs unset (STEP_SWITCH_EXIT_UNROUTED); an unhandled .stepToList outcome stalls the run when picked (HITL_OUTCOME_UNROUTED); action: 'End' ends it instead but still needs an edge.

At a glance

Use .stepSwitch for per-outcome routing. Use .step() followed by .switch() on out('<step>', 'Action') when the decision is deliberately data (recorded in an output, compared in one place); ask for it with quick-form or outcomePorts: false on the default node. Every outcome continuing to one step with nothing reading Action is the unreachable-outcomes case, not a third shape. A plain .step() continues the FIRST outcome on a default task that routes per outcome, and the others need routes; otherwise it continues EVERY outcome on separate edges. The latter applies only with outcomePorts: false, variant: 'quick-form', { version: '1.0' }, one outcome, or all outcomes having action: 'End'. Quick-form defaults to it; outcomePorts: true or .stepSwitch enables per-outcome routing while version remains 1.0. A default multi-outcome task otherwise uses definition 1.1. An explicit { version: '1.0' } pin wins, keeping decompile → compile exact on a deployed flow; outcomePorts: true still routes per outcome on 1.0.

When .step() continues every outcome, an action: 'End' outcome goes to its own End (or joins the .return() when that is the next step); the runtime never reads action, so only the graph ends the run. If every outcome is action: 'End', nothing may follow except .return() (HITL_UNREACHABLE_AFTER). Do not route the FIRST outcome with .stepToList; its port is already the main path (flow-builder-sdk#741). On a task that does not route per outcome, .stepToList('outcome-…') is refused (HITL_OUTCOME_PORTS_OFF); use outcomePorts: true or .stepSwitch, never with outcomePorts: false.

Delivery, fields, and routing

Each outcome gets outcome-<slug> (lowercase; non-alphanumerics become -) on the default node and quick-form at every definition version. The designer derives handles from inputs.schema.outcomes and shows manifest completed only when none exist (flow-workbench, getEffectiveHitlHandleCustomization). A completed edge on a task with outcomes is stale and is remapped to the PRIMARY outcome by Studio Web and the converter, losing other paths; check refuses it (HITL_COMPLETED_PORT_GONE). The only exception is existing legacyCompleted: true: decompile writes it when the task already leaves on completed, no-edit round trips preserve it, and check warns HITL_LEGACY_COMPLETED; never add it. If the task asks you to fix that task's routing, replace it with outcomePorts: false or explicit outcome routes. A decompiled outcome may be { name: 'Reject', id: 'outcome-1778015958049' }; preserve it, route its port as outcome-outcome-1778015958049 with .stepToList, and use the name for .stepSwitch. New outcomes need no id. exposeError: true additionally exposes out('<step>', 'error') and selects definition 1.2 (default node only).

Wire every outcome:

Shape Behavior
.stepSwitch(name, hitl({…}), arms) One arm per outcome, value naming it; no tacit exit; arms converge; missing arms warn STEP_SWITCH_EXIT_UNROUTED.
.step() + .stepToList('outcome-<slug>', …) on a per-outcome task FIRST outcome is the main path; other arms do not converge and each gets its own End, mapping every output from its variable (NO_RETURN warns if an arm leaves one unset).
.step() on a non-per-outcome task Every outcome continues to the next step on its own edge; route later with out('<step>', 'Action').

A default multi-outcome task routes per outcome unless one of the five conditions in ## At a glance applies. In .parallel(), the task must not be the arm's last step and no outcome may be action: 'End'; only one outcome fires, so the join would wait forever. check refuses these as HITL_FAN_OUT_INTO_JOIN (last step) and HITL_END_OUTCOME_IN_PARALLEL (End outcome). Add a step after it inside the arm so all outcomes reach that step, including after .stepSwitch; do not end an arm with .return(), and put .return() after .parallel(). An empty switch arm plus another arm ending in a step is also refused as HITL_FAN_OUT_INTO_JOIN; a missing switch arm, or one ending in .return(), is refused as HITL_END_OUTCOME_IN_PARALLEL; give every outcome an arm.

Action-app and document-validation outcomes live in the app; completed is their only designer handle and .step() leaves on it. Route downstream with out('<step>', 'Action'). An approve/reject task whose outcomes all lead to one place still compiles and flow validate answers Valid, so the mistake surfaces only at runtime; check warns HITL_OUTCOMES_UNREACHABLE when all outcomes continue to one step and nothing reads Action; warnings do not replace routing. flow validate accepts a declared outcome-<id> edge on every version and refuses undeclared handles with Edge references undeclared source handle "outcome-nope". On a 1.1/1.2 node with outcomes, flow validate refuses completed, but not on 1.0 or quick-form; use check and the SDK rules.

variant: 'document-validation' takes document: { extractionResult, storageBucket?, documentId?, render?, taxonomy? }, no fields; bind extractionResult to the upstream extract step's ExtractionResult. render: 'custom' requires taxonomy and takes app.

Action App inputs and answers

For variant: 'action-app', pass the app schema as app.actionSchema, beside name, key, folderPath, and inputs (keys matching the schema's inputs), using either spelling unchanged:

If neither file exists, ask the user for the schema; never write one by hand. Without a schema, every app.inputs value reaches the app as a string, and check warns HITL_APP_NO_SCHEMA. check errors on undeclared inputs (HITL_APP_INPUT_UNKNOWN), unbound required inputs (HITL_APP_INPUT_REQUIRED), unknown outcomes (HITL_APP_OUTCOME_UNKNOWN), or invalid schema (HITL_APP_SCHEMA_INVALID). Schema outputs and inOuts are typed answer fields readable via out('<step>', '<field>'); without the schema, such reads fail HITL_READ_UNKNOWN_FIELD. Nested object properties are not checked.

Decompile preserves the schema: it prints app.actionSchema when it compiles exactly to the node's inputSchema; otherwise, including hand-edited titles, it prints the node schema as app.inputSchema. Preserve that form and provide actionSchema or inputSchema, not both.

SDK 6.59.1+ is required; older SDKs lack actionSchema on app, so TypeScript rejects it (check that dist/api-index.md lists PlatformActionSchema),

<!--skill-flavor:action-schema-sdk-upgrade:start-->

so upgrade with npm install -g @uipath/maestro-builder-sdk@latest.

<!--skill-flavor:action-schema-sdk-upgrade:end-->

Variant judgment

Use the scenario's explicit variant. Default and quick-form own fields in the Flow; action-app delegates to a deployed app or an app in this solution. For app tasks, resolve key, name, folder, and argument names from the same tenant resource and pass its schema as app.actionSchema (Action App inputs and answers).

A coded Action App in the SAME solution is not yet deployed to a folder. Use location: 'in-solution' and omit folderPath:

.step('review', hitl({
  variant: 'action-app',
  app: { name: '<App>', key: '<APP_RESOURCE_KEY>', location: 'in-solution' },
  outcomes: ['Approve', 'Reject'],
}))

Evidence boundary

Offline execution scripts the selected action and output fields; it proves wiring and downstream routing, not that a real task appeared or a person participated. Live evidence should preserve the Action Center task identity, human-selected outcome, supplied answers, and resumed path.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.