CCARF Practice Question
Correct answer: D
A: Increasing the cap does not address the root cause. The agent already finishes simple tasks by iteration 3 (stop_reason is 'end_turn') but the loop ignores this signal and keeps running. A higher cap would waste even more iterations.
B: This keeps the iteration count as the primary termination signal, which is the anti-pattern itself. Hard-coding a lower cap happens to fit this simple case but truncates genuinely complex requests that legitimately need more iterations, and it still ignores the stop_reason field that already reports completion. The fix is to make stop_reason the control signal, not to retune the cap.
C: The stop_reason field is the authoritative signal for loop control. The loop should exit on 'end_turn' and continue on 'tool_use'. An iteration cap can remain as a safety net for edge cases, but must not be the primary stopping mechanism, which is the anti-pattern causing unnecessary iterations here.
D: Parsing natural language for completion signals is an anti-pattern. The model may use such phrases while still having tool calls queued, and may complete work without such phrases. The stop_reason field already provides a deterministic, unambiguous signal.