Node
class is the foundation for all other node types. Each specialized node implements the process()
method, which contains the step’s core logic.
Use process()
to define how the node handles data during execution. This design keeps implementations consistent and extensible.
Node Class
The baseNode
class provides the essential structure for all workflow processing steps:
- Abstract base class for a consistent interface
- Node name property uses the class name
- Abstract
process
method for subclasses - Async support for non‑blocking operations
Basic Implementation
Here is a simple example of a custom node:task_context
to maintain data flow through the pipeline.
Storing and Accessing Node Results
Why store results? Persist outputs so later nodes can use them.Storing Node Results
Usesave_output()
to store results in the task context:
Accessing Node Results
Retrieve results from previous nodes usingget_output()
:
Key benefits
- Consistency - A predictable interface across nodes
- Flexibility - Customize while maintaining structure
- Composability - Combine and reorder nodes freely
- Testability - Test nodes independently with mock contexts