run_component
Execute a Haystack component by providing its type and parameters, then pass input data to test its behavior before integrating into a pipeline.
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)
: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 |
|---|---|---|---|
| component_type | Yes | ||
| init_params | No | ||
| input_data | No | ||
| input_types | No |