Haystack Integration
Native ZespanHaystackTracer for Haystack pipelines. Pass the tracer to pipeline.run() and every component execution, LLM call, and pipeline latency is captured — Python only.
Haystack (by deepset) is an open-source Python framework for building LLM-powered search and RAG pipelines with composable, production-ready components.

Getting Started
Install the SDK
Install zespan alongside haystack-ai.
pip install zespan haystack-aiAdd ZespanHaystackTracer to pipeline.run()
Initialize Zespan, create ZespanHaystackTracer, and pass it to your pipeline's run call. Your pipeline definition stays unchanged.
from zespan.sdk import Zespan
from zespan.integrations.haystack import ZespanHaystackTracer
from haystack import Pipeline
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
zespan = Zespan(api_key="your-api-key")
tracer = ZespanHaystackTracer(zespan)
pipeline = Pipeline()
pipeline.add_component("prompt_builder", PromptBuilder(template="Answer: {{question}}"))
pipeline.add_component("generator", OpenAIGenerator(model="gpt-4o"))
pipeline.connect("prompt_builder", "generator")
result = pipeline.run(
{"prompt_builder": {"question": "What is Haystack?"}},
tracer=tracer,
)View traces in Zespan
Open Trace Explorer. Each pipeline run appears as a trace with spans for every component — prompt builders, generators, retrievers, and rankers.
What's captured automatically
- Component execution spans: every pipeline component as a named span
- LLM call tracing: token usage and cost attributed per generator component
- Pipeline latency: total run time plus per-component breakdown
- RAG pipeline support: retriever + generator spans linked in one trace
- Python only: native Python tracer passed directly to pipeline.run()
FAQ
Do I need to modify my pipeline definition?
No. Add ZespanHaystackTracer only to the pipeline.run() call. Your Pipeline, component definitions, and connections stay unchanged.
Does this work with Haystack v2?
Yes. ZespanHaystackTracer targets Haystack v2's pipeline tracing interface.
Start for free — 10K traces/month, no card needed
Haystack integration works on all plans including the free tier.