> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Traces

> Break every turn into spans for STT, the LLM, tools, and TTS, inspect them on the Dashboard, and export them to Datadog, SigNoz, New Relic, or any OpenTelemetry backend.

A trace follows one session from start to finish. Zero Runtime splits it into turns, and each turn into spans: one for speech-to-text, one for end-of-utterance detection, one for the LLM with any tool calls inside it, and one for text-to-speech. Each span records how long it took and whether it failed, so you can see where the time in a turn goes and which component broke.

## View traces on the Dashboard

Traces are recorded for every session and shown in the **Traces** tab of the Session view on the Zero Runtime Dashboard. Open **Sessions**, click **Actions > View** on a session, then select **Traces**.

| Level | Contains |
| - | - |
| Agent Session | The whole session, with the agent name, room ID, and SDK version. |
| Turn | One exchange between the user and the agent, with its duration. |
| Span | One component's work in a turn, such as `DeepgramSTT: Speech to Text Processing` or `Invoked Tool: get_weather`, with its properties. |

Select any span to inspect its properties in the **Properties** panel.

![A CartesiaTTS span selected inside a turn, showing the synthesized text, model name, and provider in the Properties panel](https://cdn.zeroruntime.ai/zrt/docs-resource/analytics-trace-turn-properties.png)

Span properties: the TTS span's input text, model, and provider in the Properties panel

### Tool Calls

When the LLM invokes a tool, the call appears as an **Invoked Tool: `<tool name>`** span inside the LLM span. Its properties show the `arguments` the tool was called with, the `result` it returned, its `latency`, whether it failed (`is_error`), whether it is cancelled on interruption (`cancel_on_interrupt`), and its `call_id`. Use it to validate integrations and debug tool behavior.

![An Invoked Tool span selected inside the LLM span, showing the tool's arguments, result, latency, and error status in the Properties panel](https://cdn.zeroruntime.ai/zrt/docs-resource/analytics-trace-tool-call.png)

Tool call details: the arguments, result, and latency of an invoked tool

## Export traces to your observability stack

To send traces to your own observability stack, such as Datadog, SigNoz, or New Relic, set `traces` on the room's `Observability` to an `Exporter` that points at your collector's OpenTelemetry (OTLP) endpoint.

```python title="Python" Python theme={null}
import zeroruntime
from zeroruntime import Exporter, Observability, Room

if __name__ == "__main__":
    zeroruntime.serve(
        MyVoiceAgent,
        room=Room(
            name="Traces Agent",
            observability=Observability(
                traces=Exporter(
                    enabled=True,
                    export_url="https://otel-collector.example.com/v1/traces",
                ),
            ),
        ),
    )
```

```typescript title="Node JS" Node JS theme={null}
import * as zeroruntime from '@zeroruntime/js-sdk';
import { Exporter, Observability, Room } from '@zeroruntime/js-sdk';

zeroruntime.serve(MyVoiceAgent, {
  room: Room({
    name: 'Traces Agent',
    observability: Observability({
      traces: Exporter({
        enabled: true,
        export_url: 'https://otel-collector.example.com/v1/traces',
      }),
    }),
  }),
});
```

Replace the example URL with your collector's traces endpoint. Set the `Room` on `serve()` to apply it to every session, or on `invoke()` to apply it to one session.

| Exporter field | Type | Default | Description |
| - | - | - | - |
| `enabled` | `bool` | `True` | Turns the trace export on or off. Set it to `False` to stop exporting while keeping the rest of the configuration. |
| `export_url` | `str` | `None` | The OTLP endpoint to send traces to. `None` uses the runtime's default destination. |
| `export_headers` | `dict[str, str]` | `{}` | Headers sent with each export. Put your vendor's API key or auth header here. |

> [!NOTE]
>
> Leaving `traces` unset is not the same as turning it off. An unset stream follows the runtime's default settings. To stop exporting traces, pass `Exporter(enabled=False)`.

## What's Next

> [card] [Metrics](https://docs.zeroruntime.ai/runtime-sdk/build/observability-and-monitoring/melt/metrics.md)
>
> Read per-stage latency and token usage.

> [card] [Logs](https://docs.zeroruntime.ai/runtime-sdk/build/observability-and-monitoring/melt/logs.md)
>
> Set the log level and ship agent logs to your stack.

## References

> [tab] Python
>
> #### Examples
>
> > [card] [Observability Hooks](https://github.com/ZeroRuntimeAI/zeroruntime-python-examples/blob/main/observability/observability_hooks.py)
> >
> > Configure observability for a session.

> [tab] Node JS
>
> #### Examples
>
> > [card] [Pipeline Events](https://github.com/ZeroRuntimeAI/zeroruntime-js-examples/blob/main/observability/pipeline_events.ts)
> >
> > Configure observability for a session.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.