Haystack

Autonomous Agents 💻 Python ⚖️ Apache-2.0 🟢 Actively maintained
26.4k stars

Haystack is an open-source AI orchestration framework for building production-ready LLM applications in Python. It solves the problem of designing complex pipelines and agent workflows with explicit control over retrieval, routing, memory, and generation. It is for developers who need to build scalable RAG systems, semantic search, question answering, and autonomous agents with a transparent, customizable architecture.

✨ Key features

  • Production-ready agents with lifecycle hooks and built-in monitoring.
  • Explicit control over context engineering in pipelines and workflows.
  • Native async support for synchronous or asynchronous pipeline execution.
  • Modular and customizable components with loops, branches, and conditional logic.
  • Model- and vendor-agnostic integrations with major AI providers.
  • Extensible ecosystem for building and sharing custom components.

🎯 Use cases

  • Build scalable RAG systems for enterprise knowledge retrieval.
  • Create semantic search and question answering applications.
  • Develop autonomous agents with tool calling and memory.
  • Design multimodal applications with flexible data routing.
  • Deploy pipelines as REST APIs or MCP servers using Hayhooks.

📦 Installation

🧰 Requirements: Python environment with pip; no specific OS or API keys required for core installation.

pip install haystack-ai

Install nightly pre-releases to try the newest features:

pip install --pre haystack-ai

For other installation methods (e.g., Docker), see the documentation.

🚀 Usage

# Example from the quick start guide (simplified)
from haystack import Pipeline
from haystack.components.retrievers import InMemoryBM25Retriever
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator

# Build a pipeline
pipe = Pipeline()
pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store))
pipe.add_component("prompt_builder", PromptBuilder(template="Answer the question: {{question}}"))
pipe.add_component("llm", OpenAIGenerator())
pipe.connect("retriever.documents", "prompt_builder.documents")
pipe.connect("prompt_builder", "llm")

# Run it
result = pipe.run({"retriever": {"query": "What is Haystack?"}, "prompt_builder": {"question": "What is Haystack?"}})
print(result["llm"]["replies"])

For a complete example, see the Get Started Guide.

⚠️ Good to know

Haystack collects anonymous usage statistics of pipeline components; you can opt out as described in the docs.

❓ FAQ

How do I install Haystack?

Install via pip with pip install haystack-ai. For nightly pre-releases, use pip install --pre haystack-ai.

Can I use Haystack with different AI models?

Yes, Haystack is model- and vendor-agnostic, integrating with OpenAI, Mistral, Anthropic, Cohere, Hugging Face, Google, Azure OpenAI, AWS Bedrock, local models, and more.

Does Haystack support async operations?

Yes, a single Pipeline can run synchronously or asynchronously and stream token by token. Agents can also run concurrent tool calls.

Is Haystack free to use?

Haystack is open-source. There are also enterprise offerings (Haystack Enterprise Starter and Platform) for support and managed production setups.

📊 Repository

Stars★ 26,424
Forks🍴 3,079
Open issues🐛 103
Last commit🕒 Sep 4, 2026
Created📅 Nov 2019
Language💻 Python
License⚖️ Apache-2.0

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.