An AI response can end with a plausible sentence and still be incomplete. A summary may omit its final section, or a generated data object may stop before a closing bracket. The transport request succeeding does not establish that the requested work finished.
Some APIs return a stop-reason field alongside the content. Anthropic’s stop-reason documentation distinguishes a normal end of turn from reaching a token limit, requesting tool use and other stopping conditions. Applications should read the documented values rather than guessing from the final punctuation.
Make completion an explicit state
Imagine an internal assistant producing a three-section briefing. The application can check both the stop reason and its own required sections before offering a “ready for review” status. This is an illustrative design, not a guarantee that structural validation makes the content accurate.
If generation stopped at a limit, preserve the partial result with an incomplete status. Decide whether to request a continuation, reduce the task, or retry with an appropriate budget. Do not silently publish the partial text as a finished briefing.
Test the failure path deliberately
Use a harmless test input and an intentionally small output budget. Confirm that the application detects the resulting stop condition and that the interface explains what happened. Then test a normal completion and a legitimate tool request separately.
- Record the response identifier and stop reason without exposing private prompt content in logs.
- Keep retries bounded so an incomplete response cannot trigger an endless loop.
- Validate any combined continuation for repeated or missing sections.
- Retain factual review after the output passes structural checks.
When the API asks for a tool, handle that according to the documented interaction protocol; it is not the same event as running out of output space. A refusal or another terminal condition likewise needs its own treatment.
The useful design change is small but consequential: completion becomes something the system checks and records. A neat-looking block of text no longer receives a finished status merely because no more characters arrived.

