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

# Debug and tune a DinoAI agent with its trace

> Use a DinoAI session trace to find the slow and expensive steps of an agent run, read its model calls, spot failed and repeated tool calls, and fix the agent.

An agent that works can still waste time and credits. This guide walks through one session of a self-healing agent, `pipeline-fixer`, that fixed a failed Bolt run of `daily_production_build`. The fix was right, but the session used 1,284 credits. The trace shows why, and what to change in the agent.

> [!NOTE]
>
> **Prerequisites**
>
> * A DinoAI agent that has run at least once, for example from Bolt [self-healing](https://docs.paradime.io/products/dino-ai/bolt-pipeline-agent/self-healing.md) or a chat.
> * Access to the agent's session in the Agent app.
> * To change the agent: edit access to its YAML file under `.dinoai/agents/`, or to the agent in the agent builder.
>
> Estimated time: 15 minutes.

## Steps

**1. Open the session's trace**

Open the session from the Agent app, or from the Bolt run's **DinoAI** tab with **Open in agent**. In the session header, click **Trace**.

Read the header first. This session shows **1,284** credits, **9** model calls, **14** tool calls, **3m 42s** wall clock, and **61K** peak context. A peak context of 61K for a one-file fix is the first clue: one model call was sent a very large prompt.

See [Reading a trace](https://docs.paradime.io/products/dino-ai/traces/reading-a-trace.md) for each part of the screen.

**2. Find the expensive step**

In the flight recorder at the bottom, click **Credits**. One bar stands far above the others. Click it to select its step.

![A pipeline-fixer trace with the flight recorder on the Credits tab, reading Σ 1,284 credits · 4 calls ≥100 cr, its tallest bar selected, and the matching model (main) call open in the inspector with 412 credits at 100% of top, 61,240 / 920 tokens in and out, and an input that starts with read\_file target/manifest.json](https://mintcdn.com/paradime-docs/BdIrIxo113P8jOys/images/dinoai-trace-flight-recorder-credits.jpg?fit=max\&auto=format\&n=BdIrIxo113P8jOys\&q=85\&s=6d8ca85a116321c6b76be5e66a39a18d)

The inspector shows a `model (main)` call with **412** credits, **100% of top**, and **61,240 / 920** tokens in and out. That one call used about a third of the session's credits.

**3. Read what the model was given**

Look at the call's **Input**. A model call's input shows what is new in its prompt since the previous call. Here it starts with the result of `read_file target/manifest.json`: the agent read dbt™'s whole manifest into its context. Click **Show full text** to see all of it.

The step before it in the graph is the `read_file` call on `target/manifest.json`. The agent didn't need the manifest: the run's error was already in `target/run_results.json`.

**4. Spot failed and repeated tool calls**

Switch the flight recorder back to **Duration**, and walk the steps with <kbd>↓</kbd>. Two `run_terminal_command` steps in a row run `dbt build -s fct_orders`. Select the second one.

![The pipeline-fixer trace with two run\_terminal\_command steps running dbt build -s fct\_orders, one after the other, and the second one open in the inspector with status error and an output that ends in Database Error in model fct\_orders, invalid identifier 'CUST\_ID'](https://mintcdn.com/paradime-docs/BdIrIxo113P8jOys/images/dinoai-trace-failed-tool-call.jpg?fit=max\&auto=format\&n=BdIrIxo113P8jOys\&q=85\&s=537219d8687d160682f102ea3a6d6408)

Its **Status** is `error`, and its **Output** is the same database error as the first run. The agent ran the build again without changing anything. Each failed build took about 10 seconds and a model call to read the result.

**5. Check the internal steps**

Switch on **Internal steps** in the header. Internal nodes appear under some model calls.

![The pipeline-fixer trace with Internal steps on: after a model (main) call, a failed anthropic route try marked overloaded, a bedrock route try marked ok, and a model fell\_back warning, with the failed try open in the inspector](https://mintcdn.com/paradime-docs/BdIrIxo113P8jOys/images/dinoai-trace-internal-steps-route-tries.jpg?fit=max\&auto=format\&n=BdIrIxo113P8jOys\&q=85\&s=80892a4dd051a9c044b945f4b53d6192)

Here one call had a failed route try, marked `overloaded`, before another route served it. A `model` warning with `fell_back` means another model answered that call. That explains a slow call, and a different model id on it. It isn't a problem with the agent. If the agent must stay on its own models, set `fallback: none`. See [Internal steps](https://docs.paradime.io/products/dino-ai/traces/internal-steps.md).

**6. Change the agent**

Turn what the trace showed into changes in the agent's YAML file, `.dinoai/agents/pipeline-fixer.yml`:

```yaml theme={"system"}
name: pipeline-fixer
version: 1
role: >
  Fixes failed dbt™ runs in Bolt.
goal: >
  Find the cause of the failure and open a pull request with the smallest fix.
backstory: >
  Start from target/run_results.json and the run log. Never read
  target/manifest.json: search the models with ripgrep_search instead.
  When a command fails, read the error and change something before you
  run it again. Never run the same failing command twice.
tools:
  mode: allowlist
  list:
    - read_file
    - ripgrep_search
    - edit_file
    - run_terminal_command
model_family: anthropic
```

* **Instructions** (`backstory`): tell the agent where to start, what not to read, and not to rerun a failing command.
* **Tools**: allow only the tools the job needs.
* **Model**: if the trace shows a cheaper model would do, set `model_family`. See [Supported models](https://docs.paradime.io/products/dino-ai/supported-models.md).

See [YAML Configuration](https://docs.paradime.io/products/dino-ai/programmable-agents/yaml-configuration.md) for every field. In the agent builder, the same fields are on the agent's page.

**7. Compare the next session**

Let the agent run again, then open the new session's trace. Compare the header numbers with the old session: **credits**, **model calls**, and **peak context** should go down, and the flight recorder should have no repeated failed builds.

> [!TIP]
>
> The new session fixes the same kind of failure with fewer credits, a lower peak context, and no repeated failed tool calls.

## Next steps

> [card] [Traces](https://docs.paradime.io/products/dino-ai/traces/index.md)
>
> What a trace shows and where to open it.

> [card] [Span reference](https://docs.paradime.io/products/dino-ai/traces/span-reference.md)
>
> Every step type, its fields, and its status values.

> [card] [Metrics](https://docs.paradime.io/products/dino-ai/traces/metrics.md)
>
> How credits, calls, wall clock, and peak context are counted.

> [card] [YAML Configuration](https://docs.paradime.io/products/dino-ai/programmable-agents/yaml-configuration.md)
>
> Every field you can change in an agent.


## Related topics

- [See every step of a DinoAI session in its trace](https://docs.paradime.io/changelog/2026-12-03/session-trace.md)
- [Traces](https://docs.paradime.io/products/dino-ai/traces/index.md)
- [DinoAI](https://docs.paradime.io/products/dino-ai/index.md)
- [Fix with DinoAI](https://docs.paradime.io/products/dino-ai/bolt-pipeline-agent/fix-with-dinoai.md)
- [Reading a trace](https://docs.paradime.io/products/dino-ai/traces/reading-a-trace.md)


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