# Repository Briefing: deepset-ai/haystack
> Source: https://repoforai.com/repo/deepset-ai/haystack (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/deepset-ai/haystack
- **Official Docs / Website**: https://haystack.deepset.ai
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A+ (98/100 · Maintenance 35/35 · Adoption 23/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v3.5.0 (2026-11-10) — https://github.com/deepset-ai/haystack/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, Self-Hosted, API
- **Momentum**: 27,168 ★ total (+7 24h / +53 7d) · 3,541 forks
- **Topics**: `semantic-search`, `information-retrieval`, `ai`, `python`, `large-language-models`, `generative-ai`, `llm`, `rag`, `retrieval-augmented-generation`, `agents`, `orchestration`, `agent-framework`
- **When to Use**: Best for: Teams building RAG, search, or tool-using applications that need to tune retrieval and routing independently and retain control over model providers and deployment. Skip if: A short, stable provider SDK flow is sufficient, or you need a ready-to-run API with governance and access controls rather than a library to embed.

## Overview
```text
### Architecture & Core Mechanics
Haystack is an embeddable Python SDK with two execution abstractions. Pipeline connects components through named inputs and outputs, with branches and loops when the next step depends on a result. This makes it possible to keep ingestion and indexing separate from the query path, where retrieval, filtering, ranking, and generation can be tested independently. Agent handles workflows where the model selects tools at runtime.

The `haystack-ai` distribution targets Python 3.11 or newer and uses Hatchling for builds. Core code lives in `haystack/`, with sibling `test/`, `e2e/`, and `examples/` directories. The component interface is the main extension boundary: custom code can adapt a converter, retriever, or model backend without replacing the workflow. The interface makes substitution possible, but does not guarantee equivalent outputs or behavior across backends.

### Key Capabilities & Differentiators
Haystack covers indexing, retrieval, memory, generation, and evaluation. It supports synchronous and asynchronous pipeline execution and token streaming. Components can connect to hosted providers including OpenAI, Anthropic, Mistral, Google, Azure OpenAI, and AWS Bedrock, as well as local models. Text and image routing components in v3.5.0 provide concrete entry points for multimodal workflows.

Agents can run tool calls concurrently. Lifecycle hooks such as `before_llm`, `before_tool`, and `on_exit` let application code inspect or intervene at defined points. Built-in tracking of `step_count`, `token_usage`, and tool calls helps distinguish repeated model steps from tool fan-out. SkillToolset adds descriptions to the context only when needed. These features provide hooks and signals for policy and monitoring; they are not, by themselves, a security boundary or an operations stack.

### Trade-offs & Limitations
Against a hand-written flow using provider SDKs, Haystack earns its place when teams need to test retrieval separately, change ranking without rewriting prompt assembly, or share routing logic across applications. For a stable retrieve-and-generate endpoint, a short Python implementation may be easier to own. Swapping a component also does not eliminate the need to validate score distributions, output schemas, or tool-call behavior.

Async execution overlaps I/O, but concurrency can amplify rate-limit pressure and the load on downstream tools. Set budgets for loops and tool fan-out, and exercise timeout and partial-failure paths before rollout. Compared with the separately offered Haystack Enterprise Platform, the Apache-2.0 SDK gives teams control over where and how they run workloads, but does not supply the platform's packaged governance, access controls, and operational tooling.

### Hardware & Deployment Guide
Start with `pip install haystack-ai` on Python 3.11 or newer. Docker images are available and the repository contains `docker/`. The core is a library: to expose a self-hosted API, plan for a serving layer and its authentication, secrets, monitoring, and traffic controls. Hosted inference reduces local model-serving requirements but introduces network, quota, and data-handling constraints. Offline use requires locally available models and backends, an inventory of outbound integrations, and a telemetry decision.

In v3.5.0, `OpenAIDecisionsTextRouter` sends text to named outputs by label via the OpenAI Decisions API, adding a provider-specific option that should not be treated as offline-capable. The v2.31.1 security release raised the minimum versions to `anyio>=4.14.2` and `certifi>=2026.10.19`. Check the resolved versions in the actual deployment image, especially when an existing lockfile pins transitive dependencies.
```

## Key Capabilities
```text
- Execution: Pipeline supports synchronous and asynchronous runs, conditional branches, loops, and token streaming.
- Context assembly: Retrieval, ranking, filtering, and routing can be separate components so their effects can be tested independently.
- Agent policy: `before_llm`, `before_tool`, and `on_exit` provide extension points around model calls, tool calls, and agent exit.
- Agent visibility: Built-in tracking covers `step_count`, `token_usage`, and tool calls; SkillToolset adds skill descriptions to context on demand.
- Provider integration: Component interfaces support hosted models such as OpenAI, Anthropic, and AWS Bedrock alongside local models.
- Release milestone: v3.5.0 adds OpenAI Decisions API routing, including `OpenAIDecisionsTextRouter` for dispatch by label.
```

## Quick Start / Clone
```bash
pip install haystack-ai
```
