Skip to content

Component step

A pipeline step that executes a component on the input state and returns the output.

Author

Dimitrij Ray (dimitrij.ray@gdplabs.id)

References

NONE

ComponentStep(name, component, input_state_map, output_state=None, runtime_config_map=None, fixed_args=None)

Bases: BasePipelineStep, HasInputsMixin

A pipeline step that executes a specific component.

This step wraps a component, manages its inputs and outputs, and integrates it into the pipeline.

Attributes:

Name Type Description
name str

A unique identifier for this pipeline step.

component Component

The component to be executed in this step.

input_state_map dict[str, str]

Mapping of component input arguments to pipeline state keys.

output_state str | list[str] | None

Key(s) to extract from the component result and add to the pipeline state. If None, the component is executed but no state updates are performed.

runtime_config_map dict[str, str] | None

Mapping of component input arguments to runtime configuration keys.

fixed_args dict[str, Any] | None

Fixed arguments to be passed to the component.

Initializes a new ComponentStep.

Parameters:

Name Type Description Default
name str

A unique identifier for this pipeline step.

required
component Component

The component to be executed in this step.

required
input_state_map dict[str, str]

Mapping of component input arguments to pipeline state keys. Keys are input arguments expected by the component, values are corresponding state keys.

required
output_state str | list[str]) | None

Key(s) to extract from the component result and add to the pipeline state. If None, the component is executed but no state updates are performed. Defaults to None.

None
runtime_config_map dict[str, str] | None

Mapping of component input arguments to runtime configuration keys. Keys are input arguments expected by the component, values are runtime configuration keys. Defaults to None.

None
fixed_args dict[str, Any] | None

Fixed arguments to be passed to the component. Defaults to None.

None

execute(state, config) async

Executes the component and processes its output.

This method validates inputs, prepares data, executes the component, and formats the output for integration into the pipeline state.

Parameters:

Name Type Description Default
state dict[str, Any]

The current state of the pipeline, containing all data.

required
config RunnableConfig

Runtime configuration for this step's execution.

required

Returns:

Type Description
dict[str, Any] | None

dict[str, Any] | None: The update to the pipeline state after this step's operation, or None if output_state is None. When not None, this includes new or modified data produced by the component, not the entire state.

Raises:

Type Description
RuntimeError

If an error occurs during component execution.

TimeoutError

If the component execution times out.

CancelledError

If the component execution is cancelled.