a-handoff-is-not-a-sta…
AgentAt the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Two engineers disagree about how the loop should end. One wants an explicit `finish` tool that the model must call. The other wants the loop to end as soon as an assistant turn has no tool call in it. Which do you pick, and what does each choice get wrong?
Claude Code
$ npx -y skills add rohitg00/ai-engineering-from-scratch --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
id: finish-tool-or-silence title: Explicit finish tool or no-tool-call stop card: agents kind: tradeoff level: 2 roles: [agentic-ai-engineer, ai-developer-relations-engineer] rounds: [ml-breadth, design-review] tags: [stop-condition, finish-tool, early-termination, agent-loop] minutes: 8 lessons: [phases/14-agent-engineering/01-the-agent-loop, phases/19-capstone-projects/20-agent-harness-loop-contract] manuals: [] practice: [] cheatsheet: [agent-harness] related: [agents/budget-exhausted-looks-like-an-answer] updated: 2026-11-03
Two engineers disagree about how the loop should end. One wants an explicit `finish` tool that the model must call. The other wants the loop to end as soon as an assistant turn has no tool call in it. Which do you pick, and what does each choice get wrong?
Both are stop conditions, and a production loop needs both plus a budget. The no-tool-call stop is simple and matches how models behave, but it ends the run on any turn where the model answers in prose, including a turn where it only meant to think aloud. An explicit finish gives a clear signal with a payload, but a model that never calls it runs until the budget. Pick the no-tool-call stop as the default, keep finish as a tool that carries the final answer, and make the budget the last guard.
| Stop | Strength | Weakness | |---|---|---| | Explicit `finish` tool | The end is a structured call with the answer as its payload, so the caller never guesses which text is the answer | A model that forgets to call it, or that is told not to, never stops on its own | | No tool call in the turn | Needs no extra tool, and matches a model that answers when it is done | A turn of prose in the middle of a task ends the run early with an incomplete answer |
The lesson asks which choice is safer against early-termination bugs. The no-tool-call stop ends the run on the first prose turn. A model that writes a plan before it acts, or that comments on an observation without a next call, stops the loop too soon. An explicit finish cannot end early by accident, because ending needs a deliberate call.
Neither stop helps when the model loops. A finish tool is never called by a model that keeps retrying. A no-tool-call stop never fires when every turn has a call. The turn budget is the stop that does not depend on what the model emits. In the harness contract the budget yields to the caller, and the caller decides whether to resume.
1. Register `finish` as a tool whose argument is the final answer. 2. Treat a turn with no tool call as a stop with reason `no_tool_call`, and return the prose as a draft answer, not a final one. 3. Cap turns per task class, and yield at the cap. 4. Record which stop fired in the result, so that the caller and the eval can tell them apart.
The [agent loop lesson](../../../phases/14-agent-engineering/01-the-agent-loop/) lists both stops and asks which is safer, and the [harness loop contract](../../../phases/19-capstone-projects/20-agent-harness-loop-contract/) turns the budget into a yield.
At the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Read this part of the harness loop. A subscriber on `before_tool_call` raises `HookAbort` on the second step of a three-step…
The task given to the agent was to fix one login bug. The diff changes the login route, an email helper, the database driver, the…
The product team wants a single maximum number of turns that applies to every run of your agent. The agent handles one-line…
Read this run method from the toy agent loop. A caller shows the returned string to the user as the answer. What is wrong with…
A long coding session has used most of its context window. The runtime offers to summarize the older turns and keep going. Your…
Reviews the repository's shared Claude Code configuration (.claude/settings.json, CLAUDE.md, .claude/rules/, .mcp.json and the…
Generate comprehensive API documentation by scanning Express route files.
Advisor to a busy principal. Optimizes for the user's time, attention, and decision quality. One of the starter-kit council…