Class WorkflowStep
One step of a WorkflowDefinition. Type says what it does, and only the fields of that type are read:
agent: runs the agent Agent (at Revision when the host keeps revisions) on Input.tool: calls Tool with Arguments; an answer that reports a failure ({"error": ...}, or"ok": falsefrom an HTTP tool) fails the step.condition: runs the Steps of the first of Branches whose When holds, or Else.parallel: runs each of Branches at once, and joins their outputs (Aggregate).loop: runs Steps again until Until holds, at most MaxIterations times.foreach: runs Steps once for every item of the array Items evaluates to (in batches of BatchSize, at most MaxConcurrency at once), keeps those Filter admits, and answers the array of what each collected (Collect), in Order; OnItemError says what a failed item does.workflow: runs the published workflow Workflow (at Revision, else the revision current when the step first runs, kept for the rest of the run) on Input; its answer is the step's output, its stops are the workflow's.wait: waits DelaySeconds, or until WaitUntil; a long wait holds no worker when the host parks it (ParkRetriesLongerThan).wait_for_event: stops the workflow until the event Event is delivered with the correlation key Correlation renders to, at most TimeoutSeconds; the event's payload is the step's output, and a deadline passed fails the step as atimeout.approval: stops the workflow until a person approves Message.handoff: ends the workflow, handing it to a person with Reason and Summary.
An agent or tool step may set TimeoutSeconds, Retry and
OnError: a deadline per attempt, retries with backoff, and what to do once it has
failed for good.
Text fields (Input, Message, the string values of Arguments, ...)
are templates: {{ ... }} placeholders read the workflow's values (WorkflowExpression).
public sealed class WorkflowStep
- Inheritance
-
WorkflowStep
- Inherited Members
Fields
- AgentType
Type of a step that runs an agent.
- ApprovalType
Type of a step that waits for a person's approval.
- CollectItemErrors
A
foreachstep goes on, the failed item's result an{"error": ...}object.
- CompletionOrder
A
foreachstep's results follow the order the items finished in.
- ConcatAggregate
Aggregate of a parallel step: the branch outputs joined, each under its branch's last step id. The default.
- ConditionType
Type of a step that branches on conditions.
- FailItems
A
foreachstep stops launching items at the first that fails, and fails. The default.
- FirstAggregate
Aggregate of a parallel step: the first branch's output.
- ForeachType
Type of a step that runs its steps once for every item of an array.
- HandoffType
Type of a step that hands the workflow to a person.
- InputOrder
A
foreachstep's results follow the items' order. The default.
- LoopType
Type of a step that repeats its steps.
- MaxForeachItems
The most items a
foreachstep accepts.
- MaxWaitSeconds
The longest a
waitorwait_for_eventstep waits, in seconds (366 days).
- MaxWorkflowDepth
The most workflows one run may nest, itself included.
- ParallelType
Type of a step that runs branches at once.
- SkipItems
A
foreachstep counts a failed item and goes on without its result.
- ToolType
Type of a step that calls a tool.
- WaitForEventType
Type of a step that waits for an external event, matched by its correlation key.
- WaitType
Type of a step that waits a while, or until a moment.
- WorkflowType
Type of a step that runs another published workflow as a child.
Properties
- Agent
Gets or sets, for an agent step, the agent's name.
- Aggregate
Gets or sets, for a parallel step, how the branch outputs are joined:
concat(default) orfirst.
- ApproveWhen
Gets or sets, for an approval step, a condition that approves it without a person when it holds (a confidence above a bar, say); only the cases it does not settle wait for one.
- Arguments
Gets or sets, for a tool step, the call's arguments: a JSON object whose string values are templates.
- BatchSize
Gets or sets, for a
foreachstep, how many items one run of its steps receives (1 to 1000,itemis then their array); null for one.
- Collect
Gets or sets, for a
foreachstep, what each item contributes (a template, run after its steps); empty for its last step's output.
- Compensate
Gets or sets, for an agent or tool step, the agent or tool steps that undo its effect (release a reservation, void a payment) if the workflow fails after it completed. A failing workflow plays the compensations of its completed steps in the reverse order of completion, each once, then ends failed; a compensation that fails is left for an operator. Null for a step that needs none.
- Correlation
Gets or sets, for a wait_for_event step, the correlation key a delivery must carry (a template, such as
{{input.order_id}}).
- DelaySeconds
Gets or sets, for a wait step, how many seconds it waits (1 to 366 days); or set WaitUntil.
- Description
Gets or sets a human description of the step.
- Document
Gets or sets, for an approval step, the document the approver reviews before deciding (a template naming a stored file id or a path), which the host shows beside the decision.
- Else
Gets or sets, for a condition, the steps run when no branch holds.
- Event
Gets or sets, for a wait_for_event step, the name of the event it waits for.
- Filter
Gets or sets, for a
foreachstep, a condition onitem; items for which it does not hold are left out.
- Id
Gets or sets the step's id: unique in the workflow, letters, digits,
_and-. Later steps read its output assteps.<id>.output.
- Input
Gets or sets, for an agent or a workflow step, what it receives (a template); empty for the previous step's output.
- Items
Gets or sets, for a
foreachstep, the expression whose value is the JSON array to run over (input.documents,steps.list.output.rows). Its steps read the item asitem(fields asitem.<field>) and its position, from 1, asloop.iteration.
- KeepResults
Gets or sets, for a
foreachstep, whether it answers every item's result (the default) or only counts:{"total", "succeeded", "failed", "skipped"}.
- MaxConcurrency
Gets or sets, for a
foreachstep, how many items run at once (1 to 32); null for one at a time.
- MaxItems
Gets or sets, for a
foreachstep, the most items it accepts (up to 100000); null for 10000.
- MaxIterations
Gets or sets, for a loop, the most passes it makes (1 to 100).
- Message
Gets or sets, for an approval step, what the approver is asked (a template).
- OnError
Gets or sets, for an agent or tool step, what happens once it has failed for good; null to fail the workflow.
- OnItemError
Gets or sets, for a
foreachstep, what a failed item does:fail(default),skiporcollect.
- Order
Gets or sets, for a
foreachstep, the order of its results:input(default) orcompletion.
- OutputSchema
Gets or sets, for an agent or tool step, the JSON Schema its answer meets, or null. An answer that does not (or is not JSON) fails the attempt as an
error, so the step's retry policy and error steps apply; its fields read assteps.<id>.output.<field>.
- Reason
Gets or sets, for a handoff step, why a person takes over (a template).
- Retry
Gets or sets, for an agent or tool step, how a failed attempt is tried again; null for one attempt.
- Revision
Gets or sets, for an agent or a workflow step, the revision to run; null for the host's current one (a workflow step keeps the one it first ran).
- Steps
Gets or sets the steps a loop repeats.
- Summary
Gets or sets, for a handoff step, the situation for the person taking over (a template).
- TimeoutSeconds
Gets or sets, for an agent or tool step, the most seconds one attempt may take (1 to 86400); an attempt that runs longer is cancelled and fails as a
timeout. Null for no limit.
- Tool
Gets or sets, for a tool step, the tool's name.
- Type
Gets or sets what the step does: one of the
...Typevalues.
- Until
Gets or sets, for a loop, the condition that ends it, read after each pass.
- WaitUntil
Gets or sets, for a wait step, the moment it waits for (a template giving an ISO 8601 instant); or set DelaySeconds.
- Workflow
Gets or sets, for a workflow step, the name of the published workflow it runs.