The RLM constructor accepts several configuration options to control depth, iteration limits, timeouts, and budget constraints.
Key Configuration Options:
max_depth: Controls recursion levels. 0 is root only; 1 (default) allows root to call a plain LM; 2 allows one child RLM level.max_iterations: Maximum REPL iterations per RLM.repl_timeout: Hard timeout for each local Python step.max_concurrent_subcalls: Bounds batch concurrency.max_total_calls: Exact provider-call cap for the full recursion tree.max_total_tokens: Stop after reported usage crosses this value.max_total_cost_usd: Stop after reported cost crosses this value.max_elapsed_seconds: Deadline shared by root and child calls.max_retries: Retry transient provider failures (default is 0). Note: RLM disables hidden LiteLLM retries; use this parameter instead.repl_memory_limit_mb, repl_cpu_time_limit_seconds, repl_max_open_files: POSIX-specific worker-process limits.
rlm = RLM(
model="gpt-5-mini",
max_depth=2, # One child RLM level, then a plain-LM fallback
max_iterations=20, # Maximum REPL iterations per RLM
repl_timeout=5, # Hard timeout for each local Python step
max_output_chars=2000, # Observation truncation limit
max_concurrent_subcalls=4, # Bound batch concurrency
max_total_calls=24, # Exact provider-call cap for the full recursion tree
max_total_tokens=100_000, # Stop after reported usage crosses this value
max_total_cost_usd=0.10, # Stop after reported cost crosses this value
max_elapsed_seconds=300, # Deadline shared by root and child calls
max_retries=2, # Retry transient provider failures; default is 0
retry_backoff_seconds=1.0, # Exponential retry delay; Retry-After is respected
)