Workflow
The Workflow base class is the durable control-flow primitive in
Waymark. You subclass it and decorate the subclass with @workflow;
the decorator parses your run() method into IR, registers the
workflow, and returns a class whose instances queue work onto Postgres
when you await workflow.run(...).
Base class for workflow definitions.
Class Attributes
- Name
name- Type
- Optional[str]
- Description
Human-friendly identifier. Override to pin the registry key; defaults to lowercase class name.
- Name
version- Type
- Optional[str]
- Description
Optional workflow version identifier. Defaults to IR hash when unset.
- Name
concurrent- Type
- bool
- Description
When True, downstream engines may respect DAG-parallel execution; False preserves sequential semantics.
Class Methods
- Name
run- Return type
- Any
- Description
- Name
run_action- Return type
- TResult
- Description
Helper that simply awaits the provided action coroutine.
The retry and timeout arguments are consumed by the workflow compiler (IR builder) rather than the runtime execution path.
Args: awaitable: The action coroutine to execute. retry: Retry policy including max attempts, exception types, and backoff. timeout: Timeout duration in seconds (or timedelta).
- Name
short_name- Return type
- str
- Description
- Name
workflow_ir- Return type
- ir.Program
- Description
Build and cache the IR program for this workflow.
Decorator
The @workflow decorator runs the AST compiler against your class's
run() method and registers the resulting IR with the runtime.
workflow
Decorator that registers workflow classes and caches their IR.
Parameters
- Name
cls- Type
- type[TWorkflow]
- Description
Registry
workflow_registry exposes the in-process map of registered
workflows. You usually don't interact with it directly - the
@workflow decorator handles registration - but it's useful when
inspecting registration state or building tools on top of Waymark.
Registry of workflow definitions keyed by workflow name.
Class Methods
- Name
register- Return type
- None
- Description
- Name
get- Return type
- Optional[type[Workflow]]
- Description
- Name
names- Return type
- list[str]
- Description
- Name
reset- Return type
- None
- Description