Skip to Content
loop.fun
Remedies

A control plane for loop side effects

One egress point for every model and tool call a loop makes: loop-aware retries, idempotency, budgets, approvals and a state sink. What exists, what's missing.

The problem

A loop that only edits files in a sandbox can be thrown away and re-run. A loop that touches the outside world can't. Once a loop places phone calls, writes to a CRM, sends Slack or email messages, opens tickets or charges a card, every external call needs the same things:

  • Credentials, scoped to the loop and revocable.
  • Retries with backoff, and a decision about when to stop retrying.
  • Rate limits, both the provider's and your own.
  • A budget, in dollars, not only tokens. SMS, voice minutes and data-enrichment lookups cost money too.
  • Idempotency. If the iteration crashes after sending the email but before recording that it did, the next iteration must not send it again.
  • An audit trail tying each action to the goal that caused it.
  • Somewhere to write state, so the loop can resume after an interruption.

Today each loop builder wires this up per tool and per harness. Loops make it worse in two specific ways:

  1. Iterations repeat by design. A goal loop that continues after a crash, or a Ralph loop restarting with fresh context, will happily re-execute side effects it has no memory of.
  2. Loops fail quietly. An agent that loops or drifts still returns 200 with normal latency, so standard monitoring doesn't fire (Morph, OptScale). secondary reporting

What already exists

The plumbing exists, in slices. Each layer sees part of a loop's traffic and none of it knows it's a loop.

LayerExamplesCoversDoesn't cover
LLM gatewaysOpenRouter, Portkey, LiteLLM, Cloudflare AI Gateway, HeliconeModel routing, fallbacks, retries, caching, spend caps, request logsTool calls and their side effects; any notion of goal or iteration
Tool integration platformsComposio, Arcade, NangoManaged OAuth, pre-built tools for CRMs, messaging and SaaS APIs; some offer syncs and webhooksModel spend, cross-tool budgets, loop semantics
MCP gatewaysCloudflare MCP Portals, Zuplo, Workato and others (Zuplo, MintMCP)Central auth, per-agent and per-tool rate limits, audit logs tied to a personModel calls, state, retries across iterations
Durable executionTemporal, Inngest, Restate, DBOS (overview)Retries, step-level checkpoints, durable sleep and wait-for-event, pausing for human approvalRequires rewriting the loop as workflow code; no integrations or model routing included

A few market notes, all secondary reporting from 2026 gateway comparisons (Future AGI, Eden AI, dupple):

  • Gateways are consolidating into security vendors. One comparison reports that Palo Alto Networks completed its acquisition of Portkey in May 2026, folding it into its agent-governance offering. Another reports Helicone in maintenance mode after an acquisition in March 2026.
  • Integration vendors are mostly reviewed by each other. Much of the Composio, Arcade and Nango comparison material is written by one of the three. Treat the verdicts as marketing.
  • Durable execution is being re-pitched as agent infrastructure. Its pause, resume and wait-for-event primitives are exactly what waiting goals lack, but adopting it means restructuring your loop.

The gap: loop semantics

None of these layers can answer: "Is call #4 of iteration 17 of the goal 'follow up with every stale lead' the same action as call #4 of iteration 16?" That question is the whole difference between a safe retry and a duplicate message to a customer.

What's missing is a layer that understands the loop's own structure:

Goal
The long-lived objective. Owns the budget, the credentials scope and the audit trail.
Run
One attempt at the goal, from start to stop (achieved, budget-limited, abandoned).
Iteration
One pass of the loop. The unit that gets retried, resumed or thrown away.
Intent
A side effect the loop means to cause ("email lead 4711 about renewal"). The key for idempotency.

The proposal: one egress for every loop

A proxy that every model call and every tool call goes through, speaking an OpenAI-compatible API for models and MCP for tools, so existing harnesses only need a base URL change. Each request carries goal, run and iteration ids, mapped onto the OpenTelemetry GenAI conventions (invoke_agent and execute_tool spans) where possible (Dash0).

The low-hanging version

Tag and log only. An OpenAI-compatible and MCP proxy that forwards everything unchanged and records each call with its goal and iteration. Zero behavior change, so zero risk to adopt. It immediately feeds loop-native reporting.

Budgets and breakers. Per-goal dollar caps and identical-failure breakers. Both are policies over the log you already have.

Idempotency for a handful of dangerous tools. Email, SMS, voice calls and CRM writes first. These are where duplicates hurt.

Webhook-to-wake. Replace polling for the two or three events loops wait on most.

Build on, not against. There's no reason to rebuild hundreds of OAuth connectors: credentials and connectors can come from an integration platform, model routing from an existing gateway, and durable execution can be an optional backend. The value is the loop semantics on top.

Risks and open questions

  • One egress is one target. Concentrating every credential a loop uses in one service is a security trade-off, not a free win. It needs the same scrutiny as any secrets store.
  • Latency. Gateways add milliseconds per call; vendor benchmarks claim anywhere from 1 to 40 ms contested. Negligible for loops, but it adds up for chatty inner tool loops.
  • The harnesses may absorb it. Hermes has gateway spending limits and Codex has per-goal token budgets. If harness vendors add idempotency and wake-on-event, the standalone case shrinks to cross-harness and multi-tool users.
  • Crowded market, thin moat. Routing and auth are commodities. If loop semantics aren't clearly valuable, this is just another gateway.

Further reading

loop.fun

Patterns, hints and tools for designing the loops that keep agents working, and for widening the set of loops you can think of.

© 2026 loop.fun · CC BY 4.0

On this page