# alexzhang13/rlm

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/alexzhang13-rlm).**

2,609 stars · 485 forks · Python · mit

## Links

- GitHub: https://github.com/alexzhang13/rlm
- Homepage: https://arxiv.org/abs/2512.24601v1
- awesome-repositories: https://awesome-repositories.com/repository/alexzhang13-rlm.md

## Description

rlm is an LLM code execution engine and orchestration framework designed to coordinate multiple language model calls and recursive sub-tasks through a programmable environment. It provides a sandboxed REPL environment and a recursive context processor to handle inputs that exceed standard token limits by programmatically decomposing prompts.

The project differentiates itself through a reinforcement learning training harness used to teach models how to utilize recursive calls and code execution. It includes a reasoning visualization system that records and renders execution trajectories to analyze how models decompose and solve complex tasks.

The system supports secure code execution via pluggable backends, including cloud virtual machines, isolated containers, and local processes. It manages state across multiple turns using a REPL-based environment and allows for the injection of custom tools and external functions into the execution flow.

The framework is implemented in Python.

## Tags

### Software Engineering & Architecture

- [Code Execution Engines](https://awesome-repositories.com/f/software-engineering-architecture/code-execution-engines.md) — Provides a dedicated engine for managing the lifecycle and execution of code snippets generated by language models.
- [Execution Backends](https://awesome-repositories.com/f/software-engineering-architecture/pluggable-backends/execution-backends.md) — Implements pluggable execution backends that switch between local processes, containers, and cloud virtual machines based on security needs.

### Artificial Intelligence & ML

- [LLM Orchestrators](https://awesome-repositories.com/f/artificial-intelligence-ml/llm-orchestrators.md) — Orchestrates the workflow between various language models and external tools, including interactive IPython shells.
- [Model Backend Registrations](https://awesome-repositories.com/f/artificial-intelligence-ml/model-backend-registrations.md) — Configuring a list of distinct language models to execute specific tasks within a single automated workflow. ([source](https://alexzhang13.github.io/rlm/backends/))
- [Provider-Agnostic Model Interfaces](https://awesome-repositories.com/f/artificial-intelligence-ml/provider-agnostic-model-interfaces.md) — Standardizes connections to various language model backends using a unified, provider-agnostic API and configuration.
- [Recursive Language Models](https://awesome-repositories.com/f/artificial-intelligence-ml/recursive-language-models.md) — Implements recursive execution to explore and process large input contexts that exceed standard token limits.
- [Recursive Task Decomposers](https://awesome-repositories.com/f/artificial-intelligence-ml/recursive-task-decomposers.md) — A tool for handling near-infinite input lengths by programmatically decomposing prompts and executing recursive model calls.
- [Reinforcement Learning Training Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/reinforcement-learning-training-pipelines.md) — Provides a reinforcement learning training harness that records execution trajectories to teach models recursive task decomposition.
- [Code Execution Environments](https://awesome-repositories.com/f/artificial-intelligence-ml/code-execution-environments.md) — Uses a programmable REPL environment to read, transform, and partition large context variables via executed code. ([source](https://alexzhang13.github.io/blog/2025/rlm/))
- [Long Context Processing](https://awesome-repositories.com/f/artificial-intelligence-ml/long-context-processing.md) — Divides massive input contexts into smaller subsets and maps recursive calls across them for processing. ([source](https://alexzhang13.github.io/blog/2025/rlm/))

### Part of an Awesome List

- [Code Execution Environments](https://awesome-repositories.com/f/awesome-lists/ai/code-execution-environments.md) — Runs model-generated code in isolated sandboxes or containers to safely perform computations and data processing.
- [Tool-Use Integrations](https://awesome-repositories.com/f/awesome-lists/ai/ai-model-and-api-integration/tool-use-integrations.md) — Allows injecting external functions and data as callable tools for the language model to utilize during execution. ([source](https://alexzhang13.github.io/rlm/environments/))

### Programming Languages & Runtimes

- [Sandboxed Code Execution Environments](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/sandboxed-code-execution-environments.md) — Executes generated code within a sandboxed REPL environment to manipulate data and maintain state across operations. ([source](https://alexzhang13.github.io/rlm/))
- [Custom Execution Environment Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/sandboxed-code-execution-environments/custom-execution-environment-definitions.md) — Allows the definition of custom sandbox templates via Dockerfiles to support specialized language versions and dependencies. ([source](https://alexzhang13.github.io/rlm/environments/modal/))

### Security & Cryptography

- [Code Sandboxing Environments](https://awesome-repositories.com/f/security-cryptography/application-and-system-security/sandbox-and-isolation/code-sandboxing-environments.md) — Provides isolated environments using containers and virtual machines to securely execute untrusted model-generated code.

### System Administration & Monitoring

- [Reasoning Chain Visualizers](https://awesome-repositories.com/f/system-administration-monitoring/reasoning-chain-visualizers.md) — Records and renders execution trajectories to visualize how models decompose and solve complex tasks.
- [Agent Trajectory Logs](https://awesome-repositories.com/f/system-administration-monitoring/audit-logs/agent-trajectory-logs.md) — Records prompts, generated code, and execution results into structured files to analyze model task decomposition. ([source](https://alexzhang13.github.io/rlm/trajectories/))
- [Trajectory Visualizers](https://awesome-repositories.com/f/system-administration-monitoring/audit-logs/agent-trajectory-logs/trajectory-visualizers.md) — Renders recorded execution trajectories into a visual interface to inspect the flow of code and model interactions. ([source](https://cdn.jsdelivr.net/gh/alexzhang13/rlm@main/README.md))

### Development Tools & Productivity

- [Execution State Persistence](https://awesome-repositories.com/f/development-tools-productivity/database-session-management/session-state-persistence/execution-state-persistence.md) — Stores prompts and intermediate results as variables in a REPL to allow data modification across multiple turns. ([source](https://alexzhang13.github.io/rlm/))

### DevOps & Infrastructure

- [Container Execution](https://awesome-repositories.com/f/devops-infrastructure/container-images/container-execution.md) — Provides a secure, reproducible environment with a private filesystem by running code within isolated containers. ([source](https://alexzhang13.github.io/rlm/environments/docker/))
- [Custom Container Images](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/image-management-tools/custom-container-images.md) — Uses custom container images to define specific language versions and pre-installed libraries for reproducible code execution.
- [Code Execution Sandboxes](https://awesome-repositories.com/f/devops-infrastructure/execution-environments/code-execution-runtimes/code-execution-sandboxes.md) — Provides low-overhead execution for trusted tasks by running code within the host process using a restricted namespace. ([source](https://alexzhang13.github.io/rlm/environments/local/))
- [Execution Sandboxes](https://awesome-repositories.com/f/devops-infrastructure/execution-sandboxes.md) — Runs untrusted code in ephemeral cloud virtual machines to secure the host system. ([source](https://alexzhang13.github.io/rlm/environments/modal/))
- [REPL Workspace Management](https://awesome-repositories.com/f/devops-infrastructure/workspace-managers/repl-workspace-management.md) — Maintains a persistent REPL workspace where variables and intermediate results survive across multiple model interaction turns.

### Operating Systems & Systems Programming

- [Process Isolation](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/process-isolation.md) — Ensures full namespace isolation by running generated code in separate subprocess kernels. ([source](https://alexzhang13.github.io/rlm/environments/ipython/))
- [Subprocess-Based Isolation](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/process-isolation/subprocess-based-isolation.md) — Runs generated code in separate subprocesses to ensure namespace isolation and strictly enforce execution timeouts.
