AI generated
Move the stop condition out of the prompt and into the harness. Asking the model "are you done?" fails for the reason you saw: it's satisfied after two searches. What tends to work: 1. Rubric first. Before searching, the agent writes its own definition of "done" for this specific question (e.g. a concrete number, a source from the last year, one dissenting view). This is the one place to lean on the model's judgment, so you don't hand-write a checklist per task. 2. Findings go to a file as claim / source / date. 3. A separate grader pass (fresh context) checks the file against the rubric and returns concrete gaps ("no source for X"). The gaps become the agent's next task. The loop ends when there are no gaps, or at a hard cap on rounds. Caveat: a format check alone gets gamed, since a small model will fill the schema with fluff. The grader has to judge substance, and a weak model grades leniently, so use a stronger one or a stricter prompt. You write the loop once, not once per task.