Trace Contents and Retention
A trace is the complete execution record of one pipeline run, from the input that triggered it to the response it returned. Traces give you observability into your deployed pipelines and agents without a separate observability tool.
What a Trace Captures
Each trace captures:
- Spans: A hierarchical tree of every component that ran, with per-step timing, component type, and metadata tags.
- Token usage: Prompt, completion, reasoning, and cache tokens, normalized across providers and attributed to the model that used them. This lets you compare token consumption across models even when an agent uses more than one. Cost appears next to token usage. For details, see Check the Cost of a Trace. Cache tokens are split into cache reads and cache writes. To see how much of your cache spend comes from 1-hour cache writes, which Anthropic bills higher than its default 5-minute cache writes, check Cache write (1 hour) in the token breakdown. It's shown for providers that report it, such as Anthropic, and the cache write total includes these writes. The row shows a dash when the provider doesn't report the split. To set the price used for 1-hour cache writes, see Set Model Prices.
- Inputs and outputs: The data flowing into and out of every component.
- Logs: Every structured log entry from the run, with its level and source.
- Failures: The exception type, message, and full stack trace, with the root-cause component flagged so you know where the run failed and whether it's a configuration error you need to fix, or an external provider or infrastructure error that just needs a rerun.
- Metadata: Status, total duration, time to first token for streamed runs, timestamps, the source that triggered the run (Playground, Builder, API, or a shared prototype), and the pipeline version that served it.
Trace Data Retention
Haystack traces stored with your search history are kept for a limited time. Each organization has a trace retention period, in days, that controls how long trace data stays available. You can see the current value in the trace_retention_period_days field returned by the /me endpoint. If your organization needs a different retention period, contact your deepset representative.
When a trace passes its retention period, it goes through two stages:
- Soft delete: The trace is marked as expired. It's automatically excluded from the search history list, and requests for that query's trace detail or trace payload no longer return trace data, even though the underlying search history entry and record still exist.
- Permanent delete: After a grace period following the soft delete, the trace artifact itself is permanently removed from storage. The search history entry stays in place, but the trace data it pointed to is deleted for good.
This process runs automatically in the background, so you don't need to take any action. Once a trace's retention period elapses, you can no longer view it in the search history or use it for debugging, so plan on exporting or analyzing traces you need to keep before they expire.
Data Security
Traces are stored on deepset-owned infrastructure, so trace data is never shipped to an outside observability tool. Access is scoped to each workspace with role-based controls, and data is encrypted at rest. You can export any trace as JSON whenever you need it.
Related Information
Was this page helpful?