Creating Nodes
Nodes are the building blocks of workflows - callable functions that transform data and can be chained together into execution graphs.Node Decorator
The@node decorator converts functions into workflow nodes:
Node Names
Node names are used for:- Result storage in shared state
- Debugging and logging
- Graph visualization
Parameter Mapping
Nodes automatically map previous node outputs to input parameters using intelligent type-based mapping:Single Parameter
Single-parameter nodes receive the entire previous output:Multiple Parameters with Tuple/List
Multiple parameters map positionally from tuple/list outputs:Multiple Parameters with Dict
Multiple parameters map by name from dict outputs:Shared State Parameter
Nodes can access shared state by adding aSharedState parameter:
SharedState parameter allowed per node.
Decision Nodes
Decision nodes route execution based on runtime conditions:Pattern Matching
Decision nodes support pattern matching for complex routing:Parallel Nodes
Parallel nodes execute multiple operations concurrently:Node Classes
BaseNode
All nodes inherit fromBaseNode:
AsyncNode
For async operations:BatchNode
For batch processing:Node Attributes
Nodes can have custom attributes:Node Registry
Nodes are automatically registered by name:Type Hints
Type hints enable automatic validation and documentation:Best Practices
Use descriptive node names
Use descriptive node names
Keep nodes focused
Keep nodes focused
Use type hints for clarity
Use type hints for clarity
Handle errors appropriately
Handle errors appropriately
Document node behavior
Document node behavior
Node Lifecycle
Understanding node execution:Performance Considerations
- Function overhead: Less than 0.1ms per node call
- Parameter mapping: Cached for performance (6x speedup)
- State access: O(1) dictionary lookups
- Type checking: Disabled by default in production

