Workflow Engine¶
Define multi-agent workflows with sequential, parallel, or conditional execution using YAML.
Quick Start¶
Define a Workflow (YAML)¶
# workflows/expense.yaml
name: expense_reimbursement
description: Process expense reimbursements
type: interactive
triggers:
- "expense"
- "reimbursement"
stages:
- name: collect
run:
- CollectExpenseAgent
- name: validate
run:
- ValidateExpenseAgent
- name: notify
run:
- NotifyAgent
Workflow Types¶
| Type | Description |
|---|---|
interactive |
Triggered by user message |
scheduled |
Triggered by cron expression |
event_triggered |
Triggered by system events |
# Scheduled workflow
name: daily_report
type: scheduled
schedule: "0 9 * * *" # Every day at 9 AM
stages:
- name: generate
run:
- ReportAgent
Execution Patterns¶
Sequential (run)¶
Agents execute one after another:
Parallel¶
Agents execute simultaneously:
Then (Aggregator)¶
Collect results from parallel agents:
Multi-Stage Workflows¶
name: travel_booking
stages:
- name: search
parallel:
- FlightAgent
- HotelAgent
then: CombineAgent
- name: confirm
run:
- ConfirmationAgent
- name: notify
run:
- NotifyAgent
Parameters¶
Template Parameters (Defaults)¶
name: greeting_workflow
parameters:
language: "en"
formal: false
stages:
- name: greet
run:
- GreetingAgent
User Profile Overrides¶
Users can override parameters via their profile:
Conditional Execution¶
stages:
- name: check
run:
- CheckAmountAgent
- name: approve
run:
- AutoApproveAgent
condition: "${check.amount} < 100"
- name: manual_approve
run:
- ManagerApproveAgent
condition: "${check.amount} >= 100"
Variable Resolution¶
stages:
- name: step1
run:
- AgentA
- name: step2
run:
- AgentB
inputs:
data: ${step1.output} # From previous stage
query: ${query} # From workflow inputs
api_key: ${env:API_KEY} # Environment variable
Error Handling¶
stages:
- name: api_call
run:
- APIAgent
retry:
max_attempts: 3
delay: 1.0
on_error: continue # or: stop
Loading Workflows¶
Configure workflow directory in flowagents.yaml:
Workflows are automatically loaded and matched by triggers.
Best Practices¶
- Keep stages focused - One stage = one logical step
- Use parallel for independent operations - Faster execution
- Add error handling - Use retry for unreliable operations
- Use parameters - Make workflows configurable
- Name stages clearly - For readable variable references