Master Haystack with our step-by-step tutorial, detailed feature walkthrough, and expert tips.
Install Haystack via pip and define your first pipeline architecture. Connect your LLM provider (OpenAI, Anthropic, etc.) and document store. Configure document preprocessing components for your data format. Build your retrieval pipeline with embedders and retrievers. Test with sample documents and iterate on component configuration.
💡 Quick Start: Follow these 1 steps in order to get up and running with Haystack quickly.
Explore the key features that make Haystack powerful for ai agent builders workflows.
Pipelines are directed graphs of Components with typed input/output sockets. Connections are validated at build time for type compatibility rather than failing at runtime. Components are self-contained, independently testable, and reusable across pipelines.
Building a modular RAG system where you can swap the retriever from BM25 to embedding-based without modifying any other part of the pipeline.
Dedicated components for document ingestion including FileTypeRouter for format detection, converters for PDF/DOCX/HTML/Markdown, DocumentCleaner for noise removal, DocumentSplitter for chunking with overlap, and DocumentLanguageClassifier for language routing. Handles the messy reality of enterprise corpora.
Processing a corporate knowledge base of mixed format documents into clean, chunked, deduplicated documents ready for embedding and indexing.
Supports combining sparse retrieval (BM25) with dense retrieval (embedding similarity) using DocumentJoiner and reciprocal rank fusion. Reranking components from Cohere, Hugging Face cross-encoders, and others refine candidate sets before generation.
Building a legal document search system that combines keyword matching for exact statute references with semantic search for conceptual queries, then reranks the top 50 results down to the 5 most relevant for the LLM.
Entire pipelines can be serialized to YAML and deserialized back with Pipeline.dumps() and Pipeline.loads(). This enables pipeline-as-code practices: version control, environment-specific configs via templating, and sharing pipeline definitions without distributing Python code.
Deploying the same RAG pipeline across dev, staging, and production with YAML configs that only differ in document store endpoints, API keys, and model names.
Built-in components measuring retrieval metrics (recall, MRR, MAP, context relevance), generation quality (faithfulness, answer relevance), and end-to-end performance. Supports automated evaluation with LLM judges via LLMEvaluator and integrates with human annotation tools in deepset Cloud.
Running nightly evaluation benchmarks against a golden test set of 500 question/answer pairs to detect pipeline regressions when updating embedding models or prompts.
Managed platform from Haystack's creators offering a visual pipeline editor, evaluation tools, file management, annotation interfaces, and production monitoring. Pipelines built in code can be deployed to deepset Cloud, and pipelines built visually can be exported as Haystack code.
Enabling domain experts and developers to collaboratively build and deploy RAG pipelines using a visual editor for prompt and component tuning while maintaining code-level control through Git-tracked YAML.
Haystack 2.x, released in early 2024, is a complete rewrite. The node-based pipeline is replaced by a component-based architecture with typed connections; DocumentStore is now a component within pipelines rather than a separate concept; the rigid Retriever/Reader pattern is replaced by flexible composition; and the YAML serialization format is entirely new. Migration from 1.x requires rewriting pipelines, but official migration guides cover each component mapping. Most teams adopting Haystack today should start directly on 2.x.
Yes. Haystack's component model supports any NLP pipeline including classification, named entity recognition, summarization, translation, and chat. You can build custom components for any task by implementing the @component decorator and declaring input/output types. However, documentation, examples, and pre-built components are heavily RAG-focused, so non-RAG use cases will require more custom work than choosing a framework purpose-built for that task.
For prototyping, use the InMemoryDocumentStore that ships with the core package. For production keyword search, Elasticsearch or OpenSearch are battle-tested. For vector-first workloads, Pinecone, Weaviate, or Qdrant offer managed options. For cost-sensitive deployments, pgvector lets you reuse existing Postgres infrastructure. Haystack's unified API means switching stores requires only changing the component initialization, not pipeline logic — one of its most useful production properties across 15+ supported backends.
Haystack emphasizes production architecture — typed pipelines, evaluation harnesses, preprocessing, and deployment via YAML and deepset Cloud. LlamaIndex emphasizes developer experience with its 300+ data loaders and simpler initial setup for quick ingestion. Haystack tends to be the better choice for maintainable production systems with multiple environments and stakeholders. LlamaIndex is faster for prototyping and one-off data exploration. Many teams evaluate both and select based on whether their priority is speed-to-prototype or long-term maintainability.
The Haystack framework itself is free and open source under the Apache 2.0 license — there is no usage cost regardless of scale. deepset Cloud is the optional managed platform built on Haystack, offering a visual pipeline editor, evaluation tools, file management, annotation workflows, and production monitoring with custom enterprise pricing through deepset's sales team. Haystack Enterprise adds priority support, advanced security features, and SLA-backed deployment assistance for regulated industries.
Now that you know how to use Haystack, it's time to put this knowledge into practice.
Sign up and follow the tutorial steps
Check pros, cons, and user feedback
See how it stacks against alternatives
Follow our tutorial and master this powerful ai agent builders tool in minutes.
Tutorial updated March 2026