deepset

Haystack

Production-ready pipelines for search and RAG.

Haystack is an open-source framework from deepset for building search systems, RAG, and agent pipelines. It centers on explicit, typed Pipelines composed of swappable components — retrievers, rankers, generators, and tools.

Install

bash
pip install haystack-ai

Quickstart

A minimal example to verify your setup.

python
from haystack import Pipeline
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder

pipe = Pipeline()
pipe.add_component("prompt", PromptBuilder(template="Answer: {{ q }}"))
pipe.add_component("llm", OpenAIGenerator(model="gpt-4o-mini"))
pipe.connect("prompt.prompt", "llm.prompt")

print(pipe.run({"prompt": {"q": "What is Haystack?"}}))

Core concepts

Pipelines

Typed DAGs of components with validated inputs and outputs — easy to test, serialize to YAML, and deploy.

Components

Retrievers, rankers, embedders, generators, and tools share a small interface. Swap implementations without rewiring.

Document stores

First-class integrations with Elasticsearch, OpenSearch, Weaviate, Qdrant, pgvector, and more.

Agents & tools

Tool-calling agents built on the same Pipeline primitives, with branching and looping support.

Common use cases

  • Enterprise search over millions of documents
  • Hybrid keyword + vector RAG
  • Question-answering on technical docs
  • Customer support copilots

Resources