Overview
Station’s workflow engine enables you to chain agents together into durable, multi-step automated procedures. Workflows support:- Parallel execution - Run multiple agents concurrently
- Conditional routing - Branch based on agent outputs
- Human approval gates - Block until human approves
- Data transformation - Reshape data between steps
- Loop iteration - Process arrays with concurrency control
Quick Start
1
Create a Workflow File
Create
~/.config/station/environments/default/workflows/my-workflow.workflow.yaml:2
Sync and Run
3
View Results
State Types
Workflows are composed of states. Each state has a type that determines its behavior.Agent
Execute a Station agent by name
Inject
Insert static data into context
Switch
Conditional branching
Transform
Reshape data with Starlark
Parallel
Run branches concurrently
Foreach
Iterate over arrays
Agent State
Execute an AI agent and capture its output.Agent Input Patterns
When passing data to agent steps, use template variables (${var}) for the task/userInput field:
- Recommended: userInput
- Alternative: task field
- Variables for context
Multi-Step Data Flow
Pass data between workflow steps using output mappings and template variables:Switch State
Route execution based on conditions using Starlark expressions.Transform State
Reshape data using Starlark expressions. Usegetattr() for safe access with defaults.
Parallel State
Execute multiple branches concurrently and wait for all to complete.Foreach State
Iterate over an array with optional concurrency.Human Approval State
Block workflow until a human approves or rejects.Complete Example
Here’s a full incident RCA workflow that demonstrates parallel execution, conditional routing, and human approval:MCP Integration
Workflows are available through Station’s MCP server. When authoring workflows via MCP tools, always read the DSL reference first:Available Tools
Best Practices
Always use hasattr() in switch conditions
Always use hasattr() in switch conditions
Agent outputs may not include all expected fields. Always check existence:
Set timeouts on agent steps
Set timeouts on agent steps
Prevent workflows from hanging indefinitely:
Use descriptive state IDs
Use descriptive state IDs
Makes debugging much easier:
Always have a defaultNext in switch
Always have a defaultNext in switch
Handle unexpected values gracefully:
Troubleshooting
attrdict has no .field field or method
attrdict has no .field field or method
The agent didn’t output the expected field. Use
hasattr():Workflow stuck in pending
Workflow stuck in pending
Check NATS is running and workflow consumer started:
Transform expression failed
Transform expression failed
Check Starlark syntax:
- Use
=for assignment,==for comparison - Strings need quotes:
"value"notvalue - Dict syntax:
{"key": value}
REST API Reference
Station exposes a REST API for programmatic workflow management.Workflow Definitions
Create Workflow Request:
Workflow Runs
Start Run Request:
Approvals
Approve Request:
Set
X-Approver-ID header to identify the approver. Defaults to api-user if not provided.
