ScriptsMar 31, 2026·2 min read

Haystack — AI Orchestration for Search & RAG

Open-source AI orchestration framework by deepset. Build production RAG pipelines, semantic search, and agent workflows with modular components. 25K+ GitHub stars.

TO
TokRepo精选 · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

pip install haystack-ai
from haystack import Pipeline
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder

prompt = PromptBuilder(template="Answer: {{query}}")
llm = OpenAIGenerator(model="gpt-4o")

pipe = Pipeline()
pipe.add_component("prompt", prompt)
pipe.add_component("llm", llm)
pipe.connect("prompt", "llm")

result = pipe.run({"prompt": {"query": "What is RAG?"}})
print(result["llm"]["replies"][0])

Intro

Haystack is an open-source AI orchestration framework by deepset for building production-ready RAG pipelines, semantic search engines, and agent workflows. It uses a modular pipeline architecture where you compose components (retrievers, generators, rankers, converters) into directed graphs. Supports 30+ LLM providers and vector stores. 25,000+ GitHub stars.

Best for: Teams building production RAG, search, or question-answering systems Works with: OpenAI, Anthropic, Google, Cohere, Ollama, 30+ providers


Core Concepts

Pipelines

Compose components into DAGs — each component does one thing well:

pipe.add_component("converter", HTMLToDocument())
pipe.add_component("splitter", DocumentSplitter(split_length=200))
pipe.add_component("embedder", OpenAIDocumentEmbedder())
pipe.add_component("writer", DocumentWriter(document_store=store))
pipe.connect("converter", "splitter")
pipe.connect("splitter", "embedder")
pipe.connect("embedder", "writer")

Component Library

50+ built-in components: document converters, splitters, embedders, retrievers, rankers, generators, and more.

Document Stores

Pluggable storage: Elasticsearch, Qdrant, Pinecone, Weaviate, ChromaDB, pgvector, and in-memory.

Evaluation

Built-in evaluation metrics for RAG quality: faithfulness, context relevance, answer relevance.


FAQ

Q: What is Haystack? A: An open-source AI orchestration framework by deepset for building production RAG, search, and agent pipelines with modular components. 25K+ GitHub stars.

Q: How is Haystack different from LangChain? A: Haystack uses a strict pipeline/DAG model with typed components, making it more predictable for production. LangChain is more flexible but less structured.


🙏

Source & Thanks

Created by deepset. Licensed under Apache 2.0. deepset-ai/haystack — 25,000+ GitHub stars

Related Assets