Skip to content

Workflow YAML API

YAML declarative workflow definitions with task/step semantics (issue #439).

The key innovation is the task vs step semantic distinction: task opens a new conversation/clean context; step operates within the same conversation with accumulated history.

Exported symbols: WorkflowTask, WorkflowYaml, get_workflow_path, load_workflow_yaml, register_workflow_yaml_tools

WorkflowTask

A single task or step in a workflow definition.

FieldTypeDefaultDescription
namestr(required)Unique identifier within the workflow
kindstr"step""task" (clean context) or "step" (accumulated context)
toolstr""MCP tool name to invoke
inputsdict[str, Any]{}Variable-interpolated input dict
outputslist[str][]Output variable names produced
on_failurelist[str][]Follow-up tools on failure
descriptionstr""Human-readable summary

Methods

MethodReturnsDescription
interpolate_inputs(variables)dictReturn inputs with templates replaced

WorkflowYaml

Parsed YAML workflow definition.

FieldTypeDefaultDescription
namestr(required)Unique workflow identifier
goalstr""Human-readable description
configdict{}Top-level configuration
variablesdict{}Default variable values
taskslist[WorkflowTask][]Ordered task list
source_pathstr | NoneNoneAbsolute path to the YAML file

Methods

MethodReturnsDescription
validate()list[str]Return validation errors (empty = valid)
task_names()list[str]Return ordered list of task names
get_task(name)WorkflowTask | NoneFind a task by name
to_summary_dict()dictReturn concise summary for agent consumption

load_workflow_yaml

python
load_workflow_yaml(path: str | Path) -> WorkflowYaml

Load and parse a workflow YAML file. Raises FileNotFoundError if not found, ValueError if parse/validation fails.

get_workflow_path

python
get_workflow_path(metadata: Any, glob_match_first: bool = True) -> str | None

Extract the workflow file path from a SkillMetadata object. If value is a glob pattern, returns the first matching file.

register_workflow_yaml_tools

python
register_workflow_yaml_tools(server, *, workflows=None, skills=None, dcc_name="dcc") -> None

Register workflows.list and workflows.describe MCP tools on server. Pass either pre-loaded workflows or a list of SkillMetadata skills.

Released under the MIT License.