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

# Traces: inspect and replay every agent run end to end

> A trace records every LLM call, tool call, and Solana transaction from one agent run in order. Learn to find, inspect, and replay traces in Mortem.

A trace records everything your agent did during a single run — from the first LLM call through the last Solana transaction — as an ordered, timestamped evidence chain. When a trade goes wrong, opening the trace for that run tells you exactly which decision preceded the loss, what context the model relied on, and where execution diverged from intent. Traces are the primary debugging surface in Mortem.

## Finding traces

Open an agent at `/app/agents/[id]`, then click **Traces** to reach the trace list at `/app/agents/[id]/traces`. The list shows up to 25 traces per page, ordered newest first.

Each row in the list displays:

| Column        | What it shows                                          |
| ------------- | ------------------------------------------------------ |
| Status        | `running`, `completed`, or `errored`                   |
| Trace ID      | Unique identifier for this run                         |
| Input summary | The goal or prompt your agent passed to `startSession` |
| Started at    | Wall-clock time the session opened                     |
| Events        | Total number of events captured                        |
| Tokens        | Total tokens consumed across all LLM calls             |
| Txs           | Number of Solana transactions submitted                |

Use the status filter buttons at the top of the list to narrow the view to a specific status.

## Trace statuses

| Status      | Meaning                                                           |
| ----------- | ----------------------------------------------------------------- |
| `running`   | The session is open and events are still arriving                 |
| `completed` | The session closed with `session.complete(...)`                   |
| `errored`   | The session closed with `session.fail(...)` or an unhandled error |

<Tip>
  A trace with status `running` for an unexpectedly long time usually means the agent process exited without calling `session.fail(error)`. Check that your agent's error handling always calls the fail path.
</Tip>

## Watching live traces

The agent detail page at `/app/agents/[id]` shows a live stream panel that surfaces traces as they arrive via Server-Sent Events. You don't need to navigate to the trace list to see activity — the stream updates automatically while the page is open.

Each entry in the stream links directly to the trace detail page. Click it to open the full chronology even while the trace is still running.

## Trace detail page

Open a trace at `/app/traces/[id]` to see a three-panel layout.

### Dossier panel (left)

The left panel summarizes the trace:

* Status badge and any tags assigned at session creation
* Input summary and trace ID
* Metrics grid: duration, event count, token count, cost estimate, lamport total, and Solana transaction count
* Share controls — generate or revoke a public link (see [Sharing](/dashboard/sharing))
* Autopsy — the LLM-powered analysis of this trace (see [Analysis](/dashboard/analysis))

### Event chronology panel (center)

The center panel lists every event in sequence. Each row shows the event type badge (`llm_call`, `tool_call`, `solana_tx`, `custom`), status, sequence number, a human-readable headline, and timing.

Expand any event to see its parent event ID, end time, payload encryption status, and error message if one was recorded.

Use the **Scrub events** slider to jump to any position in the timeline. The focused event is highlighted and its payload appears in the inspector panel.

### Context inspector panel (right)

The right panel displays the full JSON payload for the currently focused event. Use **Copy as markdown** to copy the event details as formatted markdown — useful for pasting into a bug report or debugging session.

## Event types

| Type           | What it captures                                                                    |
| -------------- | ----------------------------------------------------------------------------------- |
| `llm_call`     | Model name, provider, token usage, cost estimate, streaming flag                    |
| `tool_call`    | Tool name, input arguments, output value                                            |
| `solana_tx`    | Transaction signature, cluster, lamport fee, instruction names, confirmation status |
| `mcp_call`     | Model context protocol round-trip details                                           |
| `x402_payment` | HTTP payment channel interaction                                                    |
| `custom`       | Any step you instrument with `session.beginEvent("custom", ...)`                    |

<Note>
  If your agent encrypted SDK payloads with `MORTEM_MASTER_KEY`, event payloads display as `encrypted` in the inspector instead of plain JSON. The event metadata (type, timing, status) is always visible regardless of encryption.
</Note>

## Deleting a trace

Open the trace detail page and locate the **Delete** option. Deleting a trace removes its events and any associated analysis permanently. If the trace has an active share link, the public page at `/share/[token]` will return a "buried" error after deletion.

## Related pages

<CardGroup cols={2}>
  <Card title="Analysis" icon="magnifying-glass" href="/dashboard/analysis">
    Read the LLM-powered autopsy that Mortem generates after each trace completes.
  </Card>

  <Card title="Sharing" icon="share" href="/dashboard/sharing">
    Generate a public link to share a trace with teammates or in post-mortems.
  </Card>
</CardGroup>
