sub_lm), and submits structured results via SUBMIT().
Quickstart with Real-Time Text Streaming
Wrap your RLM module withdspy.streamify to stream reasoning tokens and intermediate actions directly to your terminal without waiting for the full multi-iteration execution loop to complete:
Why Use RLMs?
Standard large language models suffer from performance degradation (context rot) when processing inputs that span hundreds of thousands or millions of tokens. In addition, prompt-stuffing incurs high token costs because the entire document must be resent with every turn. RLMs eliminate these constraints by separating memory storage from the active LLM context window:- Context as an External Object: Documents or datasets live in the Python REPL memory as the
contextvariable rather than inside the LLM prompt. - Programmatic Data Filtering: The model writes Python scripts (regex, slicing, data structures, arithmetic) to inspect only relevant subsets.
- Sub-Model Delegation (
llm_query): When semantic comprehension of a chunk is required, the model callsllm_query(chunk)to delegate to a cost-effective, low-latency worker model. - Iterative Convergence: REPL output is fed back into the next iteration until the model satisfies its task and calls
SUBMIT(answer=...).