haystack
FreeNo executable scriptsNot checkedHaystack is an open-source Python framework by deepset for building RAG pipelines, search systems and LLM agents from composable components (document stores…
by TerminalSkills★ 221 GitHub starsAbout this skill
Haystack — LLM Application Framework by deepset
Overview
Haystack models an application as a Pipeline of components connected by typed inputs and outputs. Typical building blocks are an InMemoryDocumentStore (or a vector database integration), embedders, retrievers, a ChatPromptBuilder, and a chat generator such as OpenAIChatGenerator. Since 3.0 (2026) the framework is leaner: the legacy text Generators are removed in favour of Chat Generators, AsyncPipeline is merged into Pipeline, and many local-model components live in separately installed integration packages. Code written for 2.x commonly breaks on these points, see the migration notes below.
Instructions
Install
pip install haystack-ai
export OPENAI_API_KEY=... # for the OpenAI components
export HAYSTACK_TELEMETRY_ENABLED=False # optional: disable anonymous telemetry
Integrations are separate packages (pip install qdrant-haystack, sentence-transformers-haystack, transformers-haystack, ...) imported from haystack_integrations.*.
Build a pipeline
- Create a document store and an indexing
Pipeline(converter ->DocumentSplitter-> document embedder ->DocumentWriter). - Create a query
Pipeline: text embedder -> retriever ->ChatPromptBuilder-> chat generator. Connect withpipeline.connect("sender.output", "receiver.input"). - Run with a dict keyed by component name:
pipeline.run({"text_embedder": {"text": q}, "prompt_builder": {"question": q}}). Useinclude_outputs_from={"retriever"}to see intermediate results. ChatPromptBuildertakes a list ofChatMessageobjects with Jinja2 templates; the generator's output isresult["llm"]["replies"][0], aChatMessagewhose text is.text.
Custom components
Decorate a class with @component, declare outputs with @component.output_types(...), and implement run. Build the class in a module you control; the loader needs to trust it (see Guidelines).
Agents
haystack.components.agents.Agent(chat_generator=..., tools=[...], system_prompt=...) runs the tool loop itself (the standalone ToolInvoker is gone in 3.x). Define tools with from haystack.tools import tool on a typed, documented function. Behavior hooks (before_tool, after_tool, on_exit ...) go in hooks={...}.
Save, test, stream
pipeline.dumps()/Pipeline.loads(yaml_text), anddump/loadfor files.- For tests without an API key, use
MockChatGenerator,MockTextEmbedderandMockDocumentEmbedder. - Streaming: pass
streaming_callback=print_streaming_chunk(fromhaystack.components.generators.utils) to the chat generator. - Async serving:
await pipeline.run_async(data)on the samePipelineclass.
Migrating from 2.x to 3.x
| 2.x | 3.x |
|---|---|
OpenAIGenerator, HuggingFaceAPIGenerator |
OpenAIChatGenerator etc.; reply is a ChatMessage, use .text |
PromptBuilder with optional variables |
all template variables required; pass required_variables=None for the old behavior |
AsyncPipeline |
Pipeline (run_async, stream) |
from haystack.components.readers import ExtractiveReader |
transformers-haystack package, TransformersExtractiveReader |
SentenceTransformers*Embedder in core |
sentence-transformers-haystack package |
Agent confirmation_strategies |
ConfirmationHook registered under before_tool |
The full table is in MIGRATION.md of the repository.
Examples
Example 1: RAG over a handful of release notes
User request: "Index these notes and answer questions about them with OpenAI."
from haystack import Pipeline, Document
from haystack.components.embedders import OpenAIDocumentEmbedder, OpenAITextEmbedder
from haystack.components.writers import DocumentWriter
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack.components.builders import ChatPromptBuilder
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack.document_stores.in_memory import InMemoryDocumentStore
store = InMemoryDocumentStore()
indexing = Pipeline()
indexing.add_component("embedder", OpenAIDocumentEmbedder())
indexing.add_component("writer", DocumentWriter(document_store=store))
indexing.connect("embedder.documents", "writer.documents")
indexing.run({"embedder": {"documents": [
Document(content="Release 3.0 removed OpenAIGenerator in favour of OpenAIChatGenerator."),
Document(content="Release 3.0 merged AsyncPipeline into Pipeline."),
]}})
template = [ChatMessage.from_user(
"Answer from the documents only.\n"
"{% for doc in documents %}- {{ doc.content }}\n{% endfor %}\nQuestion: {{ question }}")]
rag = Pipeline()
rag.add_component("embedder", OpenAITextEmbedder())
rag.add_component("retriever", InMemoryEmbeddingRetriever(document_store=store, top_k=2))
rag.add_component("prompt_builder", ChatPromptBuilder(template=template))
rag.add_component(
Install haystack in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the haystack skill do?
Haystack is an open-source Python framework by deepset for building RAG pipelines, search systems and LLM agents from composable components (document stores, retrievers, prompt builders, chat generators, agents). Use when the user wants to build or debug a Haystack pipeline, write a custom component, index documents for retrieval, build an agent with tools, or migrate code from Haystack 2.x to 3.x.
How do I install the haystack skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the haystack skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
by AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
by Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
by Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
by Anthropic