Expand description
Workflow documents: the portable, serializable description of a workflow.
A document is plain data (JSON or YAML). It is turned into an executable
crate::graph::Graph by crate::graph::Graph::build using a
crate::node::Registry. The format is frozen as version 1; see
docs/workflow-format.md for the stability promise and
schema/workflow-v1.schema.json for the JSON Schema.
version: "1"
name: hello
env:
- { name: API_KEY, type: secret }
graph:
nodes:
- id: start
type: start
variables: [{ variable: name, type: string, required: true }]
- id: greet
type: template-transform
template: "Hello {{ name }}"
variables: [{ variable: name, value_selector: [start, name] }]
- id: end
type: end
outputs: [{ variable: greeting, value_selector: [greet, output] }]
edges:
- { source: start, target: greet }
- { source: greet, target: end }v1 documents are strict: unknown fields are errors (keys starting with
x- are free for tools and ignored). For interoperability the loader also
accepts an import layout, checked leniently: nodes in the “node with a
data object” shape ({id, parentId, data: {type, title, ...}}), camelCase
edge handles (sourceHandle) and documents wrapped in a top-level
workflow key.
Structs§
- EdgeDoc
- A directed edge.
handleselects the branch of the source node (defaultsource). - Graph
Doc - Nodes and edges.
- NodeDoc
- One node. Node-specific settings live in
config. - Node
Policy - Failure handling, retries and timeouts for one node.
- Retry
Policy - Retry policy. Applies to every node kind.
- Variable
Decl - Declaration of an env or conversation variable.
- Workflow
- A complete workflow document.
Enums§
- Document
Error - Error raised while decoding a workflow document.
- Error
Strategy - What happens when a node fails after exhausting retries.
Constants§
- COMMON_
NODE_ FIELDS - Fields every node has, whatever its type.
- FORMAT_
VERSION - The document format version this build reads and writes.
- RESERVED_
NODE_ FIELDS - Node fields reserved for future versions; node configs may not use them.
Functions§
- is_
extension_ key - Whether
keyis an extension key (x-...), free for tools and ignored.