Dev.to AI 🤖 Ai 👁 0 📖 3 min read

Part 40: Quality, cost or latency: which wins?

Part 40 · One Agent, Five Platforms If you could optimise only one thing for an invoice agent, which would it be: quality, cost or latency? This part is my answer, and the reasoning behind it. On LinkedIn it comes with

Part 40: Quality, cost or latency: which wins?

Part 40 · One Agent, Five Platforms

If you could optimise only one thing for an invoice agent, which would it be: quality, cost or latency? This part is my answer, and the reasoning behind it. On LinkedIn it comes with a poll, and I'd like to see where people land.

Read this first: no hands-on build has been run yet. The numbers here are the illustrative ones from Part 35 and Part 36, made up to show the method. This part is a judgement, not a measurement.

Triangle of quality, cost and latency for an invoice agent, with the safety floor underneath and the levers that move each corner

1. My answer: quality

For an invoice exception agent, I'd optimise quality, and accept higher cost and slower answers to get it. Three reasons:

  • A wrong proposal is expensive. A person has to spot it, reject it and redo the work. That's minutes of an approver's time, against a few cents of tokens.
  • Tokens are cheap at this volume. In the illustrative example from Part 36, one invoice handled cost about $0.0375 in tokens. Even doubling that is small next to the cost of one bad proposal.
  • Latency hardly matters here. The agent proposes; a person approves. If the approval takes hours, a few extra seconds from the model don't change when the invoice gets posted.

That's for this agent. A customer-facing chat agent would weigh latency much more heavily. The answer depends on who waits.

2. Safety isn't on the triangle

One thing isn't up for trade: the safety floor. No write without an approval_id, named errors instead of guesses, the embedded instruction in GS30 ignored. These aren't part of "quality" to be balanced against cost. They're the floor the triangle stands on, and they're enforced by the tools, not the model.

So the real question is: above the floor, what do you optimise?

3. What the illustrative numbers suggest

In Part 35's illustrative table, the platform with the best exact checks (29 of 30) also had the lowest latency (5.8 s) and the fewest tokens (about 13,000). The worst on quality was worst on the other two as well.

Those numbers are made up, so they prove nothing. But they show a pattern I'd expect to see in real runs: retries link all three corners. A retry happens because something went wrong. It sends the whole context again, so it costs tokens, and it adds a round trip, so it costs time. Fix the cause and you often improve cost and latency too.

That's the main reason I'd start with quality: it's the corner most likely to pull the other two along.

4. The levers, and what they trade

Some changes move one corner at the expense of another:

  • A bigger model: often better quality, but more cost and more latency.
  • A smaller model for easy cases: less cost and latency, with a quality risk. Only after the golden set says it passes.
  • Prompt caching: less cost and often less latency, with no quality cost. As Part 36 showed, the static prompt and tool definitions were more than half the input in the example.
  • Trimming tool definitions and results: less cost, and often better quality, because there's less noise.
  • Fewer retries: better on all three, if you fix the cause rather than just lowering the limit.

The last three are the ones to do first. They don't make you choose.

5. And developer effort?

The poll has a fourth option: developer effort. It's a real cost, and Parts 11 to 25 scored it per platform. But it's paid mostly once, at build time, while quality, cost and latency are paid on every invoice. For a process that runs every day, I'd rather spend more effort once to get a better agent.

Quality, cost, latency or developer effort: which would you optimise first?

This series describes a reference build on a fictional company. No hands-on build has been run yet; the numbers mentioned are illustrative, from Parts 35 and 36, and this part is my judgement, not a measurement. Views are my own.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.