Skip to main content
A workflow file contains declarations. The executor validates the declarations, builds a dependency graph, runs the graph, and returns the output block as JSON.

Common declaration order

A readable workflow usually uses this order:
  1. input
  2. secrets
  3. provider
  4. model
  5. schema
  6. mcp and imports
  7. dynamic
  8. agent
  9. output
The order is for readability. Dependencies are determined by references.

Small workflow

input {
    topic: string
}

secrets {
    api_key: string
}

provider llm from openai {
    endpoint: "https://api.openai.com/v1"
    api_key: secrets.api_key
}

model fast from llm {
    id: "gpt-4.1-mini"
}

agent summarize {
    model: model.fast
    instruction: "Summarize {{ input.topic }} in one paragraph."

    output {
        summary: string
    }
}

output {
    summary: agent.summarize.summary
}

Final output

The final output block is an object expression. It determines the JSON shape returned by /execute.
output {
    summary: agent.summarize.summary
    raw: agent.summarize
}