Node
dagpipe.node
Summary
Defines the Node abstraction used by dagpipe.
A node represents a single unit of pipeline execution logic. It consumes one
State and produces zero, one, or many new State objects.
Nodes are connected using a Graph and executed by an Engine.
Design principles
- Pure: Must not mutate input state.
- Deterministic: Same input produces same output.
- Stateless: Recommended to be stateless for reuse.
- Composable: Nodes enable branching execution graphs.
Classes
Node
Bases: ABC
Base class for all dagpipe execution nodes.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier of the node (snake_case dotted format). |
name |
str
|
Human-readable display name. |
Notes
Responsibilities:
1 2 3 | |
Guarantees:
1 2 | |
Functions
__new__
Create or reuse singleton instance of the Node subclass.
Returns:
| Name | Type | Description |
|---|---|---|
Node |
Node
|
Singleton instance of the subclass. |
clean_id_and_name
classmethod
Normalize and validate node ID and display name.
Raises:
| Type | Description |
|---|---|
TypeError
|
If ID is not a string. |
ValueError
|
If ID format is invalid. |
Notes
Guarantees:
1 2 3 | |
fork
Create a child State attributed to this node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state |
State
|
Parent execution state. |
required |
payload_update |
Mapping[str, Any]
|
Dot-path payload updates. |
None
|
confidence_delta |
float
|
Confidence adjustment. |
0.0
|
metadata_update |
Mapping[str, Any]
|
Metadata updates. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
New child execution state. |
Notes
Responsibilities:
1 2 | |
node_id_to_name
staticmethod
Convert a dotted snake_case node ID into a human-readable name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id |
str
|
Unique node identifier (e.g., 'entity.resolve.numeric_merchant'). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Human-readable display name (e.g., 'Entity › Resolve › Numeric Merchant'). |
resolve
abstractmethod
Execute node logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state |
State
|
Input execution state. |
required |
Yields:
| Name | Type | Description |
|---|---|---|
State |
Iterable[State]
|
Derived execution state(s). |
Notes
Responsibilities:
1 2 3 4 | |