Skip to main content

Trace Haystack with Future AGI

Capture synchronous and asynchronous pipeline runs, component inputs and outputs, model usage, retrieval, and native agent/tool operations in Future AGI.

Install

Use Python 3.11–3.12 for this Haystack 3.4.1 example. The adapter also supports Python 3.10 with older Haystack versions, including 2.10.

pip install traceAI-haystack 'haystack-ai==3.4.1'

Set FI_API_KEY and FI_SECRET_KEY in your application's environment.

Configure and run

The existing HaystackInstrumentor().instrument(tracer_provider=..., config=...) entry point installs a single Haystack tracer. Do not combine it with another Haystack instrumentor or call haystack.tracing.enable_tracing() afterward: Haystack has one active tracer.

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from haystack import Document, Pipeline
from haystack.components.preprocessors import DocumentCleaner
from traceai_haystack import HaystackInstrumentor

provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="haystack-documents",
)
HaystackInstrumentor().instrument(tracer_provider=provider)

pipeline = Pipeline()
pipeline.add_component("clean", DocumentCleaner())
result = pipeline.run({
    "clean": {"documents": [Document(content="  Haystack   processes documents.  ")]}
})
print(result["clean"]["documents"][0].content)
provider.force_flush()

Open haystack-documents in Future AGI to inspect the Pipeline.run trace and its DocumentCleaner.run child span. For a short-lived process, flush the provider before exiting.

Haystack 3.x also supports await pipeline.run_async(data) and pipeline.run_async_generator(data) on the same pipeline. On Haystack 2.x, use haystack.AsyncPipeline for these methods. Fully consume or explicitly close asynchronous generators so their pipeline spans can finish.

Content and privacy

Content capture is opt-in. By default, the adapter follows HAYSTACK_CONTENT_TRACING_ENABLED (false unless enabled). Model names and token counts remain available when Haystack provides them, without recording prompts, replies, documents, tool arguments/results, embedding vectors, or error details.

To inspect content, explicitly enable it when instrumenting:

from fi_instrumentation import TraceConfig

HaystackInstrumentor().instrument(
    tracer_provider=provider,
    capture_content=True,
    config=TraceConfig(hide_embedding_vectors=True),
)

Choose one instrumentor configuration at startup; calling instrument() again does not reconfigure an already instrumented process. Call uninstrument() before changing the configuration. TraceConfig and the corresponding FI_HIDE_* settings take precedence over content capture. For example, TraceConfig(hide_inputs=True, hide_outputs=True) hides content even with capture_content=True.

Coverage

  • Pipelines emit one root span and one span per component invocation through Haystack's public Tracer/Span interface. No private execution hooks or component methods are patched.
  • Public pipeline entry points carry component metadata into that tracer, preserving configured embedding/reranker models and prompt templates that Haystack's native tags do not include. These metadata bindings do not create spans.
  • Generator components retain model, token, and message attributes; retrievers, rankers, and embedders retain their semantic attributes.
  • Native agent and tool spans are captured where the installed Haystack version emits them. Haystack 2.10 does not emit the agent/tool events available in 3.4.1.
  • Standalone component calls are captured only if the component itself emits native tracing. Put components in a pipeline to capture their execution automatically.
  • HaystackInstrumentor().uninstrument() restores the previous Haystack tracer and the public entry points owned by this instrumentor.

Metadata

Release files for traceAI-haystack 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-haystack 0.1.11
File Size Uploaded Provenance Actions
traceai_haystack-0.1.11.tar.gz 14.7 kB With provenance Details for traceai_haystack-0.1.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-haystack 0.1.11
File Interpreter ABI Platform Actions
traceai_haystack-0.1.11-py3-none-any.whl Python 3 none any Details for traceai_haystack-0.1.11-py3-none-any.whl

Total release size: 29.8 kB

Release files / traceai_haystack-0.1.11.tar.gz

Download URL traceai_haystack-0.1.11.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4ba8fdcc7556dcb9cf45752a8452bda0e24115ea26b817197d6bd70a6cd69a73
BLAKE2b-256 checksum
How to use checksums
50f87feb69a5db8d24e258062d0873bba407536ccbd9abd1d04d8a94bd834c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / traceai_haystack-0.1.11-py3-none-any.whl

Download URL traceai_haystack-0.1.11-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68f091e268f2267d260da5adfb20db74a12fdbcec591037d352ea4d11e69e716
BLAKE2b-256 checksum
How to use checksums
2056591d77f84c78e4dc3634760b789a6e83d997b3a5899a8a1e7239ff0d105b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for traceAI-haystack 0.1.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for traceai_haystack-0.1.11.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page