Skip to content

Haystack

deepset's component-and-pipeline framework for RAG and tool-calling agents, with multi-agent orchestration.

GroupData & RAG
Current versionv3.5.0
Bonds withPy

Pipelines first, agents included. Haystack builds LLM applications from typed components (retrievers, rankers, prompt builders, chat generators) wired into pipelines. The Agent component runs a tool-calling loop with state and hooks, and can sit inside a pipeline like anything else.

Current version: haystack-ai 3.5.0 (checked 2026-11-19). Python 3.11+.

Install

Terminal window
pip install haystack-ai==3.5.0

Version

3.5.0 · Haystack 3 · Python 3.11+

Best for

RAG pipelines, search-first agents, production deployments.

  • Generators removed. OpenAIGenerator, AzureOpenAIGenerator and the Hugging Face text generators are gone; ChatGenerators accept a plain str and return ChatMessage replies.
  • ToolInvoker removed. Tools are passed to Agent; tool_invoker_kwargs became tool_concurrency_limit and tool_streaming_callback_passthrough.
  • AsyncPipeline merged into Pipeline, which now has run, run_async, run_async_generator and stream.
  • Agent hooks. before_run, before_llm, before_tool, after_tool, on_exit, after_run; human-in-the-loop confirmation is a ConfirmationHook in haystack.hooks.human_in_the_loop.
  • Stricter defaults. Prompt variables are required; tools read State only through inputs_from_state; Pipeline.load uses a module allowlist.
  • Added during 3.x. Context-management hooks (CompactionHook, ToolResultOffloadHook), TokenBudgetHook, StructuredOutputHook, SkillToolset and stop_run for hooks; Python 3.10 support was dropped in 3.4.0.
  • Leaner core. Hugging Face, sentence-transformers, web search, Whisper, OpenAPI, OpenTelemetry and Datadog components moved to integration packages under haystack_integrations.*; haystack-experimental is no longer installed by default.
from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack.tools import tool
@tool
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return f"Sunny in {city}"
agent = Agent(
chat_generator=OpenAIChatGenerator(model="gpt-6-luna"),
tools=[get_weather],
system_prompt="You are a helpful assistant.",
)
result = agent.run(messages=[ChatMessage.from_user("What's the weather in Berlin?")])
print(result["last_message"].text)

Ready? Start Zero → Hero Step 1 →


DateVersionChanges
2026-11-193.5.0Guide moved from Haystack 2.x to 3.x. Code across all pages rewritten against the installed package; version references now come from the site’s version data. Re-audited against the installed package: added document-store, branching, async, MCP, human-in-the-loop, structured-output and span-recording examples.
2026-10-213.4.1Python 3.11+; context management, token budgets, SkillToolset, images and files; security, cost, testing, evaluation and Hayhooks on the production page; unsafe inputs_from_state tenant advice replaced; diagrams redrawn from real classes; duplicated multi-agent and resilience material consolidated.
2026-06-042.30.0Last 2.x revision.
2026-04-212.28.0Index redesigned with Zero → Hero + Jump-to-topic grid.
November 20252.20.0Initial documented version.