2 min

Haystack Pipelines Treat Every Query as New

Nikhil Kumar

Updated on :

Haystack pipelines

Haystack's pipeline architecture is one of the cleanest in the RAG framework space. You compose retrieval, processing, and generation steps as modular nodes in a directed graph. Each node does one thing well—retrieve documents, rerank results, generate answers—and the pipeline chains them together. For building sophisticated retrieval systems, the composability is a genuine strength.

But every pipeline run is stateless. When a user sends a query, the pipeline retrieves documents, processes them, generates an answer, and completes. The next query starts from scratch. The pipeline doesn't know that this user asked a related question five minutes ago. It doesn't know the user rejected the first answer and wants a different approach. Each query enters the pipeline as if it's the first one ever asked.

What Haystack Gets Right

The pipeline abstraction is powerful. You can mix and match retrievers (BM25, dense, hybrid), add rerankers, plug in custom preprocessing nodes, and route queries through different paths based on classification. The v2 architecture is particularly well-designed—components are Python classes with clear interfaces, and pipelines are built declaratively.

Haystack also handles document stores well. It integrates with Elasticsearch, OpenSearch, Weaviate, Pinecone, Qdrant, and others. You can index large document collections and retrieve from them efficiently. For knowledge-base applications—FAQ systems, documentation search, support article retrieval—Haystack is a strong choice.

Where Statefulness Breaks Down

Haystack pipelines are designed for query-response pairs, not conversations. The framework doesn't maintain context between pipeline runs. If a user asks "What are the pricing tiers?" and then follows up with "What about the enterprise tier?", the second query enters the pipeline with no reference to the first. The retriever doesn't know to narrow its search based on the prior conversation.

You can work around this by injecting conversation history into the query. Pass the prior messages alongside the new query, and the pipeline processes them together. But this is manual context management, not memory. You're responsible for deciding what history to include, how to format it, and when to truncate it.

Cross-session persistence doesn't exist. When the user returns tomorrow, there's no mechanism to load their prior interactions, preferences, or the context that accumulated during previous sessions. The pipeline treats them as a brand-new user with a brand-new query. Why agent frameworks ship without real memory explains why RAG frameworks consistently make this tradeoff—they optimize for retrieval quality per query, not for user continuity across queries.

Retrieval Without Remembering

Haystack retrieves documents. It doesn't retrieve user context. There's a meaningful difference. Document retrieval answers "what information exists about this topic?" User context retrieval answers "what does this agent know about this specific person?" The first is a search problem. The second is a memory problem.

When you try to use Haystack for both, you end up bolting conversational context onto a document retrieval pipeline. It works partially—you can embed conversation fragments and retrieve them—but you lose temporal reasoning, preference evolution tracking, and the feedback loops that make memory improve over time. The pipeline retrieves what's semantically similar, not what's most important or most current for this user.

Self-improving retrieval is absent. If the pipeline returns irrelevant documents, there's no mechanism to learn from that failure. The same query will return the same results next time. Context windows are not memory covers why this static retrieval model creates compounding problems for agents that serve users repeatedly.

Pipelines Need a Memory Layer

Haystack solves document retrieval well. Memory solves user continuity. These are complementary, not competing. The strongest architecture uses Haystack for what it's built for—structured document retrieval—and adds a separate memory layer for what it isn't built for: persistent user context, temporal reasoning, and cross-session learning.

The pipeline becomes one input to the agent, not the only input. The agent queries Haystack for document-level knowledge and queries the memory layer for user-level context. Both inform the response, and the combination is more powerful than either alone.

FAQ

Can I add memory to a Haystack pipeline?

You can add custom nodes that query an external memory store and inject context into the pipeline. But Haystack itself provides no memory primitives. You're building the memory integration outside the framework and feeding results in.

Is Haystack v2 better at handling conversation context?

Haystack v2 is architecturally cleaner and more composable, but it's still a pipeline framework—each run is independent. The improvements focus on developer experience and component flexibility, not on cross-session persistence or user memory.