Execute a single workflow step based on its type. This is the main entry point for step execution. It logs step start/end events and dispatches to the appropriate handler. Args: step_data: Dictionary containing step configuration. context: Workflow c
(
self,
step_data: Dict[str, Any],
context: Dict[str, Any],
step_number: int,
args,
logger: Logger,
checkpoint_manager: Optional[CheckpointManager] = None,
)
| 130 | return load_submodule_tools_for_yaml(yaml_data, yaml_file_path) |
| 131 | |
| 132 | def execute_workflow_step( |
| 133 | self, |
| 134 | step_data: Dict[str, Any], |
| 135 | context: Dict[str, Any], |
| 136 | step_number: int, |
| 137 | args, |
| 138 | logger: Logger, |
| 139 | checkpoint_manager: Optional[CheckpointManager] = None, |
| 140 | ): |
| 141 | """Execute a single workflow step based on its type. |
| 142 | |
| 143 | This is the main entry point for step execution. It logs step |
| 144 | start/end events and dispatches to the appropriate handler. |
| 145 | |
| 146 | Args: |
| 147 | step_data: Dictionary containing step configuration. |
| 148 | context: Workflow context dictionary. |
| 149 | step_number: Step identifier (can be hierarchical like "1.2.3"). |
| 150 | args: EffectiveArgs with execution configuration. |
| 151 | logger: Logger for output and event logging. |
| 152 | checkpoint_manager: Optional checkpoint manager for durability. |
| 153 | |
| 154 | Returns: |
| 155 | Tuple of (output, tokens) where output is the step result |
| 156 | and tokens is the number of tokens used. |
| 157 | |
| 158 | Raises: |
| 159 | Exception: Any exception from step execution is re-raised |
| 160 | after logging the error. |
| 161 | """ |
| 162 | if not isinstance(step_data, dict): |
| 163 | logger(f"Unknown step type: {step_data}") |
| 164 | step_id = str(step_number) |
| 165 | logger.log_event( |
| 166 | logger, |
| 167 | "step_start", |
| 168 | { |
| 169 | "step_id": step_id, |
| 170 | "step_number": step_id, |
| 171 | "name": f"unknown {step_id}", |
| 172 | "step_type": "unknown", |
| 173 | "instruction": "", |
| 174 | "depth": get_step_depth(step_id), |
| 175 | }, |
| 176 | ) |
| 177 | logger.log_event( |
| 178 | logger, |
| 179 | "step_end", |
| 180 | { |
| 181 | "step_id": step_id, |
| 182 | "tokens": 0, |
| 183 | "status": "error", |
| 184 | "error": "Invalid step format (expected mapping)", |
| 185 | }, |
| 186 | ) |
| 187 | return "", 0 |
| 188 | |
| 189 | step_id = str(step_number) |
no test coverage detected