Component step
A pipeline step that executes a component on the input state and returns the output.
References
NONE
ComponentStep(name, component, input_state_map=None, output_state=None, runtime_config_map=None, fixed_args=None, input_map=None, retry_config=None, error_handler=None, cache_store=None, cache_config=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_map |
dict[str, str | Val] | None
|
Unified input map. |
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. |
retry_policy |
RetryPolicy | None
|
Configuration for retry behavior using LangGraph's RetryPolicy. |
error_handler |
BaseStepErrorHandler | None
|
Strategy to handle errors during execution. |
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. |
None
|
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
|
input_map |
InputMapSpec | None
|
Unified input map. Can be a dict (arg -> str|Val) or a list with elements: 1. str for identity mapping 2. dict[str, str] for state/config mapping 3. dict[str, Val] for fixed args. Defaults to None. |
None
|
retry_config |
RetryConfig | None
|
Configuration for retry behavior using GLLM Core's RetryConfig. Defaults to None, in which case no retry config is applied. |
None
|
error_handler |
BaseStepErrorHandler | None
|
Strategy to handle errors during execution. Defaults to None, in which case the RaiseStepErrorHandler is used. |
None
|
cache_store |
'BaseCache' | None
|
Cache store to be used for caching. Defaults to None, in which case no cache store is used. |
None
|
cache_config |
dict[str, Any] | None
|
Cache configuration to be used for caching. Defaults to None, in which case no cache configuration is used. |
None
|
execute(state, runtime)
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 |
PipelineState
|
The current state of the pipeline, containing all data. |
required |
runtime |
Runtime[dict[str, Any] | BaseModel]
|
Runtime information 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. |