How deepset-ai/haystack works
Haystack is a Python framework for composing LLM applications from reusable components and agent workflows. A representative RAG flow accepts documents or a query, prepares and embeds content, stores and retrieves relevant documents, then builds a prompt and generates an answer. The Pipeline orchestrates component execution; agents extend workflows with tools and lifecycle hooks. The README documents broader routing, ranking, evaluation, multimodal, and async capabilities. Some subsystem links below are README-level descriptions rather than inspected call sites.
Main entry points: pipeline.py Pipeline · agent.py Agent · openai.py Chat Generators · component.py Component Runtime
Components 19
Orchestration
- Pipeline
haystack/core/pipeline/pipeline.py - Component Runtime
haystack/core/component/component.py
Document Ingestion
- Document Converters
haystack/components/converters/json.py - Preprocessors
haystack/components/preprocessors - Embedders
haystack/components/embedders - Document Store
haystack/document_stores/in_memory/document_store.py
Retrieval Context
- Query Expansion
haystack/components/query/query_expander.py - Retrievers
haystack/components/retrievers - Rankers
haystack/components/rankers - Routers
haystack/components/routers
Generation Agents
- Prompt Builder
haystack/components/builders/prompt_builder.py - Chat Generators
haystack/components/generators/chat/openai.py - Answer Builder
haystack/components/builders/answer_builder.py - Agent
haystack/components/agents/agent.py - Tools
haystack/tools/tool.py - Agent Hooks
haystack/hooks
Evaluation Operations
- Evaluators
haystack/components/evaluators - Telemetry
haystack/telemetry
Other components
- Application User
Connections 20
- Application User → Pipeline: configures and runs
- Pipeline → Component Runtime: executes components
haystack/core/pipeline/pipeline.py - Pipeline → Document Converters: orchestrates ingestion
- Pipeline → Preprocessors: orchestrates preparation
- Pipeline → Embedders: orchestrates embedding
- Pipeline → Document Store: orchestrates storage
- Pipeline → Query Expansion: orchestrates retrieval
- Pipeline → Retrievers: orchestrates retrieval
haystack/core/pipeline/pipeline.py - Pipeline → Rankers: orchestrates ranking
- Pipeline → Routers: orchestrates routing
- Pipeline → Prompt Builder: orchestrates prompting
haystack/core/pipeline/pipeline.py - Pipeline → Chat Generators: orchestrates generation
- Pipeline → Answer Builder: orchestrates answers
haystack/core/pipeline/pipeline.py - Pipeline → Evaluators: orchestrates evaluation
- Agent → Tools: invokes tools
- Agent → Agent Hooks: runs lifecycle hooks
- Pipeline → Agent: supports workflows
- Application User → Agent: starts workflow
- Pipeline → Telemetry: emits telemetry
haystack/core/pipeline/pipeline.py - Chat Generators → Application User: returns generated output