Skip to content

Index

diapason.workflow

Workflow engine — DAG-based multi-agent pipelines.

WorkflowBuilder

Fluent API for building workflow graphs.

Example

wf = (WorkflowBuilder("research_pipeline") .add_agent("researcher", agent="orchestrator", tools=["web_search"]) .add_agent("summarizer", agent="simple") .connect("researcher", "summarizer") .build())

sequential(*node_ids)

Connect nodes in sequential order.

WorkflowEngine

Execute DAG-based workflows.

Sequential nodes run in topological order. Parallel-eligible nodes (same execution stage, no inter-dependencies) run via ThreadPoolExecutor. Condition nodes evaluate expressions against prior step outputs. Loop nodes use LoopGuard from Phase 14.3.

run(graph, system=None, *, initial_input='', context=None)

Execute a workflow graph end-to-end.

WorkflowGraph

Directed acyclic graph of workflow nodes.

Supports DAG validation (cycle detection), topological sort, and execution_stages() for parallel-ready ordering.

execution_stages()

Group nodes into parallel execution stages.

Nodes in the same stage have no dependencies on each other and can be executed concurrently.

topological_sort()

Return node IDs in topological order (Kahn's algorithm).

validate()

Validate the graph: check for cycles and orphan nodes.

load_workflow(path)

Load a workflow definition from a TOML file.

Expected format:

[workflow]
name = "my_workflow"

[[workflow.nodes]]
id = "researcher"
type = "agent"
agent = "orchestrator"
tools = ["web_search"]

[[workflow.nodes]]
id = "summarizer"
type = "agent"
agent = "simple"

[[workflow.edges]]
source = "researcher"
target = "summarizer"