@uipath/maestro-builder-sdk
v6.127.0
Published
Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.
Maintainers
Readme
Maestro Builder SDK
Build a UiPath Maestro Flow, Case Plan, or BPMN by writing a small, readable TypeScript program.
You describe the orchestration's shape by calling methods (.step, .branch, .loop); the SDK compiles it to a valid .flow/caseplan.json/.bpmn that UiPath can run and open in the designer.
This is a builder, not a program - nothing executes at author time except graph construction.
Data flows through named variables and expressions — you never write native if/for.
Quick start
Install the SDK globally:
npm install -g @uipath/maestro-builder-sdkA global install is enough: the workspace needs no package.json or
node_modules. When the SDK loads an authored file, every
import … from '@uipath/maestro-builder-sdk' (and /case, /bpmn) resolves
to the copy that is running, wherever it is installed. A project-local install
(npm install --save-dev) still works, for a project that pins a version.
Author
A whole flow is one file. HelloWorld.flow.ts:
import { flow, script, out, types } from '@uipath/maestro-builder-sdk';
export default flow('hello-world')
.name('HelloWorld')
.input({ name: types.string })
.output({ greeting: types.string })
.step('greet', script({
code: "return 'Hello, ' + $vars.start.output.name + '!';",
}))
.return({ greeting: out('greet') })
.build();.input and .output are the flow's contract. .step adds a node — here a
script, whose code runs on the platform, not at author time. Steps read each
other through named variables: $vars.start.output.name inside the script,
out('greet') in the builder. There is no .trigger() call, so the flow gets a
manual trigger.
Check
uip maestro flow check HelloWorld.flow.ts --source✓ no issuescheck reads the source without emitting anything. It is the fast pass: an
undeclared variable, a step name that does not exist, an empty branch arm.
Compile
uip maestro flow compile HelloWorldcompile: wrote HelloWorld.flow (3 nodes, 2 edges)Three nodes: the trigger, the script, and the End that .return() created. That
.flow is what UiPath runs and what the designer opens.
For a flow that calls nothing outside itself, that is the whole loop — author → check → compile.
Prepare
The moment a step calls a connector, a fourth verb appears. Add one:
import { flow, script, connector, lookup, out, types } from '@uipath/maestro-builder-sdk';
const SLACK = { connection: 'slack', folder: 'shared' } as const;
const SLACK_DM = ['uipath-salesforce-slack', 'send-message-to-user'] as const;
export default flow('hello-world')
.name('HelloWorld')
.input({ name: types.string })
.output({ greeting: types.string })
.step('greet', script({
code: "return 'Hello, ' + $vars.start.output.name + '!';",
}))
.step('announce', connector(...SLACK_DM, {
channel: lookup(...SLACK_DM, 'channel').by('profile.email', '[email protected]'),
send_as: lookup(...SLACK_DM, 'send_as').by('name', 'bot'),
messageToSend: out('greet'),
}, SLACK))
.return({ greeting: out('greet') })
.build();Two things there are deliberately not ids. channel and send_as are lookup
fields: their real values are opaque ids belonging to one connection, so you
write what you mean — an email address, the word bot — and lookup() records
the question. Now check has something to say:
✗ [LOOKUP_UNRESOLVED] connector uipath.connector.uipath-salesforce-slack.send-message-to-user:
inputs `channel` (profile.email="[email protected]"), `send_as` (name="bot") are unresolved
lookups. Compile does not make network calls, so the values have to be resolved first:
npx flow-sdk registry prepare uipath-salesforce-slack --action send-message-to-user \
--resolve channel:[email protected] \
--resolve send_as:name=botAn error: compile refuses the step, because resolving a lookup means asking the
tenant and compile makes no network calls, and check reports every refusal
compile would raise. That is what prepare is for: it is the one verb that
does talk to the tenant. Run what check named, both fields at once:
uip maestro registry pull # once per machine: the connector library
npx flow-sdk registry prepare uipath-salesforce-slack --action send-message-to-user \
--resolve channel:[email protected] \
--resolve send_as:name=botregistry pull is the prerequisite, not part of the loop: check and compile
read connector field schemas from that library, and without it a connector step
reports its lookups as unresolved no matter how many times you prepare.
It does three things, all of them on disk:
- finds the connection and writes its ids into
.flow-sdk/bindings.json, so the symbolicslackandsharednames in the code resolve; - records each answered lookup in
.flow-sdk/connectors-local/, so compiling stays offline and repeatable; - writes the connection-resolved field schema for that operation, which is how a field the static library does not know about becomes compilable at all.
Then the same two commands as before:
uip maestro flow check HelloWorld.flow.ts --source # ✓ no issues
uip maestro flow compile HelloWorld # wrote HelloWorld.flow (4 nodes, 3 edges)Author → check → prepare → check → compile. check before prepare is the
cheap order: one pass names every resolution the flow owes, so you make one trip
to the tenant instead of one per field.
Case plans and BPMN
The same builder core, the same four verbs. Import from
@uipath/maestro-builder-sdk/case or @uipath/maestro-builder-sdk/bpmn, name the file
<Name>.case.ts or <Name>.bpmn.ts, and swap the family in the command:
uip maestro case compile / uip maestro bpmn compile. Their builder surfaces are in the same
generated indexes as Flow's — api-index.md by symbol name, api-members.md by
field or method name — which cover all three entry points.
BPMN also gets dist/bpmn-api.md: every builder method and option field, one line each, with its type and one-line doc.
uip maestro bpmn check --source type-checks the .bpmn.ts before running it, so a misspelled option or a value of the wrong type is a TS<code> error at file:line:col rather than a crash; --no-types skips that pass.
The package is ESM.
Every entry also answers CommonJS resolution, so require.resolve of a subpath such as @uipath/maestro-builder-sdk/bpmn finds the file on disk, and on Node 22.12 or later require() loads it too.
The one exception is @uipath/maestro-builder-sdk/cli, which uses top-level await: it resolves, but only import loads it.
Bundling the SDK into CommonJS is not supported: its ESM reads import.meta.url, which a CommonJS bundle leaves undefined.
Commands
The UiPath CLI is the authoring front door. Beyond the two verbs the quick start uses:
uip maestro flow validate HelloWorld.flow # the product validator
uip maestro flow debug HelloWorld.flow # run ituip maestro flow check --source runs the authored-source checks without
emitting. Run it before compile: compile only serializes. For example, an
undeclared $vars reference (a mistyped variable or step name in a js`…`
expression) is check's EXPR_UNDECLARED_REF, and compile writes the read as
authored, so a .flow that already has one still decompiles and compiles. An
expression that is not valid JavaScript is EXPR_SYNTAX: compile refuses it
with a FlowBuildError, and check reports it too.
flow build runs the two in that order: check first, then compile only
when check found no error. It takes the options of both, including check's
--baseline <original.flow> (or --baseline-from, as merge spells it), and
exits with their codes. build compiles and does not merge, so with
--baseline it needs -o, and refuses an -o that is the original: write the
edit back into the original with flow merge. For instance npx flow-sdk flow build Hello -o
Hello.flow prints check's findings and then compile: wrote Hello.flow, or
stops after check with build: check found 1 error(s); not compiling.
compile itself still does not check. For a COMPILED .flow, uip maestro flow validate is the authoritative
product validator, and uip maestro flow debug (or flow-debug) runs it. Case and BPMN use the same family-first shape:
uip maestro case compile|check|decompile and
uip maestro bpmn compile|check|format.
These commands require a prerelease of @uipath/cli that exposes the preview
authoring verbs.
UiPath CLI delegation contract
The UiPath CLI resolves @uipath/maestro-builder-sdk/package.json from the caller's current
directory, checks the installed version, and spawns
node <package>/dist/cli/index.js <family> <verb> … with inherited cwd and
environment. It captures stdout and wraps it in its own { Result, Code, Data }
envelope, and streams stderr through. It never imports or bundles the SDK. This preserves the runtime class
identity shared by the authored TypeScript and serializer.
Machine-readable results. Every verb takes --json: stdout then carries exactly
one JSON object, ok (the exit code was 0) plus that verb's fields, and the human
lines move to stderr. For instance:
$ npx flow-sdk flow compile Hello -o Hello.flow --json
{"ok":true,"path":"/work/Hello.flow","nodes":3,"edges":2,"sidecars":[],"errors":0,"warnings":0,"diagnostics":[]}check reports errors, warnings and diagnostics; compile, decompile
and merge report the path they wrote. A verb whose plain output is the
result itself (registry search, registry path, bpmn check --graph) prints it
only as that object under --json, never a second copy on stderr. package.json lists the optional
surface a caller may probe for in cliCapabilities (json-result; fetch-definitions when a
connector definition no library carries is fetched through uip, so no library has to be pulled;
flow-build when the SDK has flow build; search-activity-type-id when registry search takes
--activity-type-id).
flow-sdk capabilities prints that list with the installed version (--json for one
object), and flowSdk.minVersion in a project's package.json makes the flow, case
and bpmn verbs refuse an older SDK (website/reference/CLI-LOOP.md).
The stable argv grammar is family first: flow|case|bpmn, then the SDK verb and
its documented options. The process exit contract is 0 for success, 1 for
diagnostics, and 2 for usage errors or a blocked mode. Changes to the spawn path,
argv grammar, or exit meanings are semver-governed. The package also declares the
@uipath/maestro-builder-sdk/cli export for tooling that needs to verify this surface; normal
authors should invoke it through uip maestro.
What you can express
Every node type the platform runs has a builder form. Control flow and data:
core.trigger.manual · core.trigger.scheduled · core.logic.decision
(.branch) · core.logic.switch · core.logic.merge (.parallel) ·
core.logic.loop · core.logic.terminate · core.control.end (.return) ·
core.subflow · core.logic.delay · core.logic.mock
Work:
core.action.script · core.action.transform (+ .map / .filter /
.group-by) · core.action.http and core.action.http.v2 ·
core.action.queue.create and .create-and-wait ·
uipath.connector.<key>.<action> · uipath.connector.trigger.<key>.<event> and
uipath.connector.event.<key>.<event> · uipath.human-in-the-loop (+
.quick-form, .coded-action-app) · uipath.core.rpa-workflow.<key> ·
uipath.core.api-workflow.<key> · uipath.core.agentic-process.<key> ·
uipath.core.agent.<key> · uipath.agent.autonomous ·
uipath.pattern.deep-rag (summarize) · uipath.pattern.batch-transform ·
uipath.ixp.* (ixpExtract)
An error port (.onError, whose handler can rejoin the success path with
h.stepToRef('step')), per-arm labels, and switch arms with their own terminal
outputs are constructs rather than node types.
Anything that names a tenant resource — a release key, a published extraction
model, a queue consumer, a connector connection — needs that id or a lookup()
resolved through prepare, as in the quick start. The authoring guides carry a
worked example per node type.
The API in two parts
- Control flow & lifecycle are fluent methods on the builder:
.name·.version·.input·.output·.var·.trigger·.step·.branch·.switch·.parallel·.loop·.onError(whose handler can end by rejoining the success path —h.stepToRef('step')) ·.terminate·.return·.build. Inside a.branch/.switcharm,.label('…')names that arm — the label round-trips to and from the.flow(trueLabel/falseLabelon a decision, the caselabelon a switch). - Actions are factory functions passed to
.step(name, action):http·script·transform·hitl·delay·queueItem·connector·waitForEvent·rpaWorkflow·apiWorkflow·agenticProcess·agent·inlineAgent·subflow·summarize·batchTransform·ixpExtract·mock. - Expressions:
lit·v/input·out·err·ran·js`…`·tmpl`…`·types.{string,number,boolean,object,array,file,any}.
Every node type, its builder API, ports, and a minimal example are in the Flow
authoring guide, SKILL.md — its router table is the complete reference. See
The authoring guides.
Signature reference
Exact signatures travel with the package, as TSDoc on the declarations in
dist/: parameters, defaults, remarks and worked examples for every exported
symbol, surfaced by an editor on hover. The authoring guides carry the same
reference as Markdown.
Where authoring files go
Authoring writes files that Studio Web never reads. By default they all go in
one hidden folder, .flow-sdk/, in the directory you run the command from:
| File | Written by |
| --- | --- |
| .flow-sdk/<Name>.flow.ts | decompile without -o |
| .flow-sdk/<Name>.pipeline.mjs, <Name>.baseline.flow / .edited.flow / .merged.flow | decompile (the brownfield helper and the candidates it writes) |
| .flow-sdk/bindings.json | registry prepare (read by check and compile) |
| .flow-sdk/connectors/ | registry pull |
| .flow-sdk/connectors-local/ | registry prepare (read by check and compile) |
The product files are written where compile -o points, as before: the
.flow, plus bindings_v2.json and an inline agent's folder beside it.
The reason is packaging. uip solution pack copies every root-level file of a
Flow project into the package, but no subfolder other than content/. So a
project authored in place used to ship its .flow.ts, bindings.json and
connector modules. Under .flow-sdk/ they stay out.
For example, authoring inside a project folder:
MySolution/MyFlow/
├── MyFlow.flow ← compile -o MyFlow.flow (shipped)
├── project.uiproj, operate.json, bindings_v2.json (shipped)
└── .flow-sdk/ (not packed)
├── MyFlow.flow.ts, MyFlow.pipeline.mjs
├── bindings.json
└── connectors/, connectors-local/A source kept in .flow-sdk/ imports its connectors as ./connectors/<key>.ts,
the same relative path as before. An explicit flag (-o, --bindings,
--connectors, --connectors-local, --out) still wins. A workspace that
already has a root-level bindings.json, connectors/ or connectors-local/
keeps using it, so nothing moves under an existing project.
Integration Service connectors
A flow that calls a connector needs a bindings.json mapping the
symbolic connection / folder names in the code — slack and shared in the
quick start — to real ids. registry prepare writes it to .flow-sdk/bindings.json
(see Where authoring files go); this is the shape, if
you would rather fill it from
uip is connections list --all-folders --output json:
{
"schemaVersion": "1",
"bindings": [
{ "id": "slack", "name": "slack", "resource": "Connection",
"resourceKey": "<connection-id>", "propertyAttribute": "ConnectionId" },
{ "id": "shared", "name": "shared", "resource": "Connection",
"resourceKey": "<folder-key>", "propertyAttribute": "FolderKey" }
]
}Keeping the names symbolic is what lets one flow move between connections: the
code says slack, and only bindings.json knows which Slack.
Discover ops and input shapes from the connector library that
uip maestro registry pull downloads and caches. A field the library does not
carry is connection-specific — that is the prepare case from the quick start.
The package also exposes the low-level materializer used by the UiPath CLI to derive the Markdown catalog and typed descriptors from canonical JSON:
flow-registry-materialize \
--library-json ./library-json \
--library-md ./library-md \
--connectors ./connectorsMost callers want uip maestro registry pull, which downloads the published
archive, verifies its checksum and then runs this transform. The low-level
command is for SDK development, build pipelines, and troubleshooting: it only
transforms local files that are already on disk.
Connector event triggers and waits (onEvent / waitForEvent) additionally
need a definition pair in the library. Curated pairs are published for
Outlook, HTTP Webhook, and OneDrive; any other connector's pair is
generated on demand from live registry evidence. The authoring guides'
references/event-trigger.md has the commands and the evidence bar.
The authoring guides
This package is the API: dist/ and this README.
The step-by-step authoring guides — SKILL.md for Flow, SKILL-case.md,
SKILL-bpmn.md, and the per-node detail under references/ — ship with the
UiPath authoring skills catalog rather than here, so a coding agent and a human
read the same copy. The worked examples named by those guides travel with them.
The connector library is not bundled: uip maestro registry pull downloads it
and caches it per machine. The package does carry the curated overlay that pull
applies on top. It adds the definitions the downloaded library lacks (connector
start triggers, for example) and never replaces one the library carries, except
for the patches listed in lib/library-json.samples/overlay-corrections.json,
which only add the fields they name. Pull prints one line saying what it added,
corrected and kept.
License
MIT — see LICENSE.
