Workflows
Sometimes you want more structure than “let the main agent decide what to do next.” Maybe you want a repeatable pipeline where a planner writes a design first, two implementers code and write tests in parallel, and a separate reviewer signs off at the end.
In Hya, that pipeline is called a Workflow: a simple Markdown file (*.hya.md) with a list of steps (Stages) and a small flowchart showing which step runs after which.
Where Hya looks for Workflows
Hya discovers Workflows automatically from three places (top wins when names match):
- Your Project:
<project-root>/.hya/workflows/*.hya.md - Your User folder:
~/.config/hya/workflows/*.hya.md - Installed & built-in Bundles: such as the built-in
plan-impl-reviewworkflow shipped inhya/workflowor any.hyabundleyou install.
Official bundle (
hya/workflow): Installhya/workflowwithhya bundle install hya/workflow -yor install the officialdefaultprofile. Workflow discovery, DAG execution, durable event replay, theworkflowtool, the v2 Bundle API endpoints (GET /v2/bundles/hya%2Fworkflow/api/workflows,GET /v2/sessions/{id}/bundles/hya%2Fworkflow/state,POST /v2/sessions/{id}/bundles/hya%2Fworkflow/command), thehya workflowcommand, and the TUI/workflowcommand are provided by the official ABI v2 native bundlehya/workflow. In--baremode or whenhya/workflowis disabled underbundles.builtin.disableinconfig.toml, none of these exist (hya workflowis an unknown command, exit2); core sessions are unaffected.
What a Workflow file looks like
Here is a complete Workflow you can drop into .hya/workflows/ship-fix.hya.md:
---kind: Workflowname: ship-fixdescription: Plan a bug fix, implement it, and review the diff.inputs: bug: Short description of the bug to fix.nodes: plan: title: Investigate & plan agent: hya-scout directive: Investigate {{input.bug}} and write a concrete fix plan. implement: title: Apply fix & tests agent: hya-task directive: Implement the plan from upstream and run the relevant tests. review: title: Review patch agent: hya-reviewer directive: Review the changes against {{input.bug}} and check for regressions.---flowchart TD plan --> implement implement --> reviewWhen plan finishes, Hya automatically passes its output forward into implement, and then passes implement’s output into review. Steps linked with & (like plan --> code & tests) run in parallel!
Running Workflows in the TUI (/workflow)
Inside hya, use /workflow (or /workflows to browse):
/workflow list/workflow info ship-fix/workflow select ship-fix/workflow run bug="Login button stays disabled after password reset"/workflow stateWhile a Workflow is running, your session tracks each Stage’s progress live, and you can inspect every Stage’s helper session in /subagents or /sessions. Press Esc anytime if you need to cancel the run cleanly.
Running Workflows from the terminal (hya workflow)
You can list, inspect, and trigger Workflows straight from the command line or CI scripts:
# List every Workflow available in the current folderhya workflow list
# Inspect a Workflow's stages and required inputshya workflow info ship-fix
# Run a Workflow in a fresh session (add --db ./hya.db to save the run on disk)hya workflow run ship-fix --input bug="Login button stays disabled"Add --json to hya workflow run if you want structured JSON results for a script. hya workflow list and info only read the database (they never lock it), so they work while the backend daemon or another hya holds it; use, run, and state go through the daemon when one owns --db. See CLI reference: hya workflow.
Try the full Argus example
The official registry publishes Argus, a multi-stage example that demonstrates parallel investigation, implementation, dual architecture/quality review, and verification:
hya bundle install hya/argus-example -yhya bundle info hya/argus-examplehya workflow run argus --input request="Add retry backoff to the webhook client"Want to write advanced Workflows with loop verifiers, per-stage model & reasoning overrides, or package them into .hyabundle files? Head over to Authoring Workflows.