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.
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 }For interoperability the loader also accepts the common “node with a data
object” layout ({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.