YAML Format
Workflows are authored as YAML files and deployed with hutly workflow deploy. The !include directive lets you split a workflow across multiple files so instructions, schemas, and function code stay readable and reusable.
Basic workflow
name: My Workflow
workflowId: d51ebe98-3da9-4003-805b-b3eba98e4b7e # Auto-added after first deploy
description: Description of my workflow
nodes:
trigger:
name: Trigger
type: trigger
schema:
type: object
properties:
input:
type: string
onSuccess: step1
step1:
name: Process Data
type: agent
instructions: Process the input data...
onSuccess: end
end:
name: End
type: endUsing !include directives
The !include directive can appear anywhere in the YAML to import content from external files.
Include markdown instructions
nodes:
step1:
name: Extract Data
type: agent
instructions: !include ./instructions/extract-data.mdInclude schemas
nodes:
step1:
type: agent
inputSchema: !include ./schemas/input.yaml
outputSchema: !include ./schemas/output.yamlInclude entire nodes
nodes:
trigger: !include ./nodes/trigger.yaml
step1: !include ./nodes/extract-data.yaml
step2: !include ./nodes/validate.yamlInclude nested properties
nodes:
step1:
inputSchema:
type: object
properties: !include ./schemas/common-properties.yamlInclude function code
nodes:
identify_document:
name: Identify Document
type: function
code: !include ./functions/identify-document.js
inputSchema:
type: object
properties: {}
additionalProperties: false
outputSchema: !include ./schemas/identify-output.yaml
onSuccess: next_stepFile organisation example
workflows/
├── form6-workflow.yaml # Main workflow file
├── instructions/
│ ├── extract-property.md
│ ├── validate-data.md
│ └── send-email.md
├── schemas/
│ ├── property-input.yaml
│ ├── property-output.yaml
│ └── common-properties.yaml
├── functions/
│ ├── identify-document.js
│ └── validate-data.js
└── nodes/
├── trigger.yaml
└── extract-property.yamlSupported file types
| Extension | Imported as |
|---|---|
.md, .txt |
String content |
.js |
String content (for function code) |
.yaml, .yml |
Parsed objects/arrays |
.json |
Parsed objects/arrays |
Nested includes
Included files can themselves contain !include directives:
trigger.yaml:
name: Trigger
type: trigger
schema: !include ./schemas/trigger-schema.yaml
onSuccess: step1The CLI resolves all nested includes recursively and detects circular dependencies. Use hutly synthesize to see the fully-resolved YAML, and hutly workflow validate to check a workflow and all its dependencies before deploying.
Deployment flow
First deployment
- Read the YAML file.
- Process all
!includedirectives recursively. - Convert to a workflow definition.
- Create a new workflow via the API.
- Write the assigned
workflowIdback into the YAML file. - Commit the updated YAML file to version control.
Subsequent deployments
- Read the YAML file (now containing
workflowId). - Process all
!includedirectives. - Convert to a workflow definition.
- Update the existing workflow via the API.