Synchronous infinite loops and step budgets
If an agent runs too many synchronous steps in a tight loop without yielding — for example, awhile (true) loop with no await or async operations — the runtime triggers a circuit breaker to prevent an out-of-memory crash.
By default, the runtime limits consecutive budget refreshes to 10, which corresponds to 10,000 synchronous steps without yielding.
Error message and stack trace
When the limit is exceeded, execution stops with aUserError:
scope(N)— the scope level in the compiled output.{ variable=value }— a snapshot of local variables in that scope when execution stopped. Use this to identify which variables are growing or where the loop is stuck.
Configuring the limit
If your agent performs legitimate heavy synchronous processing and requires a higher budget, you can raise the cap:- Environment variable: Set
GUILD_MAX_BUDGET_REFRESHESto a higher integer. See Environment variables. - Runtime knob: Set
runtime.agent.max_budget_refreshes. See Runtime knobs.