Overview
Thebase module contains the fundamental classes and types for building workflows in Flow Core.
Classes
WorkflowExecutor
Main execution engine for workflows.Parameters
| Name | Type | Required | Description |
|---|---|---|---|
config | ExecutionConfig | No | Execution configuration |
Methods
execute
Execute a workflow asynchronously.workflow: Workflow to executeinput_data: Initial input datacontext: Optional workflow context
ExecutionResult: Execution result with output and metadata
NodeContext
Execution context for individual nodes.Attributes
| Name | Type | Description |
|---|---|---|
node_id | str | Unique node identifier |
status | NodeStatus | Current execution status |
input_data | Dict[str, Any] | Node input data |
output_data | Dict[str, Any] | Node output data |
error | Optional[str] | Error message if failed |
start_time | Optional[datetime] | Execution start time |
end_time | Optional[datetime] | Execution end time |
metadata | Dict[str, Any] | Additional metadata |
variables | Dict[str, Any] | Node-specific variables |
Methods
get_input
Get input data with optional key.set_output
Set output data.set_variable
Store a variable in node context.WorkflowContext
Shared context for entire workflow execution.Attributes
| Name | Type | Description |
|---|---|---|
workflow_id | str | Unique workflow identifier |
global_variables | Dict[str, Any] | Global workflow variables |
shared_state | Dict[str, Any] | Shared mutable state |
execution_metadata | Dict[str, Any] | Execution metadata |
node_results | Dict[str, NodeResult] | Results from executed nodes |
start_time | datetime | Workflow start time |
config | Dict[str, Any] | Workflow configuration |
BaseNode
Abstract base class for all nodes.Abstract Methods
execute
Execute node logic.validate
Validate node configuration.Hook Methods
pre_execute
Called before execution.post_execute
Called after execution.NodeResult
Result returned by node execution.Attributes
| Name | Type | Required | Description |
|---|---|---|---|
success | bool | Yes | Execution success status |
output | Dict[str, Any] | No | Output data |
error | Optional[str] | No | Error message if failed |
next_node_id | Optional[str] | No | Next node to execute |
conditional_next | Optional[Dict[str, str]] | No | Conditional routing |
metadata | Dict[str, Any] | No | Additional metadata |
IStepNode
Protocol interface for all workflow nodes.Enums
NodeStatus
Node execution status.CommonNodeTypes
Predefined node type constants.Configuration Classes
ExecutionConfig
Configuration for workflow execution.Parameters
| Name | Type | Default | Description |
|---|---|---|---|
max_parallel_nodes | int | 10 | Max concurrent nodes |
timeout_seconds | int | 300 | Global timeout |
retry_failed_nodes | bool | False | Auto-retry failures |
max_retries | int | 3 | Max retry attempts |
enable_checkpoints | bool | False | Enable checkpointing |
checkpoint_interval | int | 5 | Checkpoint frequency |
trace_execution | bool | False | Enable tracing |
ExecutionResult
Result of workflow execution.Attributes
| Name | Type | Description |
|---|---|---|
success | bool | Execution success |
output | Optional[Dict[str, Any]] | Final output |
error | Optional[str] | Error message |
context | Optional[WorkflowContext] | Final context |
execution_time | Optional[float] | Total time in seconds |
node_execution_order | List[str] | Node execution sequence |
metrics | Dict[str, Any] | Execution metrics |
trace_id | Optional[str] | Trace identifier |