The rollup
At the top of every Trace:- Total cost — dollar amount, plus token counts by model.
- Total latency — wall clock start to answer sent.
- Compute — sum of all model + tool time (excludes waiting).
- Wait — time spent waiting on external services (APIs, databases, humans in approval queues).
Per-step breakdown
Each step in the timeline shows its individual cost and duration. Sorted view: click the cost column header to see the most expensive steps first. Common offenders when cost is high:- Long prompts — retrieval returning too many chunks. Reduce top-K in the preset.
- Expensive model — using a top-tier model when a mid-tier would do. Consider a fallback or a router.
- Repeated tool calls — Agent looping on the same tool. Fix the tool description or the Agent’s role.
- Enrichment on the fly — should be pre-computed via a Foundry pipeline, not per-run.
Latency waterfall
The waterfall view (click Timing in the top bar) shows latency as parallel bars. Anything not on the critical path can safely be optimized last. Compute-bound steps show as solid bars; wait-bound show as hatched. Wait bars in the middle of the run usually mean serial API calls that could be parallelized in the Agent’s tool config.Comparing runs
Click Compare with… on any Trace and pick another Trace (same Flow, different run). Side-by-side latency and cost view. Useful when:- Latency spiked and you want to know which step changed.
- A new version increased costs — see where.
- A/B testing two Agents.
Cost alerts
Per-Flow cost alerts fire when:- A single run exceeds a threshold (e.g., “any run over $1”).
- Rolling average cost per run exceeds a threshold over N runs.
- Total daily/weekly/monthly spend exceeds a budget.
Cost per user / per tenant
If your runs carry scope keys, the Insights page can group cost by scope:- Cost by user_id — who costs the most.
- Cost by tenant — which customer is expensive.
- Cost by feature (via tags on Traces).
Latency budgets
Set a latency budget per Flow. Runs exceeding the budget are flagged in the runs list. Common budgets:- Chat: 3 seconds.
- Background: 30 seconds.
- Batch: 5 minutes.