Appearance
Workflows
Workflows are the orchestration engine of Red Station. They define how work gets done, chaining together Agents, Tools, and Human interactions into a reliable, repeatable process.
The Concept
A Workflow is a state machine defined in YAML. Unlike a simple script, a workflow handles:
- Context Passing: Passing outputs from one step (e.g., a Plan) as inputs to the next (e.g., the Coder).
- Resilience: Automatic retries and error handling.
- Human-in-the-Loop: Pause execution for human approval.
Structure
A workflow consists of:
- Steps: Atomic units of work.
agent: Run an AI agent.script: Run a shell script.mcp: Call a tool directly.human: Wait for approval.
- Transitions: Logic defining the flow between steps.
- Triggers: Events that start the workflow (Manual, Webhook, Schedule).
Example: Ticket to PR
The default ticket-to-pr workflow demonstrates this power:
- Planner analyzes the ticket and existing code.
- Coder implements the changes based on the plan.
- Human reviews the changes (Hold for approval).
- System opens a Pull Request via GitHub MCP.
CLI Commands
bash
# List available workflows
pilot workflow list
# Show workflow details
pilot workflow show ticket-to-pr
# Run a task using a specific workflow
pilot workflow run ticket-to-pr --task PROJ-123Configuration (YAML)
Workflows are defined in ~/.pilot/workflows/.
yaml
workflow:
id: deploy-flow
name: Deploy and Notify
steps:
- id: build
type: script
command: ./scripts/build.sh
- id: approve
type: human
message: "Build successful. Deploy to prod?"
- id: deploy
type: script
command: ./scripts/deploy.sh
transitions:
- from: build
to: approve
when: build.exit_code == 0
- from: approve
to: deploy
when: approved == trueSee Workflow YAML Spec for full details.