Capability · Framework — agents

Haystack Agents

Haystack Agents is the agent layer of Haystack 2.x, deepset's open-source LLM framework. Unlike frameworks that bolt agents on, Haystack treats an Agent as just another component in a declarative pipeline — so you mix retrieval, rerankers, tools, and agent loops in the same YAML graph. Strong fit for teams that already run Haystack for RAG and want tool use without switching stacks.

Framework facts

Category
agents
Language
Python
License
Apache-2.0
Repository
https://github.com/deepset-ai/haystack

Install

pip install haystack-ai

Quickstart

from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.tools import tool

@tool
def search_docs(query: str) -> str:
    return f'docs for {query}'

agent = Agent(
    chat_generator=OpenAIChatGenerator(model='gpt-4o'),
    tools=[search_docs],
)
result = agent.run(messages=[{'role': 'user', 'content': 'find the latest refund policy'}])

Alternatives

  • LangGraph — state-machine agents
  • CrewAI — multi-agent orchestration
  • Semantic Kernel — .NET-first

Frequently asked questions

How is this different from a LangChain agent?

Haystack Agents live inside a pipeline graph, so the same YAML can express a RAG + agent hybrid end-to-end. LangChain's equivalent is LangGraph, which is more flexible but requires more wiring.

Does Haystack Agents support multi-agent?

Yes — you can compose multiple Agent components in a pipeline and pass messages between them, though CrewAI / AutoGen have richer multi-agent primitives out of the box.

Sources

  1. Haystack Agent docs — accessed 2026-04-20
  2. Haystack GitHub — accessed 2026-04-20