Home › Glossary › Systems › Ralph Loop

Beginner · Systems

Ralph Loop

Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.

TL;DR. A loop-engineering pattern where you give an agent a detailed task — often from a spec or PRD — and have it keep working until the job is done.

Technical Definition

A loop-engineering pattern where you give an agent a detailed task — often from a spec or PRD — and have it keep working until the job is done.

How it works

Named in GitHub's 2026 agent vocabulary, a Ralph loop is the long-running special case of loop engineering: instead of a conversation, the agent receives a complete specification and iterates against it autonomously — writing code, running tests, comparing results against the requirements, and continuing until every requirement passes. The pattern works because the spec acts as an external source of truth that survives context-window truncation; the agent re-reads it each iteration rather than relying on memory. The risks are spec gaps (the agent optimizes exactly what you wrote, not what you meant) and runaway cost, so production Ralph loops carry iteration budgets and human checkpoints.

Related Concepts

  • Persistent Background Agents — Long-running autonomous agents — such as Meta's Muse Code and Replit's Agent 4 — that build, debug, and ship software over days from a single natural-language instruction.
  • Outcome-Based Evaluation — Judging AI systems by the quality of real-world outcomes they produce rather than the surface quality of individual answers.
  • Agent Harness — Everything surrounding a model that makes it useful in real workflows — the tools, permissions, memory, context, and orchestration around the model itself.
  • Loop Engineering — The practice of designing repeatable systems around agents, instead of manually prompting them for one task at a time.
Edit with