Why Your AI Agent Returns Empty Output, and the Fix: End on a Tool Call
The Agent Optimization Manual · No. 1
We were building a benchmark harness to compare context strategies for agents. You run the same research agent a few dozen times and compare cost and quality. Before we measured anything else, the harness showed us this:
28% of our agent runs ended with an empty deliverable. Not a wrong answer and not an error. The agent searched, fetched documents, and gathered every fact it needed. Then its final turn came back with nothing in it. No exception, no failure status, and the cost was fully incurred. The run looked successful everywhere except the one place that mattered.
If you run agents on Gemini and the last step is “now write up your findings,” this may be happening to you. Your logs probably don’t show it.
What the failure looks like
Our setup was a research agent on Gemini 2.5 (Flash and Pro both did it), making 15 to 35 tool calls per run and ending with a written briefing. Every model call and tool call was metered at our gateway. Across 57 runs, 16 (28%) ended like this:
- 10 to 20 successful tool calls, so the research really happened
- a final model turn that generated 300 to 600 completion tokens
- zero visible output text
- a clean “natural finish” as far as the loop could tell
The tokens are real and you pay for them, but they are thinking tokens with no answer behind them. The model reasons to the end of its final turn and stops without writing anything. It is intermittent and it tracks with large accumulated context. If your loop treats “the model stopped without asking for a tool” as done, it records the run as complete.
The failure is silent. A crash pages someone. An empty string that looks like a finished run does not.
What didn’t fix it
Each of these looked like the answer:
- Retries on the model call. They help with rate limits. Here the call “succeeds,” so nothing retries.
- Temperature 0. No effect. This isn’t sampling noise.
- Turning thinking off. On Flash it reduced one variant and added others. Pro won’t run with thinking disabled.
- A forced “wrap up now” turn when the deliverable came back empty. It rescued some runs, but you are asking the same model to do the same fragile thing.
All of these treat the symptom. From outside, an empty final turn can’t be told apart from a model that chose to say nothing.
The fix is a design rule
Our production agents had never hit this in months of scheduled runs. None of them end on a free-text turn. Each one delivers by calling a tool: send the email, post the message, write the record. The result travels in the tool call’s arguments. Our extraction code reads results only from outbound tool calls and refuses to fall back to whatever text the model wrote.
So we gave the benchmark agent the same contract. Instead of “write your final briefing,” it gets a briefing.submit tool with fields for exactly what the task needs. The rule is that calling it is the only way to deliver, and a written answer does not count.
The silent failure stopped. Same model, same task, same context sizes. In our checked-in dataset, the two clean tool-delivery arms delivered 12 of 12 through the tool, against 72% under text delivery. The warm-up cohort that this figure first described isn’t in the published dataset, so the claim covers the reproducible arms only.
A run that fails to deliver now shows up as unattempted. That is a yes-or-no you can alert on, where before it was an empty string passing as success. In our data, function-calling turns didn’t show the empty-finish behavior that free-text turns did.
Why it works
A tool call is a structured object that the API either emits or doesn’t. There is no thinking-only tool call. The failure changes from “silent empty text that parses as success” to “the tool was never called,” and that can be detected.
Once delivery is a tool call, you get three more things:
- A clear reliability metric. “Did the run call the submit tool” is a boolean. We track attempt rate separately from quality. An agent that researched well and delivered nothing is a reliability failure, and mixing it into quality hides both.
- Structured output. Scoring a prose briefing means string matching. Scoring
briefing.submit({companies: [...]})means comparing fields, and anything downstream gets data instead of paragraphs. - A clear stop signal. Our production loop stops re-prompting once the tool has been called. That also prevents the bug where an agent sends the same email twice.
The tool call is the unit you can see, meter, and apply rules to. Free text is where behavior goes unobserved, whether the question is security, cost, or plain delivery.
Checklist
If your agents end by writing text:
- Add a submit tool. Name the fields your task needs and tell the agent it is the only valid way to deliver.
- Refuse text fallback. If the run ends without the submit call, record it as unattempted. Don’t grade whatever text is lying around.
- Track attempt rate on its own. Ours was 72% before and 12 of 12 after in the reproducible arms. Before the change we would have told you it was close to 100%, because nothing was erroring.
- Meter your runs. We caught this because every model call was metered and the run rollups showed real cost with no deliverable attached. If your observability stops at “the run finished,” this failure is invisible.
Limits of the data
The mechanism evidence is specific to Gemini 2.5, where thinking-heavy final turns emit no visible text. We haven’t reproduced it on other providers. The baseline is one task shape: multi-step research, 15 to 35 tool calls, large accumulated context. The design rule doesn’t depend on the mechanism, though. Structured delivery is easier to observe than prose on any provider. We’ll publish the full benchmark separately, with the raw data.
Every number here is metered, not estimated: per-call cost and token accounting captured at the gateway. It is the same instrumentation the cost X-ray runs on.
Part of The Agent Optimization Manual: measured lessons on making agents cheaper and more reliable.
What is an Agentic Control Plane? → · Read Manual No. 3: don’t give up on cheap models →
Update (Jul 11): a day after publishing, we saw the same signature in an agent we don’t control. While testing our plugin for Nous Research’s Hermes Agent, Gemini 2.5 Flash returned empty turns to Hermes’s own loop. Because every call was metered, we watched its retry logic make four identical model calls before giving up with “the model returned empty content.” Same model, same signature, someone else’s harness. Hermes retries where our pre-fix loop quit, which is better. But resending the same request is a coin flip. A nudge-and-continue turn recovers it.
Running coding agents? ACP records each tool call its hook sees and makes the dangerous shell commands (a force-push, destructive SQL, curl | sh) wait for you. One command, free up to 5 agents:
curl -fsSL https://agenticcontrolplane.com/install.sh | bash
irm https://agenticcontrolplane.com/install.ps1 | iex