Agents debug as well as your error messages let them

by

A thing that changed how we write code, not just how we use AI: error messages are prompts now.

Between actions, almost everything a coding agent knows about your running system is whatever the last tool call printed. When a test failure says expected 3, got 2 (missing: 'SKU-4431'), the agent greps the identifier, finds the site, fixes it — two turns. When it says Error: operation failed, the agent guesses. Then guesses again. Same model, same bug. The difference is how much the failure told it.

The failures that end debugging loops instead of extending them tend to carry four things: a location down to the expression, expected-versus-got with actual values, identifiers specific enough to search for, and fix hints kept separate from the problem statement (a wrong hint is worse than none, because models weight hints heavily).

And there's a billing angle. Every extra turn re-sends the entire conversation context, so a vague error string quietly becomes one of the more expensive lines you ship — it charges you a multiplier on every future debugging session that touches it.

What we changed: bare asserts so the test framework's own introspection survives (no exception-eating wrappers), operative values echoed in every raise (business values, never secrets), and tracebacks pasted to agents whole instead of paraphrased.

One honest caveat: models have read millions of standard tracebacks and far fewer bespoke error formats, so enrich the content inside familiar shapes rather than inventing a beautiful new format. And every one of these changes reads just as well to the human debugging at 2 a.m. — it's a no-regret spend.

32 views

Add a comment

Replies

Best

“Every extra turn re-sends the entire conversation context” is the part that really hurts. Bad errors are basically technical debt with a recurring API bill attached 😂

The 2 a.m. human debugger test is a great standard. If the error help both the agent and engineer, It's hard to argue against.

Including the actual failing values like a simple but powerful improvement. It gives agents something concrete investigate instead of focusing them to infer what went wrong from vague messages.