Skip to content
CLI
YAML Format

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: end

Using !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.md

Include schemas

nodes:
  step1:
    type: agent
    inputSchema: !include ./schemas/input.yaml
    outputSchema: !include ./schemas/output.yaml

Include entire nodes

nodes:
  trigger: !include ./nodes/trigger.yaml
  step1: !include ./nodes/extract-data.yaml
  step2: !include ./nodes/validate.yaml

Include nested properties

nodes:
  step1:
    inputSchema:
      type: object
      properties: !include ./schemas/common-properties.yaml

Include 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_step

File 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.yaml

Supported 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: step1

The 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

  1. Read the YAML file.
  2. Process all !include directives recursively.
  3. Convert to a workflow definition.
  4. Create a new workflow via the API.
  5. Write the assigned workflowId back into the YAML file.
  6. Commit the updated YAML file to version control.

Subsequent deployments

  1. Read the YAML file (now containing workflowId).
  2. Process all !include directives.
  3. Convert to a workflow definition.
  4. Update the existing workflow via the API.