Agent Harness Tutorial · Cost
How we keep it low
Cost is calls × tokens per call × price per token, plus waste. Each lever below pulls one of those down, and most of them are not about cost at all: they are the same harness parts that keep the agent safe.
| Lever | What it saves | Status |
|---|---|---|
| Deterministic first: the direct path | the whole model call: 104 ms and $0 instead of 7 s | built |
| Cache-friendly order | the system prompt and tool list stay byte-identical, so the provider can reuse them | built (no cached price in PRICES yet) |
| One context budget | drops old exchanges instead of re-sending everything | built (a target, not a ceiling: F-128) |
| Step and no-progress limits | a stuck loop can't keep paying | built |
| ModelSelector | the golden set picks the cheapest model that passes, per job | designed (Tier 14) |
| Token limits per agent and customer at APIM | one noisy customer can't eat the quota | not on the Consumption tier (F-39) |
36 cost anti-patterns are catalogued in the Series, such as LLM-15 "agent loop: same tool, same arguments", LLM-09 "full history sent every turn" and LLM-05 "a big model for a small job". The harness concerns prevent most of them by design: the loop prevents 15, context assembly prevents 09–12 and 28, the gateway prevents 05, 08, 24, 01 and 02.