Workflow Design Patterns¶
Choose the execution graph from the business process: which tasks must run in order, which inputs select a branch, and where a person must review an action. Reuse workers and tools at defined steps.
Sequential processing¶
A workflow defines the sequence of tasks and the conditions that select each path. Give each node an explicit responsibility, such as classifying a request, retrieving a record, evaluating policy, or requesting approval.
Use this pattern for repeatable processes where dependencies, governance, and execution order matter. For example, a quote-processing workflow can extract supplier details, validate them, prepare a requisition, and request approval in a defined order.
A workflow can contain LLM and Agent nodes. Its orchestration is explicit, while model-generated text and interpretations can still vary. Define structured outputs and validate them before using them in business operations.
See Workflow Agents for creation and testing.
Classify and branch¶
Use an LLM node to classify a request when the route depends on natural language. Define the supported intent values in its output contract, validate the returned value, then use a Switch or If Condition node to select the next step.
Keep a path for missing inputs and unsupported requests. Inspect both the classifier output and the decision node's input when a request takes the wrong branch.
Tool-backed agent steps¶
An Agent node can use several tools for a cohesive task, such as answering benefits questions by combining policy information and enrollment data. Configure one set of instructions, the tools it can call, and the fields it must return.
Add human review where required. Some resource tools offer Require Human Approval; workflows also provide a Human Approval node for an explicit approval step. Place the review before the business operation that needs authorization.
Reusable agents¶
Agents separate related expertise into focused, reusable units. For a benefits workflow, the responsibilities might be:
| Worker | Responsibility |
|---|---|
| Policy information | Explain available medical, dental, and vision coverage |
| Personal enrollment | Retrieve the employee's enrollment and explain relevant options |
| Eligibility and assistance | Answer eligibility questions and investigate coverage issues |
Call each reusable agent through an Agent node at a defined point in the graph. Map the required input context, validate its output, and pass only the fields needed by downstream steps. Use branches to call the agents required for the selected intent.
Validation and approvals¶
Keep validation, mandatory approvals, and business updates at explicit points in the graph.
flowchart TD
A[Receive request] --> B[Validate required context]
B --> C[Run the configured worker step]
C --> D[Check returned data]
D --> E{Approval required?}
E -->|Yes| F[Human Approval]
E -->|No| G[Continue process]
F --> G
G --> H[Return response]
This illustrates the successful path. Configure missing-input, error, rejected-approval, and timeout handling for the actual process.
Decision guide¶
| Requirement | Starting pattern | Design focus |
|---|---|---|
| Tasks must run in a specified order | Sequential nodes | Explicit dependencies and error handling |
| The request determines which task is needed | Classify, validate, then branch | Supported intents and an unsupported-request path |
| One task needs several data sources or operations | Agent node with tools | Parameters, tool dependencies, and approval requirements |
| Several related skills should be reused independently | Reusable Agent nodes | Narrow input and output contracts |
| Independent operations can run together | Parallel branches | Branch results and downstream mappings |
| An action needs human review | Tool approval or Human Approval node | Review message, available actions, and outcome handling |
Deterministic and model-driven behavior¶
Use business object operations, Code nodes, conditions, and published policy functions for defined lookups, transformations, and rule evaluation. Use LLMs for interpreting language, extracting information, summarizing, or generating a response.
A Policy node evaluates a published policy function. This provides a repeatable rule decision at runtime; generated policy functions still need review and test cases before publication.
Reduce unnecessary model calls by separating data access and fixed logic from language tasks. Give an LLM only the context needed for its task, and avoid passing complete documents when relevant excerpts or extracted fields are enough.
See Workflow Implementation Patterns for pagination, reusable components, policy decisions, and approval routing.