Loop Mode

Loop Mode lets the agent work autonomously through multi-step tasks — iterating until the job is done or you stop it.

How It Works

Enable Loop Mode in the composer, set the goal and max iterations. The agent will:

Think → Act → Observe → Evaluate → Repeat

Each iteration produces a full agent response (think + tool calls + results). The agent decides whether to continue based on progress toward the goal.

You can stop at any time — the agent stops cleanly after the current iteration.

Controls

Click the Loop button next to the composer to open settings:

ControlWhat it does
Enable toggleTurn loop on/off for this message
Max iterationsSafety limit (1–100, server-capped)
GoalWhat the agent should accomplish

While looping, the toggle button shows a spinning Refresh icon.

Loop Events

The relay emits these events during loop execution:

EventWhen
loop_iterationStart of each iteration (number, max, prompt)
loop_completeAgent signals completion via internal marker
loop_max_iterationsSafety limit reached

When Loop Mode Excels

  • Batch operations — process file by file through a directory
  • Test-driven development — write test → run → fix → repeat
  • Refactoring — find pattern → refactor → verify → find next
  • Codebase audits — scan files for patterns, add missing pieces

Loop + Goal = Autonomous Execution

The loopGoal field guides the loop. Instead of "apply this fix", you describe the end state:

Goal: "Add proper error handling with try/catch to all route handlers in src/routes/"
      → Agent finds files → analyzes each → adds error handling → verifies → done

The agent plans and adapts internally — you don't need to describe each step.

Best Practices

  • Be specific about the goal — "Add error handling to all route files in src/routes/" not "fix errors"
  • Set realistic max iterations — 10 for medium tasks, 3 for small, 30+ only for bulk operations
  • Reference existing patterns — mention files to follow as examples in the goal text
  • Check in periodically — review intermediate results between iterations
  • Stop early if needed — all progress from completed iterations is preserved

Next Steps