TL;DR: Read the stop reason first, then the tool-call field, then usage. Empty content with a stop reason of
tool_callsis the model asking for a tool, not saying nothing; the harness dispatches the calls. Empty content withstopis a real empty answer and worth a retry or an escalation. Empty content withlengthmeans the output allowance was zero or tiny. A refusal or filter flag is its own case. A harness that checksif content:before anything else has three bugs, not one.
How to approach it
Say what a response actually contains before saying what you would do. It is a record with four parts: content (text, tool calls, or both), a stop reason, usage, and sometimes a refusal or filter signal. Then walk the stop reasons in order, because each one gives a different meaning to "content is empty". Ask one clarifying question if the interviewer leaves room: which provider, because the field names differ and some leave content null rather than empty.
A strong answer
Start with the branch the loop should take, keyed on the stop reason:
| Stop reason | What empty content means | What the harness does |
|---|---|---|
tool_calls (or tool_use) | The model asked for tools and wrote no prose beside the request, which is normal | Validate and dispatch each call, append results under their ids, loop |
stop (or end_turn) | A real empty answer | Treat as a failed step: retry once with the same context, then escalate with the reason |
length (or max_tokens) | The output allowance was exhausted before any visible text, often because max_tokens was tiny or a reasoning model spent it all | Retry with a larger allowance, or shorten the context; never return it as an answer |
content_filter or a refusal block | The provider or model declined | Record it, do not retry blindly, route to a person if the task needs one |
Then say why the check order matters. The commonest bug in a first harness is if not reply.content: return "". On a tool turn that line turns a correct tool request into a blank answer, so the agent appears to give up at exactly the moment it was about to do something useful. In a trace it shows up as a run that ends after one model call with an empty final message and no tool spans.
Show the normaliser you would put at the boundary, because providers spell everything differently:
STOP = {"stop": "stop", "end_turn": "stop", "tool_calls": "tool_calls",
"tool_use": "tool_calls", "length": "length", "max_tokens": "length",
"content_filter": "filtered"}
def classify(reply):
stop = STOP[reply["stop_reason"]]
calls = reply.get("tool_calls") or []
text = reply.get("content") or "" # None on many tool turns
if stop == "tool_calls" and calls:
return "dispatch"
if stop == "length":
return "incomplete"
if stop == "filtered":
return "declined"
return "answer" if text.strip() else "empty_answer"
print(classify({"content": None, "stop_reason": "tool_calls",
"tool_calls": [{"id": "c1", "name": "orders_get"}]})) # => dispatch
print(classify({"content": "", "stop_reason": "end_turn"})) # => empty_answer
print(classify({"content": "", "stop_reason": "max_tokens"})) # => incomplete
Close with usage. Even a blank reply carries token counts, and they tell you something: an input count near the window with a length stop says the context left no room for output, which is a context-management problem (The Context Window as a Budget), not a model problem.
What interviewers probe next
"The stop reason says tool_calls but the tool-calls field is empty too. Now what?" Treat it as a malformed response: log the raw body, retry the call once, and if it repeats, fail the step with a reason. Never guess a tool from the context.
"Why not just retry any empty reply?" Because a tool request is not a failure, and retrying it wastes a turn and the whole rereading cost of the context, and may get a different proposal back. Branch on the stop reason first; retry only the cases where retrying can help.
"Where does this check live?" In the adapter that normalises the provider's response into one shape, so the loop only ever sees four stop values and never a provider's spelling (One Loop, Many Providers).
What if?
What if · interview follow-ups
Hold your answer as the constraints change
A support agent's trace shows runs that end after a single model call with an empty final answer. Customers see a blank reply. The tool spans that should follow are missing.
Start here
What is the first field you read in those responses?
Not the text.
The stop reason. If it says tool_calls, the model asked for tools and the harness dropped the request because it tested content first. The fix is to branch on the stop reason before touching the text.
Carry it forwardThe loop branches on the stop reason, not on whether the text looks like an answer.
Weak answerAdding a prompt line asking the model to always say something.
Constraint changes
What if the stop reason is end_turn and the content really is empty?
Can retrying help here?
A real empty answer. Retry once with the same context (sampling can produce a different reply), and if it repeats, end the step with a recorded reason and hand the customer to a person rather than returning a blank.
Carry it forwardRetry only where a retry can change the outcome, and bound it.
Weak answerAn unbounded retry loop on empty replies.
Constraint changes
What if the stop reason is length and usage shows 118,000 input tokens?
Where did the output room go?
The context is nearly full, so the output allowance was squeezed to nothing. This is a context problem: clear old tool results or compact the history, then retry. Raising max_tokens cannot help when the window is the limit.
Carry it forwardUsage on a failed call is diagnostic data, not just a bill.
Weak answerRaising max_tokens and calling it fixed.
Now defend it
In one sentence, what does the harness read from every response before acting?
The stop reason to choose the branch, the tool-call field to find the request, the usage to track cost and context, and any refusal flag, with the text last.
How it's scored
Weak: Says the model "didn't answer" and proposes a retry or a stronger prompt, without mentioning the stop reason or the tool-call field.
Hire: Names the four fields, branches on the stop reason, explains that empty content on a tool turn is normal, and distinguishes the length case.
Strong Hire: Does all that, places the check in a provider-normalising adapter, reads usage as diagnostic data, bounds the retry, and describes what the trace of this bug looks like.
Common mistakes
- Testing
contentbefore the stop reason, which turns every tool request into a blank answer. - Treating
nulland""differently when both mean the model wrote no prose. - Retrying a tool-call turn as if it had failed, wasting a turn and the context rereading cost.
- Repairing or returning a
length-stopped reply as if it were complete. - Ignoring usage, so a context-full failure is misdiagnosed as a model problem.