Skip to main content

Module dsl

Module dsl 

Source
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. handle selects the branch of the source node (default source).
GraphDoc
Nodes and edges.
NodeDoc
One node. Node-specific settings live in config.
NodePolicy
Failure handling, retries and timeouts for one node.
RetryPolicy
Retry policy. Applies to every node kind.
VariableDecl
Declaration of an env or conversation variable.
Workflow
A complete workflow document.

Enums§

DocumentError
Error raised while decoding a workflow document.
ErrorStrategy
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 key is an extension key (x-...), free for tools and ignored.