Skip to main content
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.
Prerequisites
  • A DinoAI agent that has run at least once, for example from Bolt self-healing 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 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
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 ↓. 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'
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
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.
6

Change the agent

Turn what the trace showed into changes in the agent’s YAML file, .dinoai/agents/pipeline-fixer.yml:
  • 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.
See YAML Configuration 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.
The new session fixes the same kind of failure with fewer credits, a lower peak context, and no repeated failed tool calls.

Next steps

Traces

What a trace shows and where to open it.

Span reference

Every step type, its fields, and its status values.

Metrics

How credits, calls, wall clock, and peak context are counted.

YAML Configuration

Every field you can change in an agent.