| 10,000 runs/day | |
|---|---|
| Median cost | $14,183 |
| Risk scenarios | |
| Prepare for (with p90) | $18,391 |
| Protect against (with p95) | $26,847 |
| Maximum exposure (with p99) | $41,263 |
research_queries performs retrieval summarization (output/input ratio: 0.28). Switching from claude-sonnet-4-6 to claude-haiku-4-5 saves $4,200/month at 10,000 daily runs. Estimate is conservative. Actual savings may be higher.
review_loop runs up to 11 iterations on adversarial inputs. Capping at 5 iterations eliminates tail cost while preserving convergence on 94% of runs. Saves $890/month at 10,000 daily runs.
classify_intent performs classification (output/input ratio: 0.08). Switching from gpt-4o to gpt-4.1-nano saves $454/month at 10,000 daily runs.
{
"workflow_name": "customer_support_agent.py",
"workflow_hash": "demo",
"profiled_at": "2026-07-24T16:50:44.237322+00:00",
"sample_size": 50,
"input_mode": "auto-generate",
"runs": [
[
{
"step_name": "classify_intent",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 2263,
"output_tokens": 5,
"context_size": 2263,
"tool_definitions_tokens": 0,
"system_prompt_hash": "fc1f263d32b8ed4a3a77ccf0385ba4d1450cfe96493ccea1d33bec6eaf8bc86f",
"system_prompt_tokens": 1500,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 400,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a customer support intent classifier..."
},
{
"step_name": "research_queries",
"step_type": "llm",
"model": "claude-sonnet-4-6",
"input_tokens": 4256,
"output_tokens": 1234,
"context_size": 4256,
"tool_definitions_tokens": 0,
"system_prompt_hash": "66f62d1807d3821a3865f2573b69c74be033f1341240ac861fefc6d430bff5e0",
"system_prompt_tokens": 2000,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 3000,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a knowledge base research agent..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 955,
"output_tokens": 294,
"context_size": 955,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1296,
"output_tokens": 286,
"context_size": 1296,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 2,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1759,
"output_tokens": 211,
"context_size": 1759,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 3,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "synthesize_response",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 754,
"output_tokens": 1253,
"context_size": 754,
"tool_definitions_tokens": 0,
"system_prompt_hash": "6fb0ab0f5b1f03fa2bb0b35cf65a5ad34981f032271ca72177f6b2f5bb817dfe",
"system_prompt_tokens": 400,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 1500,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": 4096,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "Synthesize a comprehensive customer response..."
},
{
"step_name": "format_output",
"step_type": "llm",
"model": "gpt-4o-mini",
"input_tokens": 3795,
"output_tokens": 3723,
"context_size": 3795,
"tool_definitions_tokens": 0,
"system_prompt_hash": "e904c9ccfa425ff0b055d2c533462314d35a529b055e8abe41d49bb46d827427",
"system_prompt_tokens": 300,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 600,
"timestamp": "2026-07-24T16:50:44.234090+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "Format the response for delivery..."
}
],
[
{
"step_name": "classify_intent",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 2159,
"output_tokens": 9,
"context_size": 2159,
"tool_definitions_tokens": 0,
"system_prompt_hash": "fc1f263d32b8ed4a3a77ccf0385ba4d1450cfe96493ccea1d33bec6eaf8bc86f",
"system_prompt_tokens": 1500,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 400,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a customer support intent classifier..."
},
{
"step_name": "research_queries",
"step_type": "llm",
"model": "claude-sonnet-4-6",
"input_tokens": 4552,
"output_tokens": 1107,
"context_size": 4552,
"tool_definitions_tokens": 0,
"system_prompt_hash": "66f62d1807d3821a3865f2573b69c74be033f1341240ac861fefc6d430bff5e0",
"system_prompt_tokens": 2000,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 3000,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a knowledge base research agent..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1059,
"output_tokens": 253,
"context_size": 1059,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1326,
"output_tokens": 257,
"context_size": 1326,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 2,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1770,
"output_tokens": 235,
"context_size": 1770,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 3,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "synthesize_response",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 750,
"output_tokens": 1547,
"context_size": 750,
"tool_definitions_tokens": 0,
"system_prompt_hash": "6fb0ab0f5b1f03fa2bb0b35cf65a5ad34981f032271ca72177f6b2f5bb817dfe",
"system_prompt_tokens": 400,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 1500,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": 4096,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "Synthesize a comprehensive customer response..."
},
{
"step_name": "format_output",
"step_type": "llm",
"model": "gpt-4o-mini",
"input_tokens": 3863,
"output_tokens": 4214,
"context_size": 3863,
"tool_definitions_tokens": 0,
"system_prompt_hash": "e904c9ccfa425ff0b055d2c533462314d35a529b055e8abe41d49bb46d827427",
"system_prompt_tokens": 300,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 600,
"timestamp": "2026-07-24T16:50:44.234277+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "Format the response for delivery..."
}
],
[
{
"step_name": "classify_intent",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 2208,
"output_tokens": 7,
"context_size": 2208,
"tool_definitions_tokens": 0,
"system_prompt_hash": "fc1f263d32b8ed4a3a77ccf0385ba4d1450cfe96493ccea1d33bec6eaf8bc86f",
"system_prompt_tokens": 1500,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 400,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a customer support intent classifier..."
},
{
"step_name": "research_queries",
"step_type": "llm",
"model": "claude-sonnet-4-6",
"input_tokens": 4386,
"output_tokens": 1173,
"context_size": 4386,
"tool_definitions_tokens": 0,
"system_prompt_hash": "66f62d1807d3821a3865f2573b69c74be033f1341240ac861fefc6d430bff5e0",
"system_prompt_tokens": 2000,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 3000,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a knowledge base research agent..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1006,
"output_tokens": 213,
"context_size": 1006,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1293,
"output_tokens": 248,
"context_size": 1293,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 2,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 1644,
"output_tokens": 245,
"context_size": 1644,
"tool_definitions_tokens": 0,
"system_prompt_hash": "c97ace4c8fef2cee8fa0f3c9f52aab18dbd4f42438afe362ffb8f75ce4c04b84",
"system_prompt_tokens": 500,
"output_format": "text",
"is_retry": false,
"iteration": 3,
"parent_step": null,
"duration_ms": 800,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "You are a response quality reviewer..."
},
{
"step_name": "synthesize_response",
"step_type": "llm",
"model": "gpt-4o",
"input_tokens": 827,
"output_tokens": 1483,
"context_size": 827,
"tool_definitions_tokens": 0,
"system_prompt_hash": "6fb0ab0f5b1f03fa2bb0b35cf65a5ad34981f032271ca72177f6b2f5bb817dfe",
"system_prompt_tokens": 400,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 1500,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": 4096,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "Synthesize a comprehensive customer response..."
},
{
"step_name": "format_output",
"step_type": "llm",
"model": "gpt-4o-mini",
"input_tokens": 3744,
"output_tokens": 4247,
"context_size": 3744,
"tool_definitions_tokens": 0,
"system_prompt_hash": "e904c9ccfa425ff0b055d2c533462314d35a529b055e8abe41d49bb46d827427",
"system_prompt_tokens": 300,
"output_format": "text",
"is_retry": false,
"iteration": 1,
"parent_step": null,
"duration_ms": 600,
"timestamp": "2026-07-24T16:50:44.234313+00:00",
"cache_hit_tokens": null,
"cache_miss_tokens": null,
"tool_name": null,
"tool_input_tokens": null,
"tool_output_tokens": null,
"tool_success": null,
"tool_retry_count": null,
"model_version": null,
"temperature": null,
"max_tokens_setting": null,
"output_truncated": null,
"output_tool_call_count": null,
"step_output_format": null,
"system_prompt_snippet": "Format the response for delivery..."
}
]
],
"metadata": {
"cost_summary": {
"mean_cost_per_run": 0.08302474,
"min_cost_per_run": 0.067962,
"max_cost_per_run": 0.160374,
"per_step": {
"classify_intent": {
"count": 50,
"cost_mean": 0.00558646,
"model": "gpt-4o",
"step_type": "llm"
},
"research_queries": {
"count": 50,
"cost_mean": 0.03181482,
"model": "claude-sonnet-4-6",
"step_type": "llm"
},
"review_loop": {
"count": 206,
"cost_mean": 0.006758422330097088,
"model": "gpt-4o",
"step_type": "llm"
},
"synthesize_response": {
"count": 50,
"cost_mean": 0.01477332,
"model": "gpt-4o",
"step_type": "llm"
},
"format_output": {
"count": 50,
"cost_mean": 0.00300544,
"model": "gpt-4o-mini",
"step_type": "llm"
}
}
},
"stats": {
"step_stats": {
"classify_intent": {
"step_name": "classify_intent",
"step_type": "llm",
"model": "gpt-4o",
"call_count": 50,
"runs_present": 50,
"input_tokens": {
"min": 2101.0,
"max": 2299.0,
"mean": 2202.74,
"std": 60.32490601496439,
"p50": 2206.0,
"p75": 2258.75,
"p90": 2278.7,
"p95": 2289.3,
"p99": 2295.57
},
"output_tokens": {
"min": 5.0,
"max": 11.0,
"mean": 7.94,
"std": 1.9733944649475719,
"p50": 8.0,
"p75": 9.0,
"p90": 11.0,
"p95": 11.0,
"p99": 11.0
},
"total_tokens": {
"min": 2108.0,
"max": 2308.0,
"mean": 2210.68,
"std": 60.3778713349417,
"p50": 2213.0,
"p75": 2266.5,
"p90": 2289.2,
"p95": 2297.3,
"p99": 2305.55
},
"cost": {
"min": 0.005322,
"max": 0.00584,
"mean": 0.0055864600000000006,
"std": 0.0001522750210665437,
"p50": 0.005585,
"p75": 0.005712999999999999,
"p90": 0.0057688,
"p95": 0.00580775,
"p99": 0.00583902
},
"duration_ms": {
"min": 400.0,
"max": 400.0,
"mean": 400.0,
"std": 0.0,
"p50": 400.0,
"p75": 400.0,
"p90": 400.0,
"p95": 400.0,
"p99": 400.0
},
"context_size": {
"min": 2101.0,
"max": 2299.0,
"mean": 2202.74,
"std": 60.32490601496439,
"p50": 2206.0,
"p75": 2258.75,
"p90": 2278.7,
"p95": 2289.3,
"p99": 2295.57
},
"iterations_per_run": {
"min": 1.0,
"max": 1.0,
"mean": 1.0,
"std": 0.0,
"p50": 1.0,
"p75": 1.0,
"p90": 1.0,
"p95": 1.0,
"p99": 1.0
},
"mean_iterations": 1.0
},
"research_queries": {
"step_name": "research_queries",
"step_type": "llm",
"model": "claude-sonnet-4-6",
"call_count": 50,
"runs_present": 50,
"input_tokens": {
"min": 4247.0,
"max": 4630.0,
"mean": 4424.94,
"std": 106.86944352425381,
"p50": 4413.0,
"p75": 4513.0,
"p90": 4575.4,
"p95": 4610.2,
"p99": 4623.63
},
"output_tokens": {
"min": 1095.0,
"max": 1390.0,
"mean": 1236.0,
"std": 87.48994111278374,
"p50": 1235.0,
"p75": 1307.5,
"p90": 1347.0,
"p95": 1381.3,
"p99": 1390.0
},
"total_tokens": {
"min": 5377.0,
"max": 5953.0,
"mean": 5660.94,
"std": 133.2190784277645,
"p50": 5651.5,
"p75": 5735.0,
"p90": 5855.2,
"p95": 5873.2,
"p99": 5916.25
},
"cost": {
"min": 0.029388,
"max": 0.034242,
"mean": 0.031814820000000014,
"std": 0.001328637981282382,
"p50": 0.031788,
"p75": 0.032715,
"p90": 0.033753899999999996,
"p95": 0.03390915,
"p99": 0.03412293
},
"duration_ms": {
"min": 3000.0,
"max": 3000.0,
"mean": 3000.0,
"std": 0.0,
"p50": 3000.0,
"p75": 3000.0,
"p90": 3000.0,
"p95": 3000.0,
"p99": 3000.0
},
"context_size": {
"min": 4247.0,
"max": 4630.0,
"mean": 4424.94,
"std": 106.86944352425381,
"p50": 4413.0,
"p75": 4513.0,
"p90": 4575.4,
"p95": 4610.2,
"p99": 4623.63
},
"iterations_per_run": {
"min": 1.0,
"max": 1.0,
"mean": 1.0,
"std": 0.0,
"p50": 1.0,
"p75": 1.0,
"p90": 1.0,
"p95": 1.0,
"p99": 1.0
},
"mean_iterations": 1.0
},
"review_loop": {
"step_name": "review_loop",
"step_type": "llm",
"model": "gpt-4o",
"call_count": 206,
"runs_present": 50,
"input_tokens": {
"min": 923.0,
"max": 4543.0,
"mean": 1699.6699029126214,
"std": 707.0275240559405,
"p50": 1638.0,
"p75": 2012.75,
"p90": 2446.5,
"p95": 3068.75,
"p99": 4133.55
},
"output_tokens": {
"min": 200.0,
"max": 300.0,
"mean": 250.90291262135923,
"std": 31.68411606763631,
"p50": 250.0,
"p75": 281.0,
"p90": 294.0,
"p95": 298.0,
"p99": 299.95
},
"total_tokens": {
"min": 1131.0,
"max": 4778.0,
"mean": 1950.5728155339805,
"std": 709.801856266831,
"p50": 1852.5,
"p75": 2259.5,
"p90": 2720.5,
"p95": 3330.0,
"p99": 4418.25
},
"cost": {
"min": 0.004327,
"max": 0.013925,
"mean": 0.006758422330097089,
"std": 0.0018160319921127445,
"p50": 0.006311499999999999,
"p75": 0.00734075,
"p90": 0.008928,
"p95": 0.010451249999999999,
"p99": 0.013242099999999996
},
"duration_ms": {
"min": 800.0,
"max": 800.0,
"mean": 800.0,
"std": 0.0,
"p50": 800.0,
"p75": 800.0,
"p90": 800.0,
"p95": 800.0,
"p99": 800.0
},
"context_size": {
"min": 923.0,
"max": 4543.0,
"mean": 1699.6699029126214,
"std": 707.0275240559405,
"p50": 1638.0,
"p75": 2012.75,
"p90": 2446.5,
"p95": 3068.75,
"p99": 4133.55
},
"iterations_per_run": {
"min": 2.0,
"max": 11.0,
"mean": 4.12,
"std": 1.9020933688106558,
"p50": 3.0,
"p75": 5.0,
"p90": 6.0,
"p95": 8.0,
"p99": 11.0
},
"mean_iterations": 4.12
},
"synthesize_response": {
"step_name": "synthesize_response",
"step_type": "llm",
"model": "gpt-4o",
"call_count": 50,
"runs_present": 50,
"input_tokens": {
"min": 750.0,
"max": 848.0,
"mean": 802.6,
"std": 27.483575800385044,
"p50": 802.0,
"p75": 821.0,
"p90": 842.3,
"p95": 846.1,
"p99": 847.51
},
"output_tokens": {
"min": 850.0,
"max": 1828.0,
"mean": 1276.66,
"std": 207.40472216299756,
"p50": 1252.0,
"p75": 1317.75,
"p90": 1493.9,
"p95": 1774.3999999999999,
"p99": 1808.3999999999999
},
"total_tokens": {
"min": 1655.0,
"max": 2634.0,
"mean": 2079.26,
"std": 210.7941069152648,
"p50": 2063.0,
"p75": 2126.25,
"p90": 2312.0,
"p95": 2574.1499999999996,
"p99": 2626.16
},
"cost": {
"min": 0.010513,
"max": 0.020295,
"mean": 0.014773319999999996,
"std": 0.0020791440982347734,
"p50": 0.014509999999999999,
"p75": 0.01522175,
"p90": 0.017021,
"p95": 0.0197436,
"p99": 0.0201284
},
"duration_ms": {
"min": 1500.0,
"max": 1500.0,
"mean": 1500.0,
"std": 0.0,
"p50": 1500.0,
"p75": 1500.0,
"p90": 1500.0,
"p95": 1500.0,
"p99": 1500.0
},
"context_size": {
"min": 750.0,
"max": 848.0,
"mean": 802.6,
"std": 27.483575800385044,
"p50": 802.0,
"p75": 821.0,
"p90": 842.3,
"p95": 846.1,
"p99": 847.51
},
"iterations_per_run": {
"min": 1.0,
"max": 1.0,
"mean": 1.0,
"std": 0.0,
"p50": 1.0,
"p75": 1.0,
"p90": 1.0,
"p95": 1.0,
"p99": 1.0
},
"mean_iterations": 1.0
},
"format_output": {
"step_name": "format_output",
"step_type": "llm",
"model": "gpt-4o-mini",
"call_count": 50,
"runs_present": 50,
"input_tokens": {
"min": 3700.0,
"max": 4298.0,
"mean": 3994.18,
"std": 177.3738919655889,
"p50": 3979.5,
"p75": 4157.75,
"p90": 4227.3,
"p95": 4243.0,
"p99": 4282.8099999999995
},
"output_tokens": {
"min": 3551.0,
"max": 4487.0,
"mean": 4010.48,
"std": 282.68813421240344,
"p50": 3974.0,
"p75": 4238.25,
"p90": 4396.1,
"p95": 4454.7,
"p99": 4475.73
},
"total_tokens": {
"min": 7309.0,
"max": 8679.0,
"mean": 8004.66,
"std": 327.07514021542335,
"p50": 7996.5,
"p75": 8233.0,
"p90": 8413.8,
"p95": 8549.4,
"p99": 8650.09
},
"cost": {
"min": 0.002694,
"max": 0.003312,
"mean": 0.0030054400000000003,
"std": 0.0001705219071448784,
"p50": 0.0030039999999999997,
"p75": 0.00313475,
"p90": 0.0032493,
"p95": 0.0032647,
"p99": 0.00330759
},
"duration_ms": {
"min": 600.0,
"max": 600.0,
"mean": 600.0,
"std": 0.0,
"p50": 600.0,
"p75": 600.0,
"p90": 600.0,
"p95": 600.0,
"p99": 600.0
},
"context_size": {
"min": 3700.0,
"max": 4298.0,
"mean": 3994.18,
"std": 177.3738919655889,
"p50": 3979.5,
"p75": 4157.75,
"p90": 4227.3,
"p95": 4243.0,
"p99": 4282.8099999999995
},
"iterations_per_run": {
"min": 1.0,
"max": 1.0,
"mean": 1.0,
"std": 0.0,
"p50": 1.0,
"p75": 1.0,
"p90": 1.0,
"p95": 1.0,
"p99": 1.0
},
"mean_iterations": 1.0
}
},
"run_stats": [
{
"run_index": 0,
"total_cost": 0.07213900000000001,
"total_tokens": 22084,
"total_input_tokens": 15078,
"total_output_tokens": 7006,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 1,
"total_cost": 0.07403900000000001,
"total_tokens": 23101,
"total_input_tokens": 15479,
"total_output_tokens": 7622,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 2,
"total_cost": 0.073269,
"total_tokens": 22724,
"total_input_tokens": 15108,
"total_output_tokens": 7616,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 3,
"total_cost": 0.074228,
"total_tokens": 23073,
"total_input_tokens": 15402,
"total_output_tokens": 7671,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 4,
"total_cost": 0.070882,
"total_tokens": 22465,
"total_input_tokens": 15207,
"total_output_tokens": 7258,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 5,
"total_cost": 0.074918,
"total_tokens": 23062,
"total_input_tokens": 15713,
"total_output_tokens": 7349,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 6,
"total_cost": 0.091158,
"total_tokens": 28034,
"total_input_tokens": 20155,
"total_output_tokens": 7879,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 7,
"total_cost": 0.15941200000000003,
"total_tokens": 51217,
"total_input_tokens": 41516,
"total_output_tokens": 9701,
"step_count": 15,
"duration_ms": 14300
},
{
"run_index": 8,
"total_cost": 0.07773100000000001,
"total_tokens": 23542,
"total_input_tokens": 15652,
"total_output_tokens": 7890,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 9,
"total_cost": 0.069976,
"total_tokens": 22122,
"total_input_tokens": 15549,
"total_output_tokens": 6573,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 10,
"total_cost": 0.07905,
"total_tokens": 25422,
"total_input_tokens": 17481,
"total_output_tokens": 7941,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 11,
"total_cost": 0.079327,
"total_tokens": 25104,
"total_input_tokens": 17983,
"total_output_tokens": 7121,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 12,
"total_cost": 0.075784,
"total_tokens": 24408,
"total_input_tokens": 17588,
"total_output_tokens": 6820,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 13,
"total_cost": 0.074235,
"total_tokens": 23488,
"total_input_tokens": 15809,
"total_output_tokens": 7679,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 14,
"total_cost": 0.070479,
"total_tokens": 22670,
"total_input_tokens": 15670,
"total_output_tokens": 7000,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 15,
"total_cost": 0.088546,
"total_tokens": 27984,
"total_input_tokens": 19839,
"total_output_tokens": 8145,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 16,
"total_cost": 0.118375,
"total_tokens": 37132,
"total_input_tokens": 29124,
"total_output_tokens": 8008,
"step_count": 12,
"duration_ms": 11900
},
{
"run_index": 17,
"total_cost": 0.07450100000000001,
"total_tokens": 23255,
"total_input_tokens": 15491,
"total_output_tokens": 7764,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 18,
"total_cost": 0.079526,
"total_tokens": 25108,
"total_input_tokens": 17781,
"total_output_tokens": 7327,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 19,
"total_cost": 0.068863,
"total_tokens": 22042,
"total_input_tokens": 15544,
"total_output_tokens": 6498,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 20,
"total_cost": 0.073868,
"total_tokens": 23103,
"total_input_tokens": 15318,
"total_output_tokens": 7785,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 21,
"total_cost": 0.078874,
"total_tokens": 24705,
"total_input_tokens": 17451,
"total_output_tokens": 7254,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 22,
"total_cost": 0.08968199999999998,
"total_tokens": 27137,
"total_input_tokens": 19725,
"total_output_tokens": 7412,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 23,
"total_cost": 0.086416,
"total_tokens": 27227,
"total_input_tokens": 19791,
"total_output_tokens": 7436,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 24,
"total_cost": 0.09673300000000001,
"total_tokens": 31066,
"total_input_tokens": 22815,
"total_output_tokens": 8251,
"step_count": 10,
"duration_ms": 10300
},
{
"run_index": 25,
"total_cost": 0.072008,
"total_tokens": 23012,
"total_input_tokens": 15441,
"total_output_tokens": 7571,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 26,
"total_cost": 0.080061,
"total_tokens": 24801,
"total_input_tokens": 17189,
"total_output_tokens": 7612,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 27,
"total_cost": 0.06948,
"total_tokens": 23228,
"total_input_tokens": 15951,
"total_output_tokens": 7277,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 28,
"total_cost": 0.075804,
"total_tokens": 23257,
"total_input_tokens": 15901,
"total_output_tokens": 7356,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 29,
"total_cost": 0.08214199999999998,
"total_tokens": 24765,
"total_input_tokens": 17293,
"total_output_tokens": 7472,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 30,
"total_cost": 0.082752,
"total_tokens": 25609,
"total_input_tokens": 17774,
"total_output_tokens": 7835,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 31,
"total_cost": 0.086657,
"total_tokens": 27578,
"total_input_tokens": 20048,
"total_output_tokens": 7530,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 32,
"total_cost": 0.07334299999999999,
"total_tokens": 22832,
"total_input_tokens": 15506,
"total_output_tokens": 7326,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 33,
"total_cost": 0.07761,
"total_tokens": 23445,
"total_input_tokens": 15720,
"total_output_tokens": 7725,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 34,
"total_cost": 0.07543899999999999,
"total_tokens": 22927,
"total_input_tokens": 15205,
"total_output_tokens": 7722,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 35,
"total_cost": 0.072292,
"total_tokens": 22353,
"total_input_tokens": 15203,
"total_output_tokens": 7150,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 36,
"total_cost": 0.072152,
"total_tokens": 22861,
"total_input_tokens": 15771,
"total_output_tokens": 7090,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 37,
"total_cost": 0.08685399999999999,
"total_tokens": 27752,
"total_input_tokens": 19973,
"total_output_tokens": 7779,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 38,
"total_cost": 0.116656,
"total_tokens": 37419,
"total_input_tokens": 29386,
"total_output_tokens": 8033,
"step_count": 12,
"duration_ms": 11900
},
{
"run_index": 39,
"total_cost": 0.084801,
"total_tokens": 27202,
"total_input_tokens": 19726,
"total_output_tokens": 7476,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 40,
"total_cost": 0.082901,
"total_tokens": 25325,
"total_input_tokens": 17311,
"total_output_tokens": 8014,
"step_count": 8,
"duration_ms": 8700
},
{
"run_index": 41,
"total_cost": 0.072596,
"total_tokens": 20811,
"total_input_tokens": 13528,
"total_output_tokens": 7283,
"step_count": 6,
"duration_ms": 7100
},
{
"run_index": 42,
"total_cost": 0.08780199999999999,
"total_tokens": 27509,
"total_input_tokens": 19900,
"total_output_tokens": 7609,
"step_count": 9,
"duration_ms": 9500
},
{
"run_index": 43,
"total_cost": 0.072908,
"total_tokens": 22714,
"total_input_tokens": 15599,
"total_output_tokens": 7115,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 44,
"total_cost": 0.09766899999999999,
"total_tokens": 30384,
"total_input_tokens": 22586,
"total_output_tokens": 7798,
"step_count": 10,
"duration_ms": 10300
},
{
"run_index": 45,
"total_cost": 0.067962,
"total_tokens": 21047,
"total_input_tokens": 13703,
"total_output_tokens": 7344,
"step_count": 6,
"duration_ms": 7100
},
{
"run_index": 46,
"total_cost": 0.07423,
"total_tokens": 23022,
"total_input_tokens": 15732,
"total_output_tokens": 7290,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 47,
"total_cost": 0.160374,
"total_tokens": 50827,
"total_input_tokens": 41791,
"total_output_tokens": 9036,
"step_count": 15,
"duration_ms": 14300
},
{
"run_index": 48,
"total_cost": 0.077837,
"total_tokens": 23113,
"total_input_tokens": 15177,
"total_output_tokens": 7936,
"step_count": 7,
"duration_ms": 7900
},
{
"run_index": 49,
"total_cost": 0.07689599999999999,
"total_tokens": 24527,
"total_input_tokens": 17672,
"total_output_tokens": 6855,
"step_count": 8,
"duration_ms": 8700
}
],
"cost_per_run": {
"min": 0.067962,
"max": 0.160374,
"mean": 0.08302474,
"std": 0.01898122780679557,
"p50": 0.07725299999999999,
"p75": 0.08601225000000001,
"p90": 0.09682660000000001,
"p95": 0.11760145,
"p99": 0.15990262
},
"tokens_per_run": {
"min": 20811.0,
"max": 51217.0,
"mean": 25991.9,
"std": 6178.480455977663,
"p50": 23515.0,
"p75": 27185.75,
"p90": 30452.2,
"p95": 37289.85,
"p99": 51025.9
},
"total_runs": 50,
"total_steps": 406
},
"patterns": [
{
"pattern_type": "context_growth",
"step_name": "review_loop",
"severity": "danger",
"description": "Context grows 3.2x across loop iterations. p95 cost is 4.8x the median. Linear projection will underestimate tail costs.",
"evidence": {
"growth_factor": 3.2
}
},
{
"pattern_type": "loop_count_variance",
"step_name": "review_loop",
"severity": "danger",
"description": "Iteration count ranges from 2 to 11 (median: 3). High variance drives unpredictable per-run costs.",
"evidence": {
"min_iterations": 2,
"max_iterations": 11
}
},
{
"pattern_type": "output_token_budget",
"step_name": "synthesize_response",
"severity": "warning",
"description": "max_tokens=4096 but median output is 847 tokens (21% utilization). Consider reducing to ~1,270 (1.5x p95).",
"evidence": {
"max_tokens": 4096,
"median_output": 847
}
}
],
"projection": {
"method": "montecarlo",
"traffic_volumes": [
10000
],
"projections": {
"10000": {
"daily_volume": 10000,
"monthly_cost": {
"p50": 14183,
"p75": 16742,
"p90": 18391,
"p95": 26847,
"p99": 41263,
"mean": 14867
}
}
}
},
"confidence": {
"tier": "HIGH",
"relative_width": 0.08
},
"score": {
"score": 31,
"zone": "red",
"zone_label": "needs attention",
"zone_color": "#E53E3E",
"total_savings": 5544,
"waste_pct": 0.54,
"recommendation_count": 3,
"scope_note": "Score based on detected patterns, model selection, and workflow optimization."
},
"recommendations": [
{
"id": "model-swap-research_queries",
"type": "model_swap",
"title": "Swap research_queries to claude-haiku-4-5",
"description": "research_queries performs retrieval summarization (output/input ratio: 0.28). Switching from claude-sonnet-4-6 to claude-haiku-4-5 saves $4,200/month at 10,000 daily runs. Estimate is conservative. Actual savings may be higher.",
"monthly_savings": 4200,
"confidence": "MODERATE",
"affected_steps": [
"research_queries"
],
"evidence": {},
"priority": 2520
},
{
"id": "workflow-review_loop-cap",
"type": "workflow",
"title": "Add iteration cap to review_loop",
"description": "review_loop runs up to 11 iterations on adversarial inputs. Capping at 5 iterations eliminates tail cost while preserving convergence on 94% of runs. Saves $890/month at 10,000 daily runs.",
"monthly_savings": 890,
"confidence": "HIGH",
"affected_steps": [
"review_loop"
],
"evidence": {},
"priority": 890
},
{
"id": "model-swap-classify_intent",
"type": "model_swap",
"title": "Swap classify_intent to gpt-4.1-nano",
"description": "classify_intent performs classification (output/input ratio: 0.08). Switching from gpt-4o to gpt-4.1-nano saves $454/month at 10,000 daily runs.",
"monthly_savings": 454,
"confidence": "HIGH",
"affected_steps": [
"classify_intent"
],
"evidence": {},
"priority": 454
}
]
},
"python_version": null,
"sdk_versions": null,
"api_endpoints": null,
"git_commit_hash": null,
"git_branch": null,
"git_diff_summary": null,
"profiling_start_time": null,
"profiling_end_time": null,
"inter_request_delay_ms": null,
"workflow_id": null,
"run_id": null,
"framework": "langgraph",
"pretia_version": "1.2.2",
"profiling_cost": 1.85,
"_runs_truncated": true,
"_runs_truncated_note": "Showing first 3 of 50 runs. Load the full profile JSON for complete data."
}