# Haystack: features, protocols, quickstart

## TL;DR

Haystack is deepset's open-source Python framework for LLM applications, built from components wired into pipelines with branches and loops. Its Agent component adds tool calling, lifecycle hooks and human confirmation of tool calls, and a coordinator agent can call specialist agents as tools. It suits teams building retrieval-heavy agents who want explicit data flow.

## Key facts

| Field | Value |
| --- | --- |
| Type | Framework |
| Languages / SDKs | Python |
| License | Apache-2.0 |
| Pricing model | [Open core](https://www.deepset.ai/pricing) |
| Orchestration pattern | Supervisor |
| GitHub stars | 26,632 (as of 2026-09-30) |
| GitHub forks | 3,208 |
| Last push | 2026-09-30 |
| Latest release | v3.2.0 |
| Repository | [deepset-ai/haystack](https://github.com/deepset-ai/haystack) |
| Website | [haystack.deepset.ai](https://haystack.deepset.ai) |
| Documentation | [docs.haystack.deepset.ai](https://docs.haystack.deepset.ai/docs/intro) |
| Last verified | 2026-09-30 |

## Key features

- Pipelines connect components in a graph that can branch and loop, with visit counters and safety limits for cycles. ([source](https://docs.haystack.deepset.ai/docs/pipeline-loops))
- Agent component runs a tool-calling loop with a typed State shared by its tools. ([source](https://docs.haystack.deepset.ai/docs/state))
- Agent hooks (before_llm, before_tool, after_tool, on_exit and more) for guardrails, cost tracking and custom logic. ([source](https://docs.haystack.deepset.ai/docs/hooks))
- AgentTool wraps a specialist agent so a coordinator agent can delegate to it and receive only its final reply. ([source](https://docs.haystack.deepset.ai/docs/agenttool))
- Human-in-the-loop ConfirmationHook lets a person confirm, reject or modify each tool call before it runs. ([source](https://docs.haystack.deepset.ai/docs/human-in-the-loop))
- MCPTool and MCPToolset (mcp-haystack package) use tools from MCP servers over Streamable HTTP or stdio. ([source](https://docs.haystack.deepset.ai/docs/mcptool))
- Pipeline breakpoints stop at a component, save a JSON snapshot, and resume from it. ([source](https://docs.haystack.deepset.ai/docs/pipeline-breakpoints))
- Hayhooks serves pipelines and agents as REST endpoints, OpenAI-compatible chat endpoints or an MCP server. ([source](https://docs.haystack.deepset.ai/docs/hayhooks))

## Architecture and orchestration pattern

Pattern: Supervisor.

Everything is a component with typed inputs and outputs. A `Pipeline` connects components into a directed graph; a component reruns whenever all its required inputs arrive again, which is how loops and self-correction work, and routers add branching. The same `Pipeline` class runs synchronously, asynchronously or as a stream, and pipelines serialize to YAML.

The `Agent` component wraps a chat generator and tools and loops until an exit condition. For multiple agents, the documented pattern is a coordinator agent that calls specialist agents wrapped with `AgentTool`; the coordinator sees only each specialist's final reply. Agents can also sit inside larger pipelines.

Within one run, `State` holds typed values (messages, documents and custom fields) that tools read from and write to. Longer-term memory comes from integrations such as Mem0 memory stores and document stores, and compaction hooks trim long conversations. Pipeline breakpoints capture snapshots that can be edited and resumed.

### Human in the loop

A `ConfirmationHook` registered under the Agent's `before_tool` hook point intercepts tool calls. A strategy (the built-in `BlockingConfirmationStrategy`) asks a person whether to confirm, reject or modify the call, a policy (`AlwaysAskPolicy`, `AskOncePolicy`, `NeverAskPolicy`) decides when to ask, and the built-in UIs are console prompts. Rejections are fed back to the model. Pipelines can also be paused with breakpoints and resumed from an edited snapshot; since 3.0, pausing inside an Agent is no longer supported.

## Protocols

| Protocol | Support | Evidence | Note |
| --- | --- | --- | --- |
| MCP | Yes (checked 2026-09-30) | [link](https://docs.haystack.deepset.ai/docs/mcptool) | Client via MCPTool/MCPToolset in the deepset-maintained mcp-haystack integration; Hayhooks can also expose pipelines and agents as an MCP server. |
| A2A | Unknown (checked 2026-09-30) | — | Searched the full docs llms.txt, README, GitHub code search in haystack and haystack-core-integrations (hits were hex strings) and issues for a2a / agent2agent; nothing official found. |
| AG-UI | Unknown (checked 2026-09-30) | — | Searched docs llms.txt, README, code search in haystack, haystack-core-integrations and hayhooks for ag-ui, and the AG-UI integration list; Haystack is not listed. |

## Best for

- Retrieval-heavy agents where you want to control exactly what context reaches the model.
- Agents whose risky tool calls must be confirmed, rejected or edited by a person.
- Pipelines that loop for validation or self-correction and need step-level debugging with snapshots.
- Running on local models or self-managed infrastructure, with an optional paid managed platform.

## Not for

- Teams that need a TypeScript or JVM SDK.
- Designs that need to pause and resume in the middle of an Agent's own loop (removed in 3.0).
- Peer-to-peer agent swarms without a coordinator.

## Quickstart

```sh
pip install haystack-ai
```

Install not yet verified by this site.

```python
from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack.tools import AgentTool, tool

@tool
def word_count(text: str) -> int:
    """Count the words in a piece of text."""
    return len(text.split())

editor = Agent(chat_generator=OpenAIChatGenerator(model="gpt-5.4-mini"), tools=[word_count],
               system_prompt="Tighten drafts and report their word count.")
lead = Agent(chat_generator=OpenAIChatGenerator(model="gpt-5.4-mini"),
             tools=[AgentTool(agent=editor, name="editor", description="Shortens a draft and counts words")],
             system_prompt="Delegate editing to the editor, then summarize the result.")

result = lead.run(messages=[ChatMessage.from_user("Shorten: 'We are very, very happy to announce the release.'")])
print(result["last_message"].text)
```

### Common pitfalls

- The package is `haystack-ai`; Haystack 1.x (`farm-haystack`) is end of life.
- `OpenAIChatGenerator` reads `OPENAI_API_KEY` from the environment.
- Optional features raise an ImportError that names the missing dependency to install (for example `pypdf`).
- MCP tools need the separate `mcp-haystack` package.
- 3.0 removed `ToolInvoker`, `AsyncPipeline` and the legacy non-chat generators, and moved HITL to `haystack.hooks.human_in_the_loop`; follow the migration guide.
- Anonymous telemetry is on by default; set `HAYSTACK_TELEMETRY_ENABLED=False` to opt out.

Official quickstart: https://docs.haystack.deepset.ai/docs/installation

## Pros

- Explicit, traceable data flow: retrieval, routing, memory and generation are separate components you wire yourself. ([source](https://github.com/deepset-ai/haystack))
- Breakpoints and editable JSON snapshots make it possible to debug and resume long pipelines. ([source](https://docs.haystack.deepset.ai/docs/pipeline-breakpoints))
- Tool-level human review with confirm, reject and modify options and pluggable ask policies. ([source](https://docs.haystack.deepset.ai/docs/human-in-the-loop))
- MCP works in both directions: MCPTool consumes servers and Hayhooks exposes pipelines as an MCP server. ([source](https://docs.haystack.deepset.ai/docs/hayhooks))
- Specialist agents can be serialized with the coordinator to YAML and loaded back. ([source](https://docs.haystack.deepset.ai/docs/multi-agent-systems))

## Cons

- Version 3.0 brought breaking changes: ToolInvoker, AsyncPipeline and the legacy generators were removed and HITL APIs moved. ([source](https://github.com/deepset-ai/haystack/releases/tag/v3.0.0))
- Agent-level breakpoints were removed in 3.0, so execution can no longer pause and resume inside an Agent. ([source](https://github.com/deepset-ai/haystack/releases/tag/v3.0.0))
- Anonymous usage telemetry is enabled by default and must be switched off explicitly. ([source](https://docs.haystack.deepset.ai/docs/telemetry))
- MCP support is not in the core package; it requires the separate mcp-haystack integration. ([source](https://docs.haystack.deepset.ai/docs/mcptool))
- Built-in human confirmation UIs are console prompts; web or chat UIs need a custom strategy or UI. ([source](https://docs.haystack.deepset.ai/docs/human-in-the-loop))

## Alternatives

- [LlamaIndex](https://multiagentguide.top/tools/llamaindex.md)
- [LangChain](https://multiagentguide.top/tools/langchain.md)
- [LangGraph](https://multiagentguide.top/tools/langgraph.md)
- [Semantic Kernel](https://multiagentguide.top/tools/semantic-kernel.md)
- [Pydantic AI](https://multiagentguide.top/tools/pydantic-ai.md)

## FAQ

### Does Haystack support MCP?

Yes. MCPTool and MCPToolset from the mcp-haystack integration connect agents to MCP servers over Streamable HTTP or stdio, and Hayhooks can serve Haystack pipelines and agents as an MCP server. A2A and AG-UI support were not found.

### Is Haystack free?

The framework is Apache-2.0. deepset also sells the Haystack Enterprise Platform (managed or self-hosted) and Haystack Enterprise Starter support, with a free Studio tier and custom enterprise pricing on its pricing page.

### How does Haystack build multi-agent systems?

A coordinator Agent receives specialist Agents wrapped with AgentTool as tools; it sends each specialist a task and gets back only the final reply.

### Can a human approve Haystack agent actions?

Yes. A ConfirmationHook on the before_tool hook point lets a person confirm, reject or modify each tool call, with policies that decide when to ask.

### What changed in Haystack 3.0?

The Agent gained a hooks system and owns tool execution; ToolInvoker, AsyncPipeline and legacy generators were removed, HITL moved to haystack.hooks.human_in_the_loop, and agent-level breakpoints were dropped.

## Sources

- [deepset-ai/haystack repository (README)](https://github.com/deepset-ai/haystack)
- [Haystack v3.0.0 release notes](https://github.com/deepset-ai/haystack/releases/tag/v3.0.0)
- [Haystack documentation](https://docs.haystack.deepset.ai/docs/intro)
- [Installation](https://docs.haystack.deepset.ai/docs/installation)
- [Agent component](https://docs.haystack.deepset.ai/docs/agent)
- [Agent hooks](https://docs.haystack.deepset.ai/docs/hooks)
- [State](https://docs.haystack.deepset.ai/docs/state)
- [Multi-agent systems](https://docs.haystack.deepset.ai/docs/multi-agent-systems)
- [AgentTool](https://docs.haystack.deepset.ai/docs/agenttool)
- [Human in the loop](https://docs.haystack.deepset.ai/docs/human-in-the-loop)
- [MCPTool](https://docs.haystack.deepset.ai/docs/mcptool)
- [MCPToolset](https://docs.haystack.deepset.ai/docs/mcptoolset)
- [Pipeline loops](https://docs.haystack.deepset.ai/docs/pipeline-loops)
- [Pipeline breakpoints](https://docs.haystack.deepset.ai/docs/pipeline-breakpoints)
- [Hayhooks](https://docs.haystack.deepset.ai/docs/hayhooks)
- [Telemetry](https://docs.haystack.deepset.ai/docs/telemetry)
- [Migration guide](https://docs.haystack.deepset.ai/docs/migration)
- [deepset pricing](https://www.deepset.ai/pricing)

## Unknown fields

protocols.a2a and protocols.agui are unknown: the full docs llms.txt, README, GitHub code search in haystack, haystack-core-integrations and hayhooks, and issue search found no official A2A or AG-UI support, and the AG-UI integration list does not include Haystack.

---

Data as of 2026-09-30. Not affiliated with listed projects. HTML version: https://multiagentguide.top/tools/haystack
