Skip to main content

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:
JSONPath ($.path) does NOT work in input.task or input.userInput fields - only template variables (${var}) are resolved. JSONPath works correctly in:
  • output mappings
  • input.variables
  • dataPath in switch states
Workaround: Always use template variables like ${my_var} instead of $.my_var for task/userInput fields.

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.
Always use hasattr() for safe field access. Agent outputs may not include all expected fields.
Built-in Functions:

Transform State

Reshape data using Starlark expressions. Use getattr() 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:
This resource contains the complete DSL specification, all state types, and Starlark expression reference.

Available Tools

Best Practices

Agent outputs may not include all expected fields. Always check existence:
Prevent workflows from hanging indefinitely:
Makes debugging much easier:
Handle unexpected values gracefully:

Troubleshooting

The agent didn’t output the expected field. Use hasattr():
Check NATS is running and workflow consumer started:
Check Starlark syntax:
  • Use = for assignment, == for comparison
  • Strings need quotes: "value" not value
  • 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:
Reject Request:
Set X-Approver-ID header to identify the approver. Defaults to api-user if not provided.