Workflow Steps
Workflows are built from four step types. Each step receives the current state and can update it for the next step.Step Types Overview
| Step | Purpose |
|---|---|
AgentStep | Run an agent; optionally map state to input via inputFrom. |
FunctionStep | Custom logic; run(state, ctx) returns partial state update. |
ConditionStep | Branch: if condition(state) then run nested steps. |
ParallelStep | Run multiple steps concurrently; merge results. |
AgentStep
Runs an agent. UseinputFrom to derive the agent’s input from state.
Step identifier. Used in stepResults and logs.
The agent to run.
Maps state to the agent’s input string. If omitted, the full state is JSON-stringified. Agent output is stored as
state[stepName + “_output”].Example
FunctionStep
Runs custom logic. Return a partial state object to merge into the workflow state.Step identifier.
Async function. Receives current state and RunContext. Return partial state to merge.
Example
ConditionStep
Branches based on a condition. Runs nested steps only whencondition(state) is true.
Step identifier.
Predicate. If true, nested steps run; otherwise they are skipped.
Nested steps to run when condition is true.
Example
ParallelStep
Runs multiple steps concurrently. Results are merged into state.Step identifier.
Steps to run in parallel. All must complete before the workflow continues.