{"slug":"agent402-tools-api-loop-gate-6ee671","title":"Should the loop run another iteration?","host":"agent402.tools","method":"POST","resource":"https://agent402.tools/api/loop-gate","category":"other","description":"Should the loop run another iteration? Send the goal, the iteration that just finished (lastOutput, iteration), and optionally maxIterations, a budget { spentUsd, maxUsd }, the history of earlier iterations (up to 20 of { iteration, summary }, oldest first) and constraints; get back decision (contin","price_listed":0.001,"price_asked":null,"state":"effects","state_label":"Not tested: has real-world effects","checks_7d":0,"answered_7d":0,"latency_ms_median":null,"reported_calls_30d":2,"reported_payers_30d":2,"networks":["algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=","eip155:10","eip155:1329","eip155:137","eip155:143","eip155:42161","eip155:42220","eip155:43114","eip155:4663","eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","stellar:pubnet"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"budget":{"maxUsd":0.5,"spentUsd":0.52},"goal":"Find three peer-reviewed studies on sleep and memory consolidation published since 2020, with DOIs.","history":[{"iteration":2,"summary":"One study found (Nature Neuroscience 2021)."},{"iteration":3,"summary":"Second study found (Sleep 2023); PubMed search for a third in progress."}],"iteration":4,"lastOutput":"Found two studies with DOIs (Nature Neuroscience 2021, Sleep 2023). A third search of PubMed returned review articles only.","maxIterations":6},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"properties":{"budget":{"properties":{"maxUsd":{"exclusiveMinimum":0,"type":"number"},"spentUsd":{"minimum":0,"type":"number"}},"type":"object"},"constraints":{"items":{"type":"string"},"type":"array"},"goal":{"type":"string"},"history":{"items":{"properties":{"iteration":{"minimum":1,"type":"integer"},"summary":{"type":"string"}},"required":["iteration","summary"],"type":"object"},"type":"array"},"iteration":{"minimum":1,"type":"integer"},"lastOutput":{"type":["string","object"]},"maxIterations":{"minimum":1,"type":"integer"}},"required":["goal","lastOutput","iteration"],"type":"object"},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"}},"required":["input"],"type":"object"},"history":[],"description_full":"Should the loop run another iteration? Send the goal, the iteration that just finished (lastOutput, iteration), and optionally maxIterations, a budget { spentUsd, maxUsd }, the history of earlier iterations (up to 20 of { iteration, summary }, oldest first) and constraints; get back decision (continue, stop or escalate), reason, confidence (0 to 1), the checks that produced it (goalMet, budgetExceeded, iterationsExhausted, repeating, stuck, constraintBreached) and nextStep (iterate.","last_updated":"2026-10-21T02:17:28.405Z","schemes":["exact","upto"]}