Skip to content
Fourohtwo

Should the loop run another iteration

agent402.tools/api/loop-gate

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, budgetExce

SolanaBaseUnchecked
POSThttps://agent402.tools/api/loop-gate

UptimeNot checked yet

30 days agoToday

Try it

Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.

The response shows up here.

Call it from an agent

import { createPayer } from "fourohtwo";

// One agent key pays USDC on Base or USDG on Robinhood Chain,
// inside the spending rules you set on Fourohtwo.
const pay = createPayer({ privateKey: process.env.AGENT_KEY });
const res = await pay("https://agent402.tools/api/loop-gate", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"goal":"Find three peer-reviewed studies on sleep and memory consolidation published since 2020, with DOIs.","budget":{"maxUsd":0.5,"spentUsd":0.52},"history":[{"summary":"One study found (Nature Neuroscience 2021).","iteration":2},{"summary":"Second study found (Sleep 2023); PubMed search for a third in progress.","iteration":3}],"iteration":4,"lastOutput":"Found two studies with DOIs (Nature Ne),
});
console.log(await res.json());

Example input

{"goal":"Find three peer-reviewed studies on sleep and memory consolidation published since 2020, with DOIs.","budget":{"maxUsd":0.5,"spentUsd":0.52},"history":[{"summary":"One study found (Nature Neuroscience 2021).","iteration":2},{"summary":"Second study found (Sleep 2023); PubMed search for a third in progress.","iteration":3}],"iteration":4,"lastOutput":"Found two studies with DOIs (Nature Ne