Type Safety
Type checking provides optional compile-time validation to catch type mismatches when composing workflows.Core Concept
The type checking system analyzes function signatures and validates type compatibility between chained nodes:Type Checking Modes
Warning Mode (Default)
Logs warnings but allows execution:Strict Mode
Raises exceptions on type mismatches:Type Compatibility
Compatible Types
Exact matches:Incompatible Types
Type mismatches:Type Checking API
set_type_checking_mode()
Configure global type checking behavior:get_type_checker()
Access the global type checker:check_node_chain_types()
Manually check node compatibility:Type Signatures
NodeTypeSignature
Represents a node’s type signature:TypeInfo
Represents type information:Development Workflow
Type Hints Best Practices
Always use type hints:Development vs Production
Strict mode in development:Advanced Type Checking
Varargs and Kwargs
Nodes with flexible signatures are always compatible:Union Types
Union types provide multiple valid types:Generic Types
Generic types are checked for compatibility:Special Workflow Parameters
Workflow parameters are ignored during type checking:state: SharedStatecontext: Contextworkflow: Sequence
Performance Considerations
Type Checking Overhead
- Signature extraction: ~1ms per node (cached)
- Compatibility check: Less than 0.1ms per chain
- Total impact: Negligible for typical workflows
Caching
Type signatures are cached automatically:Disabling Type Checking
Type checking can be completely disabled if needed:Common Patterns
Type-Safe Data Transformation
Gradual Typing
Add types incrementally:Best Practices
Use strict mode in development
Use strict mode in development
Provide complete type hints
Provide complete type hints
Test type compatibility
Test type compatibility
Use Optional for nullable returns
Use Optional for nullable returns
Document type assumptions
Document type assumptions

