Workflow
junjo.Workflow
Kind: Class
SDK version: 0.64.0
Documentation channel: Next source preview
Signature
Section titled “Signature”Workflow(graph_factory: GraphFactory[Graph], store_factory: StoreFactory[StoreT], max_iterations: int = 100, hooks: Hooks | None = None, name: str | None = None)Constructor
Section titled “Constructor”A Workflow is a top-level, executable collection of nodes and edges arranged as a graph. It manages its own state and store, distinct from any parent or sub-workflows.
This class is generic and requires two type parameters for a convenient and type-safe developer experience:
StateT is the type of state managed by this workflow and should be
a subclass of BaseState. StoreT is the store
type used by this workflow and should be a subclass of
BaseStore.
Every call to execute creates a fresh
graph, a fresh store, and a fresh execution context. That makes a
Workflow instance a reusable definition or blueprint rather than a
mutable live-run container.
Parameters
Section titled “Parameters”| Name | Type | Description | Default |
|---|---|---|---|
name |
str | None |
An optional name for the workflow. If not provided, the class name is used. |
None |
graph_factory |
GraphFactory[Graph] |
A callable that returns a new instance of the workflow’s graph ( Graph). This factory is invoked at thebeginning of each execute call toensure a fresh, isolated graph for that execution. |
|
store_factory |
StoreFactory[StoreT] |
A callable that returns a new instance of the workflow’s store ( StoreT). This factory is invoked at thebeginning of each execute call toensure a fresh store for that execution. |
|
max_iterations |
int |
The maximum number of times any single node or subflow may run within one workflow execution. For RunConcurrent, Junjo counts eachchild item in the concurrent group rather than the RunConcurrent wrapper itself. This helps detect accidentalloops. Defaults to 100. |
100 |
hooks |
Hooks | None |
An optional Hooks registry forobserving workflow lifecycle events. Hooks are optional observers; they do not control OpenTelemetry instrumentation or workflow execution. |
None |