rlm_repl
diapason.agents.rlm_repl
¶
Sandboxed REPL environment for the RLM agent.
Provides a persistent Python namespace with injected helper functions
(llm_query, llm_batch, FINAL, FINAL_VAR) that the RLM
agent's generated code uses to decompose context and make recursive
sub-LM calls.
RLMRepl
¶
Sandboxed Python REPL with persistent namespace for the RLM agent.
Parameters¶
llm_query_fn:
Callback invoked when REPL code calls llm_query(prompt).
llm_batch_fn:
Callback invoked when REPL code calls llm_batch(prompts).
max_output_chars:
Maximum characters captured from stdout per execution.
final_answer
property
¶
Return the termination value.
is_terminated
property
¶
Check if FINAL/FINAL_VAR was called or answer["ready"] is True.
execute(code)
¶
Execute code in the persistent namespace and return captured stdout.
Raises are caught and returned as error strings.
get_variable(name)
¶
Get a variable from the REPL namespace.
security_check(code)
¶
Check code for dangerous patterns. Returns error message or None.
set_variable(name, value)
¶
Set a variable in the REPL namespace.