Between 2023 and 2025, almost all large and medium-sized Brazilian companies experienced the phase of touristic fascination with generative Artificial Intelligence. Innovation committees were created, dozens of proofs of concept (PoCs) were presented on big screens, and practically every software product gained a little star icon promising an intelligent assistant.
In 2026, however, the conversation in the office of the Chief Financial Officer (CFO) and the Chief Technology Officer (CTO) changed its tone. With the opportunity cost of capital in Brazil running at high levels, no one approves million-dollar budgets anymore just because a technology is fascinating. The question now is surgical: what is the real unit economics of this AI agent in production?
Understanding the mathematics behind autonomous agent-based systems is what separates engineering teams that are generating historical productivity leverage from those that are merely swapping payroll for out-of-control dollar-denominated API invoices.
1. From "Cost per Token" to "Cost per Resolved Task"
The first mistake made by those starting to scale AI agents in operations (whether in customer service, legal triage, financial reconciliation, credit analysis, or code automation) is looking only at the price per million tokens table published by model providers.
An isolated token seems incredibly cheap. The problem is that an agentic workflow in production does not make a single simple question-and-answer call. To resolve a complex logistics ticket or analyze a tax discrepancy, an agent frequently:
- Reads a long context of documents and customer history (heavy input tokens).
- Makes internal reasoning calls (chain-of-thought or reasoning tokens).
- Queries two or three external tools (database, ERP, tracking API), reads the returns in JSON format, and revises the plan if it finds an error.
- Passes the response through a second validating model (guardrail) before displaying it to the user.
Suddenly, a single support interaction that seemed to cost fractions of a cent consumed 80 thousand tokens accumulated across five steps. If at the end of this cycle the agent fails to resolve the problem and transfers the annoyed customer to a human agent (who will need to read everything again from scratch), you paid twice: you paid the cloud in dollar and you paid the full human hour.
Therefore, the only financial metric that matters in AI engineering is the CPTR (Cost per Successfully Resolved Task):
Executive formula for CPTR:
CPTR = (Inference + Infrastructure + Human Supervision) / Tasks Successfully Completed Without Rework
| Operational Dimension | Naive Approach (Prototype / PoC) | Production Engineering with Unit Economics |
|---|---|---|
| Main metric tracked | Quantity of messages or gross cost per token | Cost per Resolved Task (CPTR) and real resolution rate |
| Language model choice | A single giant frontier model for everything | Routing: small/fast models for 80% of the steps |
| Execution of calculations and business rules | Asking the LLM to calculate in the prompt (high risk and cost) | Traditional deterministic code triggered via Tool Calling |
| Context handling | Sending all history and manuals at each turn | Prompt caching, lean vector search, and structured state |
| Impact on company margin | Unpredictable (explodes when volume scales) | Predictable, auditable, and lower than the previous manual cost |
2. Four architectural techniques to cut AI costs by up to 80%
When we treat AI agents as production engineering systems subject to the laws of economic efficiency, four architectural decisions completely change the financial viability of the project:
- Separate what is probabilistic from what is deterministic: Large Language Models are brilliant for understanding unstructured natural language, extracting intents from messy text, or synthesizing documents. But they are expensive and slow to validate a CPF, sum items on an invoice, or check if an order is within the 7-day return window. Never spend tokens where a traditional code
if/elsesolves the issue in microseconds with zero cost and 100% precision. - Model Routing: in any business operation, about 70% to 80% of demands are variations of simple and known cases, and only 20% require deep reasoning. Put a lightweight classifier or a compact and cheap model at the entrance; trigger the large advanced reasoning models exclusively when the complexity of the task requires it.
- Aggressive use of Prompt Caching and lean state: if your agent needs to consult a 30-page internal policy manual on every call, ensure that these fixed instructions remain in the cached prefix of the request, reducing the repetitive reading cost by up to 75% to 90%.
- Strict iteration limits (loop circuit breakers): autonomous agents that receive permission to try to fix their own errors when an API fails can enter infinite loops of attempts during the night, burning thousands of dollars in minutes. Every agent in production needs to have a strict ceiling of steps (max steps) and a maximum token budget per session.
3. Overcoming Baumol's Law with financial responsibility
We have seen in other articles of this series that Brazil has suffered for thirty years from Baumol's Law: more than two thirds of our economy is in the services sector, where manual and administrative office work has grown very little in productivity.
Artificial Intelligence agents are our generation's greatest tool to break this stagnation, allowing a lean team of analysts, lawyers, doctors, accountants, or engineers to process ten times more volume with superior quality. But this revolution only sustains itself on your company's balance sheet if it is guided by the classic discipline of engineering: measuring every cent of input, auditing the quality of the output, and ensuring that technology lowers the unit cost of the operation with each passing month.
Continue deepening: also read Critical systems architecture: how much does 1 hour of downtime cost and the 99.99% paradox and Clean energy and AI Data Centers: the great competitive advantage Brazil cannot waste. Also explore the practice of DevOps Engineering and Critical Architecture, the Diagnostic Tools, and the Case Studies.
References and verifiable readings
- FinOps Foundation (2025). Cloud & AI Unit Economics Working Group Framework. Linux Foundation.
- NIST (2023). Artificial Intelligence Risk Management Framework (AI RMF 1.0). U.S. Department of Commerce.
- Baumol, W. J., & Bowen, W. G. (1966). Performing Arts, The Economic Dilemma: A Study of Problems Common to Theater, Opera, Music, and Dance. Twentieth Century Fund.
Cost Per Resolved Task (CPTR) vs. Manual Handling
Measure whether your AI agent generates real operating margin after accounting for failed runs that escalate to human operators (paying twice).
Blended cost of R$ 4.94/task (65% savings or R$ 271,800/mo)
At a 75% autonomous resolution rate, pure agent CPTR is R$ 1.92, bringing overall blended unit cost (including 25% human escalations) down from R$ 14.00 to R$ 4.94.
Reference FX for cloud/token inference: R$ 5.70/USD. Includes full human rework cost on failed escalations.
Good ideas keep the conversation going.
Share this article or publish the visual deck to your Stories and Feed.

Cesar Zanis
15+ years leading software architecture, database performance, FinOps, and applied AI across enterprise operations. Built and scaled an engineering organization from zero to 20+ developers.
Enjoyed this article?
I publish practical analyses on software architecture, FinOps, data, AI, management, and economics directly on LinkedIn.
Continue Reading
Take this analysis further with data and sources
All visual cards of this article are ready above to share on your Stories, Feed, WhatsApp, or LinkedIn with full sources.



