# What Are the Dependencies for the RLM Project? A Complete Guide to Core, Optional, and Dev Requirements

> Discover RLM project dependencies. Explore core Python packages like OpenAI and Anthropic, optional extras for sandbox providers, and dev requirements for testing.

- Repository: [az/rlm](https://github.com/alexzhang13/rlm)
- Tags: how-to-guide
- Published: 2026-06-18

---

**The RLM project requires eight core Python packages—including OpenAI, Anthropic, Google GenAI, and Rich—with optional extras for sandbox providers like Modal, E2B, Daytona, and Prime, plus development groups for testing and linting.**

The Recursive Language Models (RLM) package is a Python library that orchestrates large language model (LLM) calls, execution environments, and recursive REPL logic. Understanding the dependencies for the RLM project is essential before installation, as the library supports multiple LLM providers and isolated sandbox environments. All dependency specifications are centralized in the [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml) file at the repository root.

## Core Runtime Dependencies

The minimal set of dependencies required to run RLM in a standard environment consists of eight packages declared in the `[project]` section of [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml):

- **`anthropic>=0.75.0`** – Provides the **Claude** family of models via the Anthropic API. RLM routes chat completions through Anthropic when configured for that provider, as implemented in [`rlm/clients/anthropic_client.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/clients/anthropic_client.py).

- **`google-genai>=1.56.0`** – Supplies the **Gemini** models through Google's Generative AI API. This enables RLM to interact with Google-hosted LLMs.

- **`openai>=2.14.0`** – Enables access to **OpenAI** models (GPT-4, GPT-3.5, etc.). This is the most common client used by the built-in `OpenAIClient` class in [`rlm/clients/openai_client.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/clients/openai_client.py).

- **`portkey-ai>=2.1.0`** – Wraps multiple LLM providers behind a single **Portkey** proxy, simplifying credential management and request routing across different backends.

- **`pytest>=9.0.2`** – Used for **unit testing** of the library itself. The test suite lives under `tests/` and validates core behavior.

- **`python-dotenv>=1.2.1`** – Loads **environment variables** from a `.env` file, allowing API keys and configuration to be injected without hard-coding credentials.

- **`requests>=2.32.5`** – General-purpose **HTTP client** used by the LM handler in [`rlm/core/lm_handler.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/core/lm_handler.py) to forward requests in sandboxed environments.

- **`rich>=13.0.0`** – Provides **pretty-printed console output** (tables, colors, progress bars) for the REPL and debugging utilities.

These packages constitute the minimal set required for basic RLM functionality without isolated sandbox support.

## Optional Feature-Specific Extras

RLM supports isolated code execution through multiple sandbox providers. Each provider's extra adds the sandbox SDK plus `dill` for state serialization. These are defined under `[project.optional-dependencies]` in [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml).

### Modal Sandbox Support

Install with `pip install "rlm[modal]"` to add:

- **`modal>=0.73.0`** – The Modal SDK for serverless GPU/CPU sandboxes.
- **`dill>=0.3.7`** – Advanced serialization library for preserving Python object state across sandbox boundaries.

Used in [`rlm/environments/modal_repl.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/environments/modal_repl.py) for executing code in Modal environments.

### E2B Code Interpreter

Install with `pip install "rlm[e2b]"` to add:

- **`e2b-code-interpreter>=0.0.11`** – E2B's secure code execution environment.
- **`dill>=0.3.7`** – For state serialization.

### Daytona Sandbox

Install with `pip install "rlm[daytona]"` to add:

- **`daytona>=0.128.1`** – Daytona sandbox backend SDK.
- **`dill>=0.3.7`** – State serialization support.

### Prime Sandbox

Install with `pip install "rlm[prime]"` to add:

- **`prime-sandboxes>=0.2.0`** – Prime sandbox environment SDK.
- **`dill>=0.3.7`** – For pickling Python state.

### IPython/Jupyter Integration

Install with `pip install "rlm[ipython]"` to add:

- **`ipython>=8.0.0`** – Interactive Python shell.
- **`jupyter_client>=8.0.0`** – Jupyter protocol client.
- **`ipykernel>=6.0.0`** – IPython kernel for Jupyter.
- **`dill>=0.3.7`** – Serialization support.

Enables local interactive sessions with full Jupyter REPL capabilities.

## Development and Testing Dependencies

For contributors working on the RLM source code, two dependency groups are defined in the `[dependency-groups]` section of [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml):

### Development Group

Install with `pip install "rlm[dev]"` to add:

- **`pre-commit`** – Git hook framework for running checks before commits.
- **`ruff`** – Fast Python linter and code formatter.
- **`ty`** – Type checking utilities.

### Testing Group

Install with `pip install "rlm[test]"` to add:

- **`pytest`** – Core testing framework.
- **`pytest-asyncio`** – Support for async test cases.
- **`pytest-cov`** – Coverage reporting.

To install both development and testing dependencies simultaneously:

```bash
pip install "rlm[dev,test]"

```

## How Dependencies Are Used in the Source Code

The declared dependencies are wired throughout the RLM architecture. In [`rlm/clients/openai_client.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/clients/openai_client.py), the `openai` package provides the `OpenAI` class for API communication. The [`rlm/clients/anthropic_client.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/clients/anthropic_client.py) module similarly depends on the `anthropic` library for Claude model access.

For sandbox environments, [`rlm/environments/modal_repl.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/environments/modal_repl.py) imports the `modal` library only when the optional extra is installed, using `dill` to serialize state between the local process and remote sandbox. The [`rlm/core/lm_handler.py`](https://github.com/alexzhang13/rlm/blob/main/rlm/core/lm_handler.py) uses `requests` to forward HTTP requests from isolated environments to the appropriate LLM client.

The `python-dotenv` dependency is typically invoked at import time to load API keys from `.env` files before client initialization.

## Installation Examples

### Basic Installation (Core Dependencies Only)

```bash
pip install rlm

```

This installs the eight core packages sufficient for local LLM orchestration with OpenAI, Anthropic, or Google models.

### Installation with Modal Support

```bash
pip install "rlm[modal]"

```

This adds the Modal SDK and `dill` for running code in serverless sandboxes.

### Full Development Setup

```bash
pip install "rlm[dev,test,modal,e2b]"

```

Installs core dependencies plus development tools, testing frameworks, and multiple sandbox backends.

## Code Examples

### Basic Usage with OpenAI

The following example uses the core `openai` dependency to contact GPT-4 and the `rich` library for formatted output:

```python
from rlm.clients.openai_client import OpenAIClient
from rlm.core.repl import RLMRepl

# Initialise an OpenAI client (API key read from .env or env var)

client = OpenAIClient(model_name="gpt-4o-mini")

# Create a REPL that uses the client

repl = RLMRepl(lm_client=client)

# Ask a recursive question

result = repl.run("Summarize the main ideas of the paper \"Attention Is All You Need\".")
print(result.final_answer)

```

### Running in a Modal Sandbox

This example requires the `modal` extra, which pulls in `modal` and `dill`:

```python
from rlm.environments.modal_repl import ModalREPL
from rlm.clients.openai_client import OpenAIClient

client = OpenAIClient(model_name="gpt-4o-mini")
modal_env = ModalREPL(lm_client=client)

# Execute code remotely; the sandbox communicates back via HTTP

modal_env.run("import math; answer['content'] = str(math.sqrt(16)); answer['ready'] = True")
print(modal_env.last_result.final_answer)  # -> "4.0"

```

### Switching to Anthropic Claude

Demonstrates the interchangeable client interface built on the `anthropic` dependency:

```python
from rlm.clients.anthropic_client import AnthropicClient
from rlm.core.repl import RLMRepl

client = AnthropicClient(model_name="claude-3-5-sonnet-20240620")
repl = RLMRepl(lm_client=client)

print(repl.run("Write a short poem about recursion.").final_answer)

```

## Summary

- **Core dependencies** for the RLM project include eight packages: `anthropic`, `google-genai`, `openai`, `portkey-ai`, `pytest`, `python-dotenv`, `requests`, and `rich`, all specified in [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml).
- **Optional extras** provide sandbox support for Modal, E2B, Daytona, and Prime, each requiring `dill` for state serialization, plus an `ipython` extra for Jupyter integration.
- **Development groups** include `dev` (pre-commit, ruff, ty) and `test` (pytest, pytest-asyncio, pytest-cov) for contributors.
- Install specific extras using bracket notation: `pip install "rlm[modal]"` or `pip install "rlm[dev,test]"`.
- The `rlm/clients/` modules consume provider SDKs (`openai`, `anthropic`), while `rlm/environments/` modules use optional sandbox SDKs and `dill`.

## Frequently Asked Questions

### What Python version is required for RLM?

The RLM project requires Python 3.8 or higher, as specified in the `requires-python` field of [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml). All core dependencies maintain compatibility with this minimum version while supporting newer Python releases up to 3.12.

### Can I use RLM without installing the optional sandbox extras?

Yes. The eight core dependencies provide full functionality for local LLM orchestration and recursive REPL execution. Sandbox extras like `modal`, `e2b`, `daytona`, and `prime` are only required if you need to execute code in isolated remote environments rather than the local Python process.

### How do I install RLM with support for multiple LLM providers?

Install the base package plus any specific provider extras you need. For example, `pip install "rlm[modal,e2b]"` installs core dependencies plus Modal and E2B sandbox support. Note that OpenAI, Anthropic, and Google GenAI support is included in the core installation, so no extras are needed for those providers.

### Where are the dependencies declared in the source code?

All dependencies are centralized in [`pyproject.toml`](https://github.com/alexzhang13/rlm/blob/main/pyproject.toml) at the repository root. Core runtime dependencies appear under `[project]`, optional extras under `[project.optional-dependencies]`, and development groups under `[dependency-groups]`. This file is located at the root of the `alexzhang13/rlm` repository.