Condukt.Workflows (Condukt v1.4.1)

Copy Markdown View Source

Public facade for Condukt workflows.

A workflow is a typed document describing a directed acyclic graph of steps. The document is the source of truth: it is what the engine executes, what check/1 validates, and what editors and agents read and write. HCL workflows use the workflow "name" label as the run name. .exs workflow maps may set name; if they omit it, Condukt falls back to the file basename.

HCL source strings, HCL files, and .exs files are normalized to a workflow document before execution.

Summary

Functions

Validates a workflow file without executing it.

Loads and validates a workflow file without executing it.

Runs an HCL workflow source string or an already-loaded workflow document.

Runs a pre-decoded workflow document. The map is validated against the workflow document shape before execution. Used by callers that produce documents in memory.

Functions

check(path)

Validates a workflow file without executing it.

Returns :ok on success, or {:error, reason} if the file fails to read, normalize, or match the workflow document shape. Accepts .hcl and .exs paths.

load(path)

Loads and validates a workflow file without executing it.

Use this when you explicitly need a reusable Condukt.Workflows.Document, or when loading .exs workflow generator files. HCL callers that only need to execute a workflow can read the file content and pass it directly to run/3.

run(source_or_doc, inputs \\ %{}, opts \\ [])

Runs an HCL workflow source string or an already-loaded workflow document.

Returns {:ok, value} where value is the resolved top-level output expression of the document. Returns {:error, reason} on normalization, validation, or execution failure.

When passing a string, the string is interpreted as HCL source content, not as a file path. Callers that keep HCL workflows on disk should read the file first and pass the content to this function.

run_document(decoded, inputs \\ %{}, opts \\ [])

Runs a pre-decoded workflow document. The map is validated against the workflow document shape before execution. Used by callers that produce documents in memory.