When a traditional program fails, we have good tools to find out why. Logs, traces, and debuggers connect each output to the code that produced it. AI agents do not work like this. An agent decides what to do based on a prompt and on what the model learned during training. The same input can give a different output on each run. When the agent makes a mistake, we can see the wrong answer, but we usually cannot see the reasoning that led to it.
Reasoning models such as OpenAI’s o1 partly solve this problem, because they write out their reasoning. But they are slow and expensive. Many real products, such as code completion and live customer support, need fast models that answer immediately. Those models do not show any reasoning. This project asks: can we recover the reasoning of a fast agent without slowing it down or changing what it does?
This post is based on our paper Watson: A Cognitive Observability Framework for the Reasoning of LLM-Powered Agents, written with Benjamin Rombaut, Sogol Masoumzadeh, Kirill Vasilevski, and Ahmed Hassan. The paper has the full method, setup, and results.
Observability for agents
In normal software, observability means measuring things like latency, errors, and resource use. For software built on AI agents, which we call agentware, we think this is not enough. We also need cognitive observability: the ability to see why an agent made a decision, not only what it did.
We divide cognitive observability into three parts:
- Semantic feedback: how users and other systems react to the agent’s outputs.
- Output integrity: signals such as sentiment and hallucination detection.
- Reasoning traces: the thought process behind a decision.
Watson focuses on the third part. It is the most difficult part for fast models, because those models do not produce any reasoning that we can record.
How Watson recovers reasoning
Watson does not touch the primary agent. Instead, it runs a second agent next to it, which we call the surrogate agent. The surrogate uses the same model and the same decoding settings (temperature, top_p, and so on). It receives the same input as the primary agent, and it also sees the primary agent’s final output. Its job is to write the reasoning that connects the input to that output.
Watson does this in one of two ways, depending on the model:
- Fill-in-the-middle (FIM). Some models are trained to fill a gap between a prefix and a suffix. Watson puts the agent’s input as the prefix and the agent’s output as the suffix. The model then writes the middle part, which is the reasoning.
- Repeated chain-of-thought (RepCoT). For models without FIM, Watson asks the surrogate to reason step by step many times. It keeps only the reasoning paths that end with the same answer as the primary agent.
A plausible explanation is not always the true explanation. So Watson verifies each reasoning path with prompt attribution. We use PromptExp, our method that measures how much each part of the prompt influenced the output. If a reasoning path says that the agent chose an answer because of a certain phrase, that phrase must have a real effect on the primary agent’s output. Watson keeps the verified paths and summarizes them into one meta-reasoning.
An example
One MMLU question in professional law asked about a merchant’s offer. The agent chose option B, “is valid for three months,” but the correct answer was option A. Watson’s reasoning trace showed what happened. The agent understood that the question was about merchant offers. It looked at each option. Then it gave too much importance to how long the offer stays valid, and it rejected the other options because they did not seem to answer the question directly.
With this information, we could write a short hint that corrected the specific mistake. With the hint, the agent chose the correct answer.
Results
We tested this idea on two tasks. For each wrong answer, Watson recovered the reasoning, and we used it to create a hint for the agent. We did not change the model or the agent’s design.
- MMLU: accuracy improved by 7.58 percentage points (13.45% relative) with the FIM version. One attempt with a hint (73.8%) was as good as three attempts without a hint (73.8%). This means the hints gave the agent more useful information than extra attempts did.
- AutoCodeRover on SWE-bench-lite: Pass@1 improved by 7.76 percentage points (12.31% relative). The agent solved 8 more issues out of 38 that it had first solved incorrectly. On valid issues, the success rate went from 63.11% to 70.87%.
What this enables
For developers, Watson makes agent failures easier to debug. You can see which step in the reasoning went wrong, change the prompt with a clear reason, and find patterns in errors across many cases.
For multi-agent systems, agents can observe each other’s reasoning. One agent can check and correct another. When an error appears late in a long task, you can trace it back to the early decision that caused it.
For production systems, Watson makes it possible to correct an agent at runtime with automatic hints, without training the model again.
Takeaways
We do not have to choose between fast agents and agents that we can understand. Watson recovers the hidden reasoning of a fast agent without changing its behavior, and it checks that the reasoning is real. The improvements on MMLU and on code repair show that this is not only about understanding agents. When you can see why an agent fails, you can make it better.
