Recursive Language Models with DSPy + Modal for secure long-context code execution
Project description
fleet-rlm
Secure, cloud-sandboxed Recursive Language Models (RLM) with DSPy and Modal.
fleet-rlm provides a production-ready implementation of Recursive Language Modeling aligned with the DSPy RLM API. It gives your AI agent a secure "computer" in the cloud to read, search, and analyze massive datasets without local resource constraints.
Paper | Contributing | Docs
Architecture
User ─── CLI / API / WebSocket ─── RLMReActChatAgent (dspy.Module)
│
┌──────────────┼──────────────┐
│ │ │
load_document rlm_query edit_file
list_files (recursive) search_code
read_file_slice ... ...
│ │
▼ ▼
ModalInterpreter ── dspy.RLM
│ │
▼ ▼
Modal Sandbox (isolated Python REPL)
├── Persistent Volume (/data/)
├── Execution Profiles (ROOT / DELEGATE / MAINTENANCE)
└── Session State (per workspace/user)
Features
- Interactive Agent:
RLMReActChatAgent(adspy.Module) combines fast, interactive chat with deep, recursive task execution viarlm_query. - DSPy Aligned: Implements
dspy.RLM,dspy.Module, anddspy.Toolinterfaces — compatible with DSPy optimizers (BootstrapFewShot,MIPROv2). - Secure Sandbox: Code runs in isolated Modal containers with persistent storage volumes, execution profiles, and sensitive data redaction.
- Recursive Delegation: Large tasks are broken down via
rlm_querysub-agents with depth enforcement to prevent infinite recursion. - PDF Ingestion: Native document loading via MarkItDown with pypdf fallback; OCR guidance for scanned PDFs.
- Session State: Per-workspace, per-user session persistence with manifests stored on Modal volumes.
- MCP Server: Expose fleet-rlm capabilities as an MCP tool server via
serve-mcp. - Observability: Real-time streaming of thoughts, tool execution, trajectory normalization, and structured logging.
Quick Start
1. Install
pip install fleet-rlm
Optional extras for server and MCP support:
pip install fleet-rlm[server] # FastAPI server + WebSocket
pip install fleet-rlm[mcp] # MCP server
pip install fleet-rlm[full] # All extras
2. Configure
Set up your Modal and LLM credentials:
modal setup
modal volume create rlm-volume-dspy
modal secret create LITELLM DSPY_LM_MODEL=openai/gpt-4o DSPY_LLM_API_KEY=sk-...
3. Run
# Interactive chat (requires OpenTUI / Bun)
fleet-rlm code-chat --opentui
# One-shot task
fleet-rlm run-basic --question "What are the first 12 Fibonacci numbers?"
# Document analysis
fleet-rlm run-architecture --docs-path docs/architecture.md --query "Extract all components"
# API server (FastAPI + WebSocket)
fleet-rlm serve-api --port 8000
# MCP server
fleet-rlm serve-mcp --transport stdio
Development Setup
# Clone and install
git clone https://github.com/qredence/fleet-rlm.git
cd fleet-rlm
uv sync --extra dev
# With server/MCP support
uv sync --extra dev --extra server --extra mcp
# Copy environment template
cp .env.example .env
# Quality gate
uv run ruff check src tests && uv run ty check src && uv run pytest -q
Documentation
- Concepts — Core architecture (Agent, RLM, Sandbox)
- User Flows — Interaction diagrams (Chat, Tools, Delegation)
- Architecture — System components and hierarchy
- Tutorials — Step-by-step lessons
- How-To Guides — Installation, deployment, troubleshooting
- CLI Reference — Full CLI command reference
- HTTP API Reference — Server endpoints and WebSocket protocol
- Source Layout — Package structure guide
Contributing
We welcome contributions! Please see our Contribution Guide and run the quality gate before submitting:
uv run ruff check src tests && uv run ty check src && uv run pytest -q
License
MIT License — see LICENSE.
Based on Recursive Language Modeling research by Alex L. Zhang (MIT CSAIL), Omar Khattab (Stanford), and Tim Kraska (MIT).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fleet_rlm-0.4.2.tar.gz.
File metadata
- Download URL: fleet_rlm-0.4.2.tar.gz
- Upload date:
- Size: 161.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3d949034d0d446153f1286ceea905e17d21b84a27ce93bb8b55f6f99c4a9862
|
|
| MD5 |
b5af56eb6be657a651bb537eb008a4e4
|
|
| BLAKE2b-256 |
76c3610e29d2944bcaf44867c2d2a049031d3e46521da60b2ad4ecc24847c23a
|
Provenance
The following attestation bundles were made for fleet_rlm-0.4.2.tar.gz:
Publisher:
release.yml on Qredence/fleet-rlm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fleet_rlm-0.4.2.tar.gz -
Subject digest:
f3d949034d0d446153f1286ceea905e17d21b84a27ce93bb8b55f6f99c4a9862 - Sigstore transparency entry: 953421859
- Sigstore integration time:
-
Permalink:
Qredence/fleet-rlm@5bc919f5856df339b1d6ed1bd326f1c67569a211 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Qredence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bc919f5856df339b1d6ed1bd326f1c67569a211 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file fleet_rlm-0.4.2-py3-none-any.whl.
File metadata
- Download URL: fleet_rlm-0.4.2-py3-none-any.whl
- Upload date:
- Size: 200.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
597bfa6c4c6a358a67e5c7c65d8341b6051e5123b2c6bb73f08d07572d3d7623
|
|
| MD5 |
11bd4c1912af0b8b95695c5082e8b42b
|
|
| BLAKE2b-256 |
39bd67ba9701a365f79791a0c8ec9731cea0f2ccf36d29061e9e5af85c4e5402
|
Provenance
The following attestation bundles were made for fleet_rlm-0.4.2-py3-none-any.whl:
Publisher:
release.yml on Qredence/fleet-rlm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fleet_rlm-0.4.2-py3-none-any.whl -
Subject digest:
597bfa6c4c6a358a67e5c7c65d8341b6051e5123b2c6bb73f08d07572d3d7623 - Sigstore transparency entry: 953421860
- Sigstore integration time:
-
Permalink:
Qredence/fleet-rlm@5bc919f5856df339b1d6ed1bd326f1c67569a211 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Qredence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bc919f5856df339b1d6ed1bd326f1c67569a211 -
Trigger Event:
workflow_dispatch
-
Statement type: