DOCUMENTATION
Agent Analyzer
Understand what your AI agents are spending, where they slow down, and which steps need attention.
Introduction
Agent Analyzer is a developer observability tool designed to inspect, evaluate, and diagnose individual AI-agent runs.
When building multi-step agentic workflows, it is difficult to determine why a run was slow, which step consumed the bulk of the token budget, whether tools were repeatedly called in redundant loops, or where context expanded unnecessarily.
Agent Analyzer provides instant clarity into single-run executions without requiring heavy SDK instrumentations, external servers, databases, or cloud accounts.
Quick Start
Get from raw agent execution data to a diagnostic report in five steps:
1. Open the analyzer
Navigate to /analyze in your browser.
2. Provide your trace
Paste the JSON trace directly into the editor or upload a JSON file. If testing for the first time, click Try an example trace.
3. Run the analysis
Click Analyze. The parser validates schema compliance, and the deterministic TypeScript engine calculates metrics client-side.
4. Review the results
Inspect total cost, execution duration, token growth curves, cost per model, and latency distributions.
5. Fix the highest-priority issue
Start with the diagnosis in the Fix this first section to resolve the most expensive or inefficient step.
Trace Format
Agent Analyzer expects a JSON object representing a single agent run. The top level contains metadata and an array of individual execution steps.
Top-Level Schema
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Unique identifier for the agent run (e.g. "run_001"). |
| name | string | Yes | Descriptive name of the agent or task (e.g. "customer-support-agent"). |
| startTime | string | Yes | ISO 8601 timestamp marking run start. |
| endTime | string | Yes | ISO 8601 timestamp marking run completion. |
| steps | AgentStep[] | Yes | Non-empty array of execution steps. |
IMPORTANT
Never upload API keys, passwords, authentication tokens, private credentials, or other secrets inside a trace. Review traces before submission.
Step Format
Each element in the steps array describes a distinct action taken by the agent (an LLM inference call, tool invocation, vector retrieval, or custom step).
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Unique step identifier (e.g. "step_01"). |
| name | string | Yes | Step or tool name (e.g. "lookup_customer"). |
| type | "llm" | "tool" | "retrieval" | "other" | Yes | Categorization of the step execution type. |
| status | "success" | "error" | Yes | Execution outcome of this specific step. |
| startTime | string | Yes | ISO 8601 timestamp when step started. |
| endTime | string | Yes | ISO 8601 timestamp when step ended. |
| model | string | Optional | Model name for LLM steps (e.g. "gpt-4o-mini"). |
| inputTokens | number | Optional | Prompt tokens (must be non-negative). |
| outputTokens | number | Optional | Completion tokens (must be non-negative). |
| cost | number | Optional | Estimated dollar cost for the step in USD. |
Validation
Before executing analysis, Agent Analyzer validates the input trace against a strict schema in parser.ts.
Validation checks include:
- Valid JSON syntax parsing.
- Top-level value is a JSON object (not primitive or array).
- Required fields (id, name, startTime, endTime, steps) are present and non-empty.
- Timestamps conform to valid ISO 8601 formats parseable by standard JavaScript date engines.
- The steps array contains at least one step.
- Every step object has a valid type ("llm" | "tool" | "retrieval" | "other") and status ("success" | "error").
- Numeric fields (inputTokens, outputTokens, cost) are non-negative numbers if provided.
When validation fails, an explicit error message indicates the exact step index and offending field (e.g. "steps[2] (id: step_03): 'type' must be 'llm' | 'tool' | 'retrieval' | 'other'").
How Analysis Works
Agent Analyzer executes a deterministic TypeScript pipeline completely in your browser session:
The analyzer does not make external API requests or invoke remote LLMs to evaluate your run. Calculations and issue detection are 100% deterministic algorithms running on the normalized step array.
Metrics
Total Cost
Sum of all reported step.cost values across the run. If no cost values are provided in the trace, the UI reports that cost data was not included.
Token Usage
Aggregates total input tokens, total output tokens, and combined tokens across all LLM steps.
Latency
Overall execution time calculated as endTime - startTime of the entire agent run.
Cost by Step
Ranks steps by expenditure descending, calculating each step's cost, duration, and percentage share of total run cost.
Cost by Model
Groups all LLM steps by their model property, totaling calls made, input/output tokens, and cumulative cost per model.
Context Growth
Tracks the cumulative input token trajectory across chronological LLM calls to visualize prompt bloating.
Latency Breakdown
Calculates the exact duration (endTime - startTime) of each individual step and compares it against the run mean.
Detected Issues
Agent Analyzer runs 6 deterministic diagnostic detectors over the normalized trace:
1. Context Growth
Medium (≥3×) / High (≥5×)Triggered when the last LLM call's input tokens are at least 3.0× larger than the first LLM call. Indicates full chat histories or unbounded tool outputs being re-sent without compaction.
2. Repeated Tool Calls
MediumTriggered when the same tool name is invoked 2 or more times during a single run. Identifies potential lack of result caching or repetitive agent reasoning loops.
3. Retries
LowTriggered when a step encounters status error and the same step name executes with status success later in the run.
4. Expensive Steps
HighTriggered when a single step accounts for ≥ 30% of total run cost. Identifies disproportionately expensive prompts or output generations.
5. Slow Steps
LowTriggered when a step takes more than 2.5× the mean step duration AND exceeds 1,000ms.
6. Excessive LLM Calls
Medium (6–7) / High (≥8)Triggered when a run makes 6 or more separate LLM calls. Highlights complex multi-call chains that add latency, cost, and failure surface area.
Understanding Results
The report at /analyze/results is organized hierarchically so you can triage an agent run in seconds:
- Run Overview: Four top-level KPI cards (Total Cost, Latency, Tokens, Issues count) answering how the run performed at a glance.
- Health Status: Shows whether the run is healthy or lists the exact breakdown of optimization findings.
- Fix This First: Automatically isolates the single most critical issue detected, paired with an actionable engineering recommendation.
- Detected Issues: Categorized list of all secondary findings grouped by severity (High, Medium, Low).
- Cost & Model Analysis: Side-by-side breakdown of cost per step and expenditure grouped by LLM model.
- Token & Latency Breakdowns: Visual context growth curve and horizontal step duration bars highlighting anomalies.
- Step Breakdown: Complete chronological log of every step, model, token count, cost, duration, and status.
Step Errors vs Run Status
An individual step with status "error" indicates that a specific tool call or API request failed.
A step error does NOT mean the entire agent run failed. Real-world agents frequently recover from step errors via retries, alternate tool selections, or fallback prompt routines.
Agent Analyzer flags step errors and retries to help you identify flaky tools or intermittent network issues, but preserves the context of the overall run workflow.
Example Trace
The following complete trace represents a realistic 5-step customer support workflow containing LLM inferences, tool calls, a retrieval step, and a transient error recovery:
{
"id": "run_support_091",
"name": "customer-support-agent",
"startTime": "2026-08-23T10:00:00.000Z",
"endTime": "2026-08-23T10:00:04.850Z",
"steps": [
{
"id": "step_01",
"name": "classify_intent",
"type": "llm",
"model": "gpt-4o-mini",
"inputTokens": 3200,
"outputTokens": 85,
"cost": 0.00053,
"startTime": "2026-08-23T10:00:00.000Z",
"endTime": "2026-08-23T10:00:00.680Z",
"status": "success"
},
{
"id": "step_02",
"name": "lookup_account",
"type": "tool",
"startTime": "2026-08-23T10:00:00.690Z",
"endTime": "2026-08-23T10:00:00.990Z",
"status": "error"
},
{
"id": "step_03",
"name": "lookup_account",
"type": "tool",
"startTime": "2026-08-23T10:00:01.000Z",
"endTime": "2026-08-23T10:00:01.280Z",
"status": "success"
},
{
"id": "step_04",
"name": "fetch_kb_articles",
"type": "retrieval",
"startTime": "2026-08-23T10:00:01.300Z",
"endTime": "2026-08-23T10:00:01.650Z",
"status": "success"
},
{
"id": "step_05",
"name": "generate_resolution",
"type": "llm",
"model": "claude-3-5-sonnet-20241022",
"inputTokens": 18400,
"outputTokens": 620,
"cost": 0.06450,
"startTime": "2026-08-23T10:00:01.670Z",
"endTime": "2026-08-23T10:00:04.850Z",
"status": "success"
}
]
}You can copy this JSON and paste it directly into /analyze to inspect the resulting diagnostic report.
Frequently Asked Questions
Do I need an account or subscription?
No. Agent Analyzer operates without user accounts, logins, or paid tiers. You can analyze traces immediately.
Does Agent Analyzer require an API key?
No. Analysis is performed using deterministic calculations on your submitted trace data. No OpenAI, Anthropic, or external API keys are required.
Does Agent Analyzer use an LLM to analyze my trace?
No. The analysis engine is written entirely in pure TypeScript. It calculates token metrics, costs, latency, and evaluates issue rules deterministically without sending your data to any LLM.
What trace formats are supported?
Agent Analyzer currently supports our normalized JSON trace schema documented in Trace Format.
What happens if my trace is invalid?
The parser performs inline validation before analysis begins. If any required fields are missing, timestamps are invalid, or types are unsupported, a descriptive error message points directly to the line or step index that needs correction.
What does a failed step mean?
A step with status "error" indicates that a specific tool or call failed during execution. It does not mean the entire agent run failed if subsequent recovery or fallback steps completed successfully.