Haystack Expert Skill

SkillSearch

Build production search and NLP pipelines with Haystack. Pipeline DAG composition, document stores, retrievers, PromptBuilder (Jinja2), generators, evaluation, Hayhooks deployment. Use when building search pipelines or comparing NLP application frameworks. Do not use this skill for unrelated requests; route to the nearest named specialist.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Haystack Expert Skill skill

What this skill tells your AI

The instructions your AI receives, as published by magnus919/agent-skills in haystack/SKILL.md and read by ahel’s review.

Haystack (by deepset) is a production-oriented framework for building search and NLP pipelines. Its core abstraction is the Pipeline — a directed acyclic graph of typed components with explicit connections. Unlike LangChain's LCEL (pipe operator) or LlamaIndex's query engines, Haystack pipelines are declared upfront with add_component and connect, giving validated, debuggable DAGs.

Core Paradigm

from haystack import Pipeline
from haystack.components.embedders import SentenceTransformersTextEmbedder
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
from haystack.document_stores.in_memory import InMemoryDocumentStore

# Build a pipeline
document_store = InMemoryDocumentStore()
pipeline = Pipeline()
pipeline.add_component("embedder", SentenceTransformersTextEmbedder())
pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store))
pipeline.add_component("prompt_builder", PromptBuilder(template="Answer using: {{documents}}\n\nQuestion: {{question}}"))
pipeline.add_component("generator", OpenAIGenerator())

# Connect components
pipeline.connect("embedder.embedding", "retriever.query_embedding")
pipeline.connect("retriever.documents", "prompt_builder.documents")
pipeline.connect("prompt_builder", "generator")

# Run
result = pipeline.run({"embedder": {"text": "What is Haystack?"}, "prompt_builder": {"question": "What is Haystack?"}})

Core Principles

  1. Pipelines are validated DAGs. add_component + connect. Pipeline validation catches errors BEFORE execution — leverage this during development.
  2. Components are typed. Each component has input/output slots. Connections must match types. This prevents runtime errors.
  3. PromptBuilder uses Jinja2. Templates are Jinja2 strings, not f-strings. {{documents}}, {{query}}, {{question}} are variable placeholders.
  4. Indexing and query are separate pipelines. One pipeline loads/cleans/embeds/writes documents. Another retrieves/generates answers. They share the DocumentStore.
  5. Evaluation is a pipeline too. Add evaluator components to measure faithfulness, relevancy, or custom metrics.

Where to Start

You already have...Start here
Nothing — exploring HaystackBuild a basic indexing + query pipeline
Documents to indexBuild an indexing pipeline (converters, splitter, embedder, writer)
A search use caseBuild a query pipeline (embedder, retriever, prompt, generator)
A production deploymentAdd Hayhooks + evaluation pipeline

Quick Reference

TaskApproachReference
Build indexing pipelineadd_component -> connect -> runreferences/pipeline-design.md
Build query pipelineretriever -> prompt_builder -> generatorreferences/pipeline-design.md
Choose document storeInMemory (dev), Elasticsearch/Pinecone (prod)references/document-stores.md
Embedding retrievalSentenceTransformersTextEmbedder + EmbeddingRetrieverreferences/retrievers.md
Hybrid retrievalBM25 + Embedding in parallel, DocumentJoinerreferences/retrievers.md
Prompt templatesJinja2 in PromptBuilderreferences/pipeline-design.md
EvaluationDeepEvalEvaluator, SASEvaluatorreferences/evaluation.md
DeployHayhooks REST APIreferences/deployment.md

Framework Routing Guide

ScenarioReach forWhy
Search / NLP pipelinesHaystackPipeline DAG model is most mature for retrieval-heavy workloads
Documents to query / RAGLlamaIndexData ingestion is the primary primitive
Chain/agent compositionLangChainLCEL pipe operator for general chain building
Compiled prompt programsDSPyAuto-optimizes prompts against a metric
Role-based multi-agentCrewAIHigher-level agent abstraction

Reference Files

ReferenceLoad whenFile
Pipeline DesignBuilding indexing and query pipelinesreferences/pipeline-design.md
Document StoresStore selection and configurationreferences/document-stores.md
RetrieversEmbedding, BM25, hybrid retrievalreferences/retrievers.md
Validation AuditResearch validation of all API claimsreferences/validation-audit.md
File ConvertersMulti-format indexing, YAML serialization, component typesreferences/file-converters.md
EvaluationMetrics, evaluators, pipeline evaluationreferences/evaluation.md
DeploymentHayhooks, containerization, productionreferences/deployment.md
FAQ & TroubleshootingCommon errors and fixesreferences/faq-and-troubleshooting.md

Templates

TemplateWhen to useFile
Indexing PipelineLoad, split, embed, write to storetemplates/indexing-pipeline.py
Query PipelineRetrieve, prompt, generate answertemplates/query-pipeline.py
Hybrid RAGBM25 + embedding in paralleltemplates/hybrid-rag.py

Troubleshooting

SymptomLikely causeFixReference
Pipeline run errorsComponent connection mismatchCheck component input/output slot typesreferences/pipeline-design.md
No documents retrievedEmpty document storeRun indexing pipeline firstreferences/pipeline-design.md
Prompt not renderingWrong variable name in Jinja2 templateCheck {{variables}} match pipeline inputreferences/pipeline-design.md
Slow retrievalFull scan instead of ANNConfigure approximate nearest neighbor indexreferences/retrievers.md
Embedding mismatchDifferent models for indexing vs queryUse same model in both pipelinesreferences/retrievers.md
Hayhooks not startingPort conflict or missing configCheck port, run with --help for optionsreferences/deployment.md

Signals

GitHub stars
78
Forks
8
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
haystack
Source
github.com/magnus919/agent-skills