Loading: from_dict¶
Workflow.from_dict is the host’s
entry point for materializing a workflow from a wire-format dict. Two
flags drive its behaviour:
validate_only— drives the return type.partial— drives error suppression / continuation.
Their combinations give four modes:
|
|
Behaviour |
|---|---|---|
|
|
Strict load. Returns a fully wired |
|
|
Best-effort load. Per-node failures are captured. After all
nodes are processed, the aggregated errors are raised as a single
|
|
|
Fail-fast diagnostic. Returns |
|
|
Editor mode. Returns |
Inspecting build-time state¶
After a partial or validate_only load, three properties on the
returned Workflow expose what happened:
wf.errors— the full list ofValidationErroraccumulated during construction. Same content as theerrorselement of the returned tuple invalidate_only=Truemodes; useful when the host drops the tuple and just keeps the workflow.wf.failed_nodes—dict[node_name, ValidationError]mapping each node that could not be constructed (e.g. an unknown tool class) to the error that prevented it.wf.is_partial— convenience boolean:Truewheneverfailed_nodesis non-empty.
These properties are populated during from_dict and persist on the
workflow afterwards, so a later wf.validate() call does not
clobber them.
Other parameters¶
auto_install(defaultTrue) — whenTrue, missing versioned packages are installed automatically. Set toFalseon hot paths (sessions, validators) to keep keystroke latency low; an unknown tool then surfaces as anunknown_toolerror rather than a network round-trip.storage_path_override— overridesdata["config"]["storage_path"]without mutating the dict. Useful when validating a graph against a specific cache path (e.g., a sandboxed scratch directory).on_progress/engine/execution/wetlands_config— passed through to the constructedWorkflow.Nonemeans “use the values fromdata['config'](or defaults)”.
Workflow.load(path) is a thin wrapper around the strict mode
(partial=False, validate_only=False).