Metadata-Version: 2.4
Name: fleet-rlm
Version: 0.4.0
Summary: Recursive Language Models with DSPy + Modal for secure long-context code execution
Author: Qredence
License-Expression: MIT
Project-URL: Homepage, https://github.com/qredence/fleet-rlm
Project-URL: Repository, https://github.com/qredence/fleet-rlm
Project-URL: Issues, https://github.com/qredence/fleet-rlm/issues
Project-URL: Documentation, https://fleet-rlm.readthedocs.io/
Keywords: dspy,llm,modal,recursive-language-model,rlm,agents
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS.md
Requires-Dist: dspy==3.1.3
Requires-Dist: modal>=1.3.2
Requires-Dist: pydantic<3,>=2.12.5
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: pyyaml<7,>=6.0.3
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
Requires-Dist: typer<1,>=0.21.1
Provides-Extra: dev
Requires-Dist: pre-commit>=3.7; extra == "dev"
Requires-Dist: pytest>=8.2; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: ruff>=0.8; extra == "dev"
Requires-Dist: ty>=0.0.1a16; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5.1; extra == "dev"
Provides-Extra: mcp
Requires-Dist: fastmcp<3,>=2.12.5; extra == "mcp"
Requires-Dist: httpx[socks]<1,>=0.28.1; extra == "mcp"
Requires-Dist: pydantic<3,>=2.12.5; extra == "mcp"
Provides-Extra: server
Requires-Dist: fastapi[standard]<1,>=0.115; extra == "server"
Requires-Dist: pydantic<3,>=2.12.5; extra == "server"
Requires-Dist: scalar-fastapi<2,>=1.5.0; extra == "server"
Requires-Dist: uvicorn[standard]<1,>=0.32; extra == "server"
Requires-Dist: websockets<16,>=14; extra == "server"
Provides-Extra: full
Requires-Dist: fastmcp<3,>=2.12.5; extra == "full"
Requires-Dist: httpx[socks]<1,>=0.28.1; extra == "full"
Requires-Dist: pydantic<3,>=2.12.5; extra == "full"
Requires-Dist: fastapi[standard]<1,>=0.115; extra == "full"
Requires-Dist: uvicorn[standard]<1,>=0.32; extra == "full"
Requires-Dist: scalar-fastapi<2,>=1.5.0; extra == "full"
Requires-Dist: websockets<16,>=14; extra == "full"
Dynamic: license-file

# fleet-rlm

**Secure, cloud-sandboxed Recursive Language Models (RLM) with DSPy and Modal.**

Allow your LLMs to write code that explores massive datasets or long documents in the cloud, without downloading them locally.

[Documentation](https://fleet-rlm.readthedocs.io/) | [Paper](https://arxiv.org/abs/2501.123) | [Contributing](CONTRIBUTING.md)

---

```mermaid
graph TD
    User[User/Agent] -->|Question| CLI[fleet-rlm CLI]
    CLI -->|Plan| DSPy[DSPy Planner]
    DSPy -->|Generate Code| Modal[Modal Sandbox]
    Modal -->|Execute safely| Cloud[Cloud Environment]
    Cloud -->|Result| Modal
    Modal -->|Answer| User

    style Modal fill:#f9f,stroke:#333,stroke-width:2px
    style DSPy fill:#bbf,stroke:#333,stroke-width:2px
```

## What is this?

**fleet-rlm** gives your AI agent a secure "computer" in the cloud. Instead of trying to shove 10,000 pages of text into a prompt, the agent writes Python code to:

1.  **Search** and filter data in a remote sandbox (Modal).
2.  **Read** only what matters.
3.  **Synthesize** the answer.

This approach, called **Recursive Language Modeling**, mimics how humans solve research tasks: we don't memorize the library; we look things up.

## Quick Start: Claude Code Integration

### 1. Install & Initialize

Install the package and register the RLM skills with your local Claude Code agent (`~/.claude/`).

```bash
# Install fleet-rlm
uv pip install fleet-rlm

# Install skills, agents, and prompts to ~/.claude
uv run fleet-rlm init
```

### 2. Configure Cloud Runtime

Authenticate with Modal to enable the sandboxed execution environment.

```bash
uv run modal setup
uv run modal secret create LITELLM DSPY_LM_MODEL=openai/gpt-4o DSPY_LLM_API_KEY=sk-...
```

### 3. Use with Claude

Now your Claude Code agent has "superpowers". You can ask it to perform deep research tasks that require running code.

**Example Prompts:**

> "Use the `rlm` skill to analyze the latest papers on linear attention mechanisms."
> "Run the `rlm-batch` agent to parallelize data extraction for these 50 files."

**Available Skills:**

- `rlm` - Core recursive research capability.
- `rlm-batch` - Parallel processing.
- `rlm-memory` - Persistent storage.

## Standalone Usage

You can also run fleet-rlm directly without Claude Code:

**Interactive Chat (TUI)**
Chat with the RLM agent in your terminal using the OpenTUI interface.

```bash
uv run fleet-rlm code-chat --opentui
```

**API Server**
Start a FastAPI server to expose RLM capabilities over HTTP.

```bash
# Dev server with hot reload
uv run fastapi dev src/fleet_rlm/server/main.py

# Production server via CLI
uv run fleet-rlm serve-api
```

API docs are available at `/docs` (Swagger) and `/scalar` (Scalar).

## Features

- 🔒 **Sandboxed Execution**: Code runs in isolated Modal containers, not on your laptop.
- 🧠 **DSPy Powered**: Uses advanced prompt engineering pipelines for reliable code generation.
- 💬 **Interactive TUI**: Chat with the agent in your terminal (`fleet-rlm code-chat`).
- ⚡ **Production Ready**: Includes a fastapi server and MCP integration for Claude Desktop.

## Documentation

- **[Tutorials](docs/tutorials/index.md)**: Step-by-step lessons.
- **[Installation Guide](docs/how-to-guides/installation.md)**: Detailed setup instructions.
- **[Skills & Agents](docs/how-to-guides/managing-skills.md)**: Enhance Claude with RLM capabilities.

## Contributing

We welcome contributions! Whether it's reporting a bug, suggesting a feature, or writing code, your input is verified.

1.  Check out our [Contribution Guide](CONTRIBUTING.md).
2.  Fork the repo and create a branch.
3.  Run tests with `uv run pytest`.
4.  Submit a Pull Request.

## Acknowledgments

This project is built upon the innovative research by **Alex L. Zhang** (MIT CSAIL), **Omar Khattab** (Stanford), and **Tim Kraska** (MIT).

> Reference: [Recursive Language Models](https://arxiv.org/abs/2501.123) (Zhang, Kraska, Khattab, 2025)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
