You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 51c25b0
Browse filesBrowse the repository at this point in the historyBrowse files
-`FINAL_VAR(variable_name)`: For returning final answers
176
+
-`answer`: A dict (`{"content": "", "ready": False}`); the model sets `answer["content"]` and `answer["ready"] = True` to return a final answer. The env surfaces the content on `REPLResult.final_answer` once `ready` flips truthy.
177
177
-`SHOW_VARS()`: For listing available variables
178
178
179
179
### Example Structure
@@ -208,7 +208,7 @@ class MyEnvironment(NonIsolatedEnv):
208
208
- Environment works with basic RLM completion calls
209
209
-`cleanup()` properly releases all resources
210
210
- Sub-LM calls work via `llm_query()` and `rlm_query()`
211
-
- Reserved names (`llm_query`, `rlm_query`, `context`, `history`, `FINAL_VAR`, `SHOW_VARS`) are restored after each execution
211
+
- Reserved names (`llm_query`, `rlm_query`, `context`, `history`, `answer`, `SHOW_VARS`) are restored after each execution
212
212
213
213
## Architecture: Environment ↔ LM Handler Communication
|`rlm_query(prompt, model=None)`| Spawn a child RLMwith its own REPLfor deeper thinking. Falls back to `llm_query` at max depth. |
552
555
|`rlm_query_batched(prompts, model=None)`| Spawn multiple child RLMs. Falls back to `llm_query_batched` at max depth. |
553
-
|`FINAL_VAR(variable_name)`|Return a REPL variable as the final answer. |
556
+
|`answer`|A dict (`{"content": "", "ready": False}`). Set `answer["content"]` to your final answerand`answer["ready"] = True` to terminate the run. |
554
557
|`SHOW_VARS()`| List all user-created variables in the REPL. |
555
558
|`print(...)`| Print output visible to the model in the next iteration. |
556
559
@@ -570,7 +573,7 @@ rlm = RLM(backend="unknown")
570
573
# Raises: ValueError: Unknown backend: unknown
571
574
```
572
575
573
-
If the RLM exhausts `max_iterations` without finding a `FINAL()` / `FINAL_VAR()` answer, it prompts the LM one more time to provide a final answer based on the conversation history.
576
+
If the RLM exhausts `max_iterations` without the model setting `answer["ready"] = True`, it prompts the LM one more time to provide a final answer based on the conversation history.
574
577
575
578
RLM raises explicit exceptions when limits are exceeded:
0 commit comments