agent trace read
Read trace files from an agent preview session.
When you run an agent preview conversation (either interactive or programmatic), trace files are automatically recorded and saved in your local DX project. Each turn (utterance or response) of a conversation creates trace data. Use this command to view trace data for a specific preview session, so you can then analyze the trace data to observe, monitor, investigate, and troubleshoot agent events and behavior.
Use the –format flag to specify one of these formats of the outputted trace data:
- summary (Default): A per-turn narrative showing topic routing, actions executed, and the agent's response. Use this to quickly understand what happened in a preview session.
- detail: Diagnostic drill-down into a specific dimension. Filters output to only the trace steps relevant to that dimension, minimizing noise.
- raw: Unprocessed trace JSON. Use this as a fallback when the trace schema has changed or you need to perform custom analysis.
If you specify “–format detail”, you must also specify a dimension with the –dimension flag. Dimensions are a way to slice and analyze the agent execution trace from a specific angle or concern. Instead of looking at the raw sequence of everything that happened, each dimension filters and organizes the trace data to answer a specific type of question. These are the available dimensions and the information they provide:
- actions: The actions the agent executed. Includes action name, input parameters, output, and latency. Use this dimension to understand what the agent actually did when answering an utterance in the preview session.
- grounding: The reasoning steps used by the LLM. Use this dimension to see how the agent "thought" about the problem - the AI reasoning that determined which actions to take.
- routing: How the agent navigated between subagents. Use this dimension to understand conversation flow - when and why the agent switched between different subagents or contexts during the conversation.
- errors: Aggregates all errors during the session. Use this dimension to quickly identify and debug issues across all steps.
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑dimension | ‑d | Type: Value Valid Values: actions, grounding, routing, errorsDimension to drill into when using “–format detail”; used to filter and organize the trace data to answer a specific type of question. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑format | ‑f | Type: Value Valid Values: summary, detail, rawDefault value: summaryOutput format of the trace data; specifies the level of detail you want in the trace files. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑session‑id | ‑s | Type: Value Required Session ID to read traces for. Use the “agent preview sessions” CLI command to list all known agent preview sessions along with their session IDs |
‑‑turn | ‑t | Type: Value Turn number for which you want trace data. A turn is a single utterance or response in a conversation, starting with 1. |
Show a session trace summary for all turns in the session with the specified ID:
Show a trace summary for the second turn (utterance or response) of the conversation:
Drill into action execution across all turns:
Drill into routing decisions for the first turn of the conversation:
Show all errors across the session:
Output raw trace JSON for custom parsing:
Return results as JSON: