SuperComponent
Wrap an entire pipeline in SuperComponent and use it as a single reusable component with simplified inputs and outputs.
Key Features
- Encapsulates a complete pipeline as a single component for reuse across other pipelines.
- Supports custom input and output name remapping via
input_mappingandoutput_mapping. - Hides internal pipeline complexity, exposing only the inputs and outputs you define.
- Enables tool-based agentic workflows where an agent can execute an entire sub-pipeline.
- Inputs and outputs are dynamically determined by the pipeline and mapping configuration.
Configuration
- Drag the
SuperComponentcomponent onto the canvas from the Component Library. - Click the component to open the configuration panel.
- On the General tab:
- Define the
pipelineconfiguration — the full sub-pipeline YAML including its components, connections, and settings.
- Define the
- Go to the Advanced tab to configure
input_mappingandoutput_mappingto rename inputs and outputs.
Connections
SuperComponent's inputs and outputs are dynamically determined by the input_mapping and output_mapping configuration. By default, all pipeline inputs are exposed as inputs and all pipeline outputs are exposed as outputs. Connect other components to the exposed inputs and outputs as you would with any other component.
Usage Example
This is an example RAG pipeline using SuperComponent to wrap a retrieval sub-pipeline as a reusable tool:
components:
rag_tool:
type: haystack.core.super_component.super_component.SuperComponent
init_parameters:
input_mapping:
query:
- bm25_retriever.query
- query_embedder.text
- ranker.query
- prompt_builder.query
output_mapping:
generator.replies: answer
ranker.documents: documents
pipeline:
components:
bm25_retriever:
type: haystack_integrations.components.retrievers.opensearch.bm25_retriever.OpenSearchBM25Retriever
init_parameters:
document_store:
type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
init_parameters:
hosts:
index: 'default'
max_chunk_bytes: 104857600
embedding_dim: 768
return_embedding: false
method:
mappings:
settings:
create_index: true
http_auth:
use_ssl:
verify_certs:
timeout:
top_k: 20
fuzziness: 0
query_embedder:
type: deepset_cloud_custom_nodes.embedders.nvidia.text_embedder.DeepsetNvidiaTextEmbedder
init_parameters:
normalize_embeddings: true
model: intfloat/e5-base-v2
embedding_retriever:
type: haystack_integrations.components.retrievers.opensearch.embedding_retriever.OpenSearchEmbeddingRetriever
init_parameters:
document_store:
type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
init_parameters:
hosts:
index: 'default'
max_chunk_bytes: 104857600
embedding_dim: 768
return_embedding: false
method:
mappings:
settings:
create_index: true
http_auth:
use_ssl:
verify_certs:
timeout:
top_k: 20
document_joiner:
type: haystack.components.joiners.document_joiner.DocumentJoiner
init_parameters:
join_mode: concatenate
ranker:
type: deepset_cloud_custom_nodes.rankers.nvidia.ranker.DeepsetNvidiaRanker
init_parameters:
model: intfloat/simlm-msmarco-reranker
top_k: 8
prompt_builder:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: "You are a helpful assistant answering the user's questions based on the provided documents.\nDo not use your own knowledge.\n\nProvided documents:\n{% for document in documents %}\nDocument [{{ loop.index }}]:\n{{ document.content }}\n{% endfor %}\n\nQuestion: {{ query }}\nAnswer:"
generator:
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
init_parameters:
api_key:
type: env_var
env_vars:
- OPENAI_API_KEY
strict: false
model: gpt-4o
generation_kwargs:
max_tokens: 1000
temperature: 0.7
connections:
- sender: bm25_retriever.documents
receiver: document_joiner.documents
- sender: query_embedder.embedding
receiver: embedding_retriever.query_embedding
- sender: embedding_retriever.documents
receiver: document_joiner.documents
- sender: document_joiner.documents
receiver: ranker.documents
- sender: ranker.documents
receiver: prompt_builder.documents
- sender: prompt_builder.prompt
receiver: generator.messages
answer_builder:
type: deepset_cloud_custom_nodes.augmenters.deepset_answer_builder.DeepsetAnswerBuilder
init_parameters:
reference_pattern: acm
connections:
- sender: rag_tool.answer
receiver: answer_builder.replies
- sender: rag_tool.documents
receiver: answer_builder.documents
inputs:
query:
- "rag_tool.query"
- "answer_builder.query"
outputs:
documents: "rag_tool.documents"
answers: "answer_builder.answers"
max_runs_per_component: 100
metadata: {}
Parameters
Inputs
Inputs are dynamically defined based on the input_mapping configuration. By default, all pipeline inputs are exposed.
Outputs
Outputs are dynamically defined based on the output_mapping configuration. By default, all pipeline outputs are exposed.
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| pipeline | Union[Pipeline, AsyncPipeline] | The pipeline instance to be wrapped. | |
| input_mapping | Optional[Dict[str, List[str]]] | None | A dictionary mapping component input names to pipeline input socket paths. If not provided, a default mapping is created based on all pipeline inputs. Example: {"query": ["retriever.query", "prompt_builder.query"]}. |
| output_mapping | Optional[Dict[str, str]] | None | A dictionary mapping pipeline output socket paths to component output names. If not provided, a default mapping is created based on all pipeline outputs. Example: {"generator.replies": "replies"}. |
Run Method Parameters
The run method parameters are dynamically determined by the input_mapping configuration. Each key in the input mapping becomes a parameter that can be passed at runtime.
Was this page helpful?