run_component
Run a Haystack component with custom parameters to test its behavior and get outputs.
Instructions
Run a Haystack component with the given parameters.
This tool allows you to execute a Haystack component by providing its type
and initialization parameters, then passing input data to get results.
Use this to test components and see how they would work in your pipeline.
:param component_type: The type of component to run
(e.g., "haystack.components.builders.prompt_builder.PromptBuilder")
:param init_params: Initialization parameters for the component
:param input_data: Input data for the component
:param input_types: Optional type information for inputs (inferred if not provided). For custom types use the full
import path (e.g. haystack.dataclasses.document.Document for Document)
:param haystack_version: Optional version of Haystack to use for the component.
Pass the same version as specified in the pipeline yaml's dependencies section for the haystack-ai package.
:returns: Dictionary containing the component's outputs or error message string
All parameters accept object references in the form @obj_id or @obj_id.path.to.value.
Examples::
# Direct call with values
run_component(data={'key': 'value'}, threshold=10)
# Call with references
run_component(data='@obj_123', threshold='@obj_456.config.threshold')
# Mixed call
run_component(data='@obj_123.items', threshold=10)The output is automatically stored and can be referenced in other functions.
Returns a formatted preview with an object ID (e.g., @obj_123).
Use the object store tools in combination with the object ID to view nested properties of the object.
Use the returned object ID to pass this result to other functions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input_data | No | ||
| init_params | No | ||
| input_types | No | ||
| component_type | Yes | ||
| haystack_version | No |