Workflow
The Workflow base class is the durable control-flow primitive in
Waymark. You subclass it and decorate the subclass with @workflow: this handles
compiling the definition to Waymark's intermediate representation.
Calling run(...) on an instance accepts two keyword arguments beyond your own inputs:
_blocking=Falsequeues the workflow and returns its instance id immediately instead of waiting for completion - the fire-and-forget form._priority=sets the queue priority for this instance.
A blocking run(...) raises RuntimeError if the workflow fails and
TimeoutError if the instance doesn't complete in time.
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, the runtime may execute independent steps in parallel; 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