haystack
AGENTS.md27k starsChanged 6 months agoApache-2.0View on GitHub
Haystack uses Hatch for environment and dependency management. Do not run python or pip directly. Before running code on this project, you must be able to run hatch --version and get a correct output. If not, ask the user where Hatch is or if they want to install it. For installation instructions, refer to https://hatch.pypa.io/latest/install/#installation. hatch -e test run python SCRIPT.py hatch -e test shell uv pip install PACKAGE hatch env prune Tests run via Hatch and support pytest arguments.
- Reads credentials
- Installs packages
Trending
Steady talk.about the whole repository
Who's talking about deepset-ai/haystack
- A Hacker News story“Haystack 1.0 – open-source NLP framework to build NLProc back end applications”Hacker News · Dec 9, 2021 · 109 points
- A Hacker News story“Build with LLMs for production with Haystack – has 10k stars on GitHub”Hacker News · Jul 17, 2023 · 5 points
- A Hacker News story“Show HN: Haystack – Production-Ready LLM Framework”Hacker News · Jul 11, 2023 · 4 points
- deepset-ai/haystack-demos“Updates ui.utils.query to support Haystack 1.14”GitHub · Mar 19, 2023 · 4 reactions
- weaviate/weaviate“How to get ALL records of an index? (above the `QUERY_MAXIMUM_RESULTS`)”GitHub · May 7, 2022 · 4 reactions
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on GitHub, Hacker News and Bluesky (31 times).
On GitHub · 23
- Mar 19, 2023Updates ui.utils.query to support Haystack 1.14 — deepset-ai/haystack-demos4 reactions · 1 comment
- May 7, 2022How to get ALL records of an index? (above the `QUERY_MAXIMUM_RESULTS`) — weaviate/weaviate4 reactions · 6 comments
- Nov 24, 2023python311Packages.pydantic: 1.10.12 -> 2.3.0 — NixOS/nixpkgs3 reactions · 15 comments
- Oct 1, 2023Support for OpenRouter — deepset-ai/haystack-core-integrations3 reactions · 15 comments
- Aug 28, 2024feat: Implement `AsyncPipeline` — deepset-ai/haystack-experimental2 reactions · 2 comments
18 more on GitHub
- Apr 12, 2023Auto-detected model language — deepset-ai/haystack-demos2 reactions · 2 comments
- Nov 2, 2022add support for haystack — langchain-ai/langchain2 reactions · 21 comments
- Oct 15, 2026Cookbook proposal: application-owned tool approval with ConfirmationHook (offline) — deepset-ai/haystack-cookbook1 reaction
- Aug 26, 2026feat: Add `AnthropicTokenCounter` to anthropic integration — deepset-ai/haystack-core-integrations1 reaction
- Mar 20, 2026feat: Add new `LibreOfficeFileConverter` integration — deepset-ai/haystack-core-integrations1 reaction · 3 comments
- Feb 26, 2026ci: use hatch action — deepset-ai/haystack-core-integrations1 reaction
- Feb 25, 2026chore(deps): bump the gha group across 1 directory with 5 updates — traceloop/openllmetry1 reaction · 2 comments
- Jan 23, 2026deepset-cloud-sdk is incompatible with pyrate-limiter>=4.0.0 — deepset-ai/deepset-cloud-sdk1 reaction
- Jan 18, 2026chore(deps-dev): bump the gha group across 1 directory with 4 updates — traceloop/openllmetry1 reaction · 4 comments
- Jan 16, 2026fix: `CometAPIChatGenerator` - handle `delta` set to `None` — deepset-ai/haystack-core-integrations1 reaction
- Jan 15, 2026chore(deps-dev): bump the gha group in /packages/opentelemetry-instrumentation-haystack with 3 updates — traceloop/openllmetry1 reaction · 2 comments
- Jan 15, 2026Pin numpy<2.4 in tutorial 35 — deepset-ai/haystack-tutorials1 reaction · 1 comment
- Jan 9, 2026chore!: fastembed - drop Python 3.9 and use X|Y typing — deepset-ai/haystack-core-integrations1 reaction
- Nov 29, 2025📈 Competitive Analysis Dashboard & Market Positioning — gfunkmaster/skills-integrate-mcp-with-copilot1 reaction
- Aug 18, 2025chore(deps-dev): bump the gha group across 1 directory with 6 updates — traceloop/openllmetry1 reaction · 2 comments
- Apr 8, 2025Document Store - closing resources — deepset-ai/haystack-core-integrations1 reaction · 11 comments
- Jan 28, 2025haystack integration — MinishLab/vicinity1 reaction
- Mar 21, 2022Support for custom retrievers: common base type for `EvaluateRetrieval`'s `retriever` param — beir-cellar/beir1 reaction · 3 comments
On Hacker News · 7
- Dec 9, 2021Haystack 1.0 – open-source NLP framework to build NLProc back end applications109 points · 34 comments
- Jul 17, 2023Build with LLMs for production with Haystack – has 10k stars on GitHub5 points · 1 comment
- Jul 11, 2023Show HN: Haystack – Production-Ready LLM Framework4 points
- Sep 16, 2021Deepset's Haystack Now Supports Ray.io and ANN in OpenSearch3 points
- Mar 29, 2023Build LLM-Based Agents Yourself with Open Source2 points
2 more on Hacker News
- Aug 26, 2024The open source LLM framework Haystack is trending on GitHub1 point
- Apr 28, 2023Show HN: Haystack NLP Now Supports GPT4 with PromptNode and Agent1 point
On Bluesky · 1
- Sep 14, 2025📦 deepset-ai / haystack ⭐ 22,263 (+30) 🗒 Python AI orchestration framework to build customizable, production-ready LLM applications.… — @github-trending.bsky.social2 likes and reposts
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- docs-website/AGENTS.mdAGENTS.md
- test/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs-website/CLAUDE.mdCLAUDE.md
- test/CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
22 rules. About 0 are common, 5 are distinctive, and 17 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 7
Do not run python or pip directly.
- Very specific: line 9
Before running code on this project, you must be able to run hatch --version and get a correct output.
- Distinctive: line 11
If not, ask the user where Hatch is or if they want to install it.
- Very specific: line 33
Prefer running tests on a specific module or using -k, since the full suite is large.
- Distinctive: line 57
Every user-facing PR (not docs, not CI) must include a release note:
- Very specific: line 83
Keep public signatures explicit and compatible: optional params keyword-only after * and appended rather than inserted, mirrored …
- Very specific: line 84
Create API clients and load models in warm_up(), not __init__.
- Very specific: line 88
Read live Haystack State resources via state.data.get(...) or state.data[...] — avoids deep-copy bugs
- Very specific: line 89
Prefer existing haystack/core/pipeline APIs or inline logic — avoid duplicate or one-off public APIs
- Distinctive: line 94
Keep inline comments and private-helper docs to what is non-obvious — remove restatements, keep durable caveats and rationale
- Very specific: line 95
Keep docstrings current with signatures and behavior, in the existing Haystack style: each public :param by meaning, default, and …
- Very specific: line 96
Keep doc examples minimal, runnable, and local: default constructors with required env vars like OPENAI_API_KEY noted nearby, only the …
- Very specific: line 97
When behavior, fields, or names change, update every surface in the same PR: haystack/components/ docstrings and examples, …
- Distinctive: line 101
Use keyword args for multi-parameter calls — improves readability and prevents mix-ups
- Very specific: line 102
Keep lint suppressions exact and current — a # noqa: PLR0915 only while the code needs it
- Very specific: line 104
Use {placeholder} logger templates with kwargs — preserves structured logs and avoids eager formatting
- Distinctive: line 111
Keep union aliases non-redundant and concept-named — include base types only when subclasses inherit
- Very specific: line 112
Use T | None, not Optional[T], in annotations and casts — keeps typing concise
- Very specific: line 117
Import via public APIs in the narrowest clear form (keep module imports like import httpx when namespaces matter).
- Very specific: line 118
Use top-level absolute haystack...
- Very specific: line 119
Use LazyImport only for optional third-party deps — otherwise import directly
- Very specific: line 132
Update pyproject.toml for new package APIs — declare deps and minimum versions used
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Haystack Guidelines for AI Agents
Environment
Haystack uses Hatch for environment and dependency management.
Do not run python or pip directly.
Before running code on this project, you must be able to run hatch --version and get a correct output.
If not, ask the user where Hatch is or if they want to install it. For installation instructions, refer to https://hatch.pypa.io/latest/install/#installation.
Run scripts with test dependencies
hatch -e test run python SCRIPT.py
Open a shell with test dependencies
hatch -e test shell
Install temporary dependencies (for experiments only)
uv pip install PACKAGE
Delete the environment
hatch env prune
Tests
Tests run via Hatch and support pytest arguments.
Prefer running tests on a specific module or using -k, since the full suite is large.
Run unit tests
hatch run test:unit
Run integration tests
hatch run test:integration
Quality Checks
Type checking with mypy
hatch run test:types
Type checking targets Python 3.12, above the 3.10 floor in requires-python, because numpy's stubs use PEP 695 type statements that mypy rejects below 3.12. So mypy will not catch code that breaks on 3.10; the unit test matrix runs on 3.10 and covers that.
To fix type issues, avoid type: ignore, casts, or assertions when possible. If they are necessary, explain why.
Format and lint
hatch run fmt
Release Notes
Every user-facing PR (not docs, not CI) must include a release note:
hatch run release-note SHORT_DESCRIPTION
Edit the generated file in releasenotes/notes/. Release notes use reStructuredText formatting; see the release notes section in CONTRIBUTING.md for details.
Pull Requests
Community contributors can have only one open pull request at a time in this repository. Before opening a PR on the user's behalf, check whether they already have one open (gh pr list --author @me); if so, tell them instead of opening another.
In addition, there are rules inferred from previous code reviews. Follow them like a reviewer's note: they encode reasons, not ceremony, so when a rule genuinely does not fit the change at hand, say why rather than contorting the code to satisfy it.
Also see directory-specific guidelines:
- docs-website/AGENTS.md
- docs-website/docs/AGENTS.md
- haystack/hooks/compaction/AGENTS.md
- releasenotes/notes/AGENTS.md
- test/AGENTS.md
API Design
- Target the 3.0 API:
ToolInvoker,AsyncPipeline, and non-chat generators were removed — letAgentown tool calls, usePipeline.run()/Pipeline.run_async(), and use ChatGenerators likeOpenAIChatGenerator - Serialize with the Haystack helpers (
component_to_dict,default_from_dict): infrom_dict()pass only the fields present to__init__()so defaults stay centralized, shallow-copy the payload instead ofdeepcopy(), and keep tools/toolsets nested underdata— preserves wire compatibility and round-trip fidelity - Keep public signatures explicit and compatible: optional params keyword-only after
*and appended rather than inserted, mirrored constructor params spelled out instead of*args/**kwargs, and chat generators keeping therun(messages, *, streaming_callback, generation_kwargs, tools)order — avoids breaking positional callers - Create API clients and load models in
warm_up(), not__init__; implementwarm_up()only for real setup and make it idempotent — keeps components constructible and serializable without credentials or network - Implement
run_asynconly when there is a real async execution path —Pipeline.run_async()already falls back toasyncio.to_thread(component.run, ...)when it is missing; where it exists, keeprun_async/warm_up_async/close_asyncgenuinely async with separate async state and hooks, and share sync/async logic through private helpers — prevents event-loop blocking and sync/async drift - Pass explicit
required_variablesfor optional prompt vars — avoids requiring optional inputs - Subclass
Toolsetonly when inherited collection APIs match — prefer composition or raiseNotImplementedError - Read live Haystack
Stateresources viastate.data.get(...)orstate.data[...]— avoids deep-copy bugs - Prefer existing
haystack/core/pipelineAPIs or inline logic — avoid duplicate or one-off public APIs - Reuse splitter chunk metadata in
haystack/components/preprocessors/— keep traceability fields likepage_number,source_id,header,parent_headers, and split positions; add new keys only for existing downstream contracts
Documentation
- Keep inline comments and private-helper docs to what is non-obvious — remove restatements, keep durable caveats and rationale
- Keep docstrings current with signatures and behavior, in the existing Haystack style: each public
:paramby meaning, default, and constraints;:returns:contracts; exceptions in the existing:raises ValueError:style; aliases likeToolsTypereflected — stale docs mislead users and assistants - Keep doc examples minimal, runnable, and local: default constructors with required env vars like
OPENAI_API_KEYnoted nearby, only the imports the snippet uses, no restated defaults (name a model only for model-specific behavior), expected output as comments, generally# >> ... - When behavior, fields, or names change, update every surface in the same PR:
haystack/components/docstrings and examples,docs-website/docs/plus the currentversioned_docs/version-*/page (e.g.concepts/data-classes.mdx), andexperimentalwording,pydocIDs, and generated markdown filenames when promoting features
Code Style
- Use keyword args for multi-parameter calls — improves readability and prevents mix-ups
- Keep lint suppressions exact and current — a
# noqa: PLR0915only while the code needs it - Scope diffs to the stated goal and leave them clean: no unrelated refactors or formatting, no stray
print(), no filename-only header comments, no unused private helpers or redundant branches, no args that only restate callee defaults - Use
{placeholder}logger templates with kwargs — preserves structured logs and avoids eager formatting - Prefix internal helpers and module-level constants with
_and keep private constants local; never name locals after imported functions, decorators, or utilities — clarifies API boundaries and avoids shadowing
Type System
- Fix types at the source; where a suppression is unavoidable use a coded
# type: ignore[...]with a nearby why-safe comment, and add@overloadonly for real API variants - Resolve callable annotations with
typing.get_type_hints()— avoids bugs from raw or stringinspect.signature()annotations - Keep union aliases non-redundant and concept-named — include base types only when subclasses inherit
- Use
T | None, notOptional[T], in annotations and casts — keeps typing concise - Annotate helper params broadly and accurately —
type | types.UnionTypefor class-or-PEP-604 inputs,Anyfor arbitrary typing objects
Imports
- Import via public APIs in the narrowest clear form (keep module imports like
import httpxwhen namespaces matter); keep only used imports plus deliberate compatibility re-exports - Use top-level absolute
haystack...imports inhaystack/components/andhaystack/core/component/*.py— keeps component dependencies traceable - Use
LazyImportonly for optional third-party deps — otherwise import directly
Config
- Pass
allowed_modules=or setHAYSTACK_DESERIALIZATION_ALLOWLISTfor YAML loads — never widenhaystack/core/serialization_security.pyallowlists in library code
Testing
- Centralize
DocumentStoretests inhaystack/testing/document_store.pymixins — useDocumentStoreBaseTestsas the minimum suite and compose capability mixins intoDocumentStoreBaseExtendedTests; add explicit integration skips only for unsupported backend features.
General
- Define package exports in
__init__.pyvia__all__; avoid__all__in implementation modules — keeps public APIs intentional - Update
pyproject.tomlfor new package APIs — declare deps and minimum versions used
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

