We asked an AI agent to print a five-page PDF.
The physical print command was a normal local CUPS action. It did not need a language model. The conversation around it processed 628,868 tokens.
The first request used 416,353 input tokens and 689 output tokens. A follow-up asking for double-sided printing used another 211,402 input tokens and 424 output tokens. We stopped to audit why.
What actually happened
The agent was operating inside a long-running Telegram conversation. That session carried operational history, agent instructions, tools, memory, prior messages and file context.
Each time the agent used a tool, the model received roughly 100,000 tokens of accumulated context again. The steps were individually reasonable:
- inspect the PDF and printer queues;
- submit the print job;
- verify the queue;
- receive the duplex correction;
- cancel the original job; and
- resubmit and verify the new job.
The expensive part was not one step. It was carrying a large conversation through every step when the task needed only the PDF path, printer queue and duplex setting.
What the request would cost
Of the 627,755 input tokens, 518,656 were cache reads and 109,099 were uncached. The model produced 1,113 output tokens. Prompt caching made most of the context cheaper, but not free.
| Model and pricing condition | Equivalent cost |
|---|---|
| GPT-5.6 Sol, cached input | US$0.84 |
| GPT-5.6 Sol, possible cache-write treatment | Up to US$0.97 |
| GPT-5.6 Sol, no cache discount | US$3.17 |
| GPT-5.6 Terra, cached input | US$0.34 |
| GPT-5.6 Terra, no cache discount | US$1.27 |
Switching to a lower-cost model is useful. It is not the right answer for a task that does not need model reasoning in the first place.
The model was in the wrong path
Printing is deterministic. Once the file and options are known, software should submit the job directly. A model may help decide what a document is or clarify an ambiguous instruction. It should not remain in the path after the decision has already been made.
This applies to more than printing: known service-health checks, fixed API thresholds, file moves, a single retry for a documented failure, and structured reports often have a deterministic normal path. Keep the model for exceptions, ambiguity and judgment.
The fix: remove the model
We built a profile-scoped /print command that validates a fresh PDF inside its expected cache and then calls CUPS directly. It has explicit paths for Brother duplex documents, one-sided RP4xx labels and read-only printer status.
The command was tested against duplex documents, labels, stale files and invalid PDFs. A fresh-process verification ran the handler and checked the session usage ledger. The model-usage delta was (0, 0, 0): zero API calls, zero input tokens and zero output tokens.
That is a stronger outcome than changing models. It removes the cost, latency and chance of an unnecessary model mistake from the normal path.
Controls after the incident
We made broader changes too. Routine conversations now default to GPT-5.6 Terra. Automatic context compression starts at 20% of the model window and targets 8%, rather than waiting until 50% and retaining 20%.
A local cost watchdog records model, input tokens, cache reads, cache writes, output tokens and estimated cost for every API call. It raises a concise warning when one call passes 50,000 input tokens or US$0.10.
The rule we are keeping
Use models for ambiguity, synthesis and decisions. Use code for known state transitions. Measure the request payload, not how simple the chat looks.
Automate cost governance before scale
A monthly cost dashboard tells you what you spent. It cannot recover money already burned by the wrong architecture.
Before a recurring AI automation goes live, ask three questions. Does the normal path require judgment? What does each run cost at the expected volume? Can a local script, slash command or event rule handle the normal path while the model handles exceptions?
We caught this with a five-page print job. The same failure pattern can appear anywhere a persistent agent carries a large context through a task that software already knows how to do.