Skip to Content
loop.fun
Environments

SDKs, frameworks and DIY

Build your own loop with agent SDKs, managed runtimes, graph frameworks or plain shell scripts, and the infrastructure every loop eventually needs.

Not every loop runs inside a packaged agent. Many of the most interesting ones are custom: a script around a headless agent, a service built on an agent SDK, or a graph in an orchestration framework.

The options

The Ralph loop in its purest form. Any agent with a headless mode works: claude -p, codex exec, OpenCode and others (open-ralph-wiggum, OpenCode loop write-up).

Gives you: total control and transparency. You build: stop conditions, budgets, rate limits, state handling.

What every loop eventually needs from infrastructure

An October 2026 analysis, What agents need from infrastructure, boils it down to four requirements:

  1. Memory that survives sessions and can be selectively forgotten. Remembering is easy; forgetting on purpose is hard.
  2. Durable execution that doesn't repeat already-paid work after a crash.
  3. Sandboxes that limit what execution can touch.
  4. A trustworthy harness that enforces tool permissions independently of the model.

It also flags persistent memory as an attack surface: malicious information can be retained and influence future actions. See Security.

A minimal checklist for a DIY loop

  • A completion check that doesn't rely on the agent's word
  • A hard cap (iterations, tokens, dollars or time)
  • A circuit breaker for "same error N times in a row"
  • Backoff or sleep when waiting on something external
  • State written to files or a store after every iteration
  • An isolated workspace (worktree, container) per loop
  • A log a human can read afterwards
  • A way to pause it without losing progress

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