Trace mining of 50,000 runs of a telecom billing-support agent gives the tool paths below. The team will hard-code the three most frequent paths as deterministic workflows ($0.008 per request) and keep the agent ($0.040 per run, assume the same on every path) for everything else; a classifier that routes every request costs $0.001. Assuming perfect routing, what is the new average cost per request?
| Tool path | Share of runs |
|---|---|
get_customer → get_invoice → explain_charges | 46% |
get_customer → get_usage → explain_charges | 21% |
get_customer → get_plan → compare_plans | 13% |
| 310 other distinct paths | 20% |
Show the answer and explanation
Correct answer: C, About $0.015 per request, roughly 62% less than today: 80% of requests run a $0.008 workflow, the 20% long tail stays on the $0.040 agent, and every request pays the $0.001 router.
Explanation Agent Patterns
Agents are for tasks whose path cannot be predicted. Traces often show that most production runs follow a few identical tool paths, and those paths can graduate into code.
The three frequent paths cover 46% + 21% + 13% = 80% of runs. Expected cost per request is the share-weighted mix plus the router, which every request pays:
| Component | Calculation | $ per request |
|---|---|---|
| Workflows | 0.80 × 0.008 | 0.0064 |
| Agent (long tail) | 0.20 × 0.040 | 0.0080 |
| Router | 1.00 × 0.001 | 0.0010 |
| Total | 0.0154 |
That is 0.0154 / 0.040 = 38.5% of today's cost, i.e. 61.5% (about 62%) less. Latency and reliability usually improve too: a workflow makes fewer model calls, follows a fixed order and can be unit-tested.
Why the other answers are wrong:
- $0.035 swaps the shares: it moves only 20% of traffic to workflows.
- $0.009 forces the long tail into the nearest workflow. Those 310 paths average about 0.06% of runs each; they are exactly the open-ended cases the agent exists for, and a wrong workflow gives a wrong answer.
- $0.025 averages the two costs without weighting them by traffic share.
Design details: give each workflow a fallback that hands the case to the agent when it meets an unexpected state, check that the frequent paths also share the same decision logic and not just the same tool names, and re-mine traces regularly as new frequent paths appear.
Interview tip: present this as a lifecycle: launch with an agent to discover the paths, then harden the frequent ones into workflows, measured with cost, latency and success per path.