Skip to content

gemelom/RunAnyThing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RunAnyThing

RAT Logo

Project Page Paper

πŸ“– Introduction

RAT framework

RunAnyThing (RAT) is an LLM-powered Agent automated build system designed to analyze GitHub repositories and automatically construct executable environments within Docker containers. The system could autonomously handle dependency installation, environment configuration, and build testing.

RunAnyThing Web Interface

πŸ”§ Prerequisites

  • Python: 3.12+
  • Docker: 20.10+ (see Docker Installation Guide)
  • LLM Providers: DeepSeek, OpenAI, GLM, Qwen, or local provider such as Ollama
  • GitHub Personal Access Token: Optional, but recommended to avoid GitHub API rate limits and to access private repositories

πŸš€ Quick Start

  1. Clone the repository:

    git clone https://github.com/gemelom/RunAnyThing.git
    cd RunAnyThing
  2. Install dependencies with uv:

    uv sync
  3. Configure Environment Variables:

    Copy the template and fill in your credentials:

    cp .env.example .env
    export UV_ENV_FILE=.env

    Edit the .env file with your API keys:

    # LLM API Keys (At least one required)
    DEEPSEEK_API_KEY=your_deepseek_api_key_here
    OPENAI_API_KEY=your_openai_api_key_here
    
    # GitHub Token (optional but recommended)
    GITHUB_TOKEN=your_github_token_here
  4. Run the Streamlit Interface:

    uv run streamlit run rat/app.py

    Open the displayed address (usually http://localhost:8501) in your browser.

πŸ› οΈ Detailed Installation

If you need to run from the CLI interface or the full web application (FastAPI + React), please refer to this section.

CLI Interface:

uv run rat/cli.py --full_name "owner/repo" --root_path . --llm deepseek-chat

Argument Reference

  • --full_name: GitHub repository (Format: owner/repo).
  • --root_path: Working directory path (Default: current directory).
  • --llm: LLM model to use (Default: deepseek-chat).
  • --num_turn: Maximum iterations for the Agent (Default: 25).
  • --save_mode: Options:
    • none: Do not save (Default).
    • dockerfile: Save the generated Dockerfile.
    • image: Save as a local Docker image.
  • --use-dockerfile: Use the repository's own Dockerfile (if exists) to build the image.
  • --custom-plan: Use custom plan mode; LLM will use or create a /repo/plan.md file to guide environment configuration.
  • --use-uv: Use uv as the Python package manager instead of pip/poetry.
  • --timeout: Command execution timeout in seconds (Default: 300).

Examples

# Basic run
uv run rat/cli.py --full_name "streamlit/streamlit-example" --root_path . --llm deepseek-chat

# Save as Dockerfile/Docker Image
uv run rat/cli.py --full_name "owner/repo" --root_path . --save_mode dockerfile
uv run rat/cli.py --full_name "owner/repo" --root_path . --save_mode image

# Use the repo's own Dockerfile
uv run rat/cli.py --full_name "owner/repo" --root_path . --use-dockerfile

🌐 Web Interface

The project provides two web interfaces for ease of use:

Streamlit Interface (rat/app.py)

A lightweight Streamlit-based web interface offering:

  • Intuitive Form Interface: Easily input all CLI parameters.
  • Real-time Streaming Output: Monitor the build process as it happens.
  • One-Click Execution: Run tasks and view results instantly.
uv run streamlit run rat/app.py

Full-Stack Web Application (app/)

A production-ready web application with a FastAPI backend and React + TypeScript frontend, providing a richer experience:

  • Real-time Progress Tracking: SSE-based live updates across a 5-stage pipeline (Cloning β†’ Analyzing β†’ Building β†’ Configuring β†’ Testing).
  • Interactive Container Terminal: Execute commands directly in running Docker containers.
  • Repository Analysis: Static code analysis with metrics, dependency detection, and critical function identification.
  • ZIP Upload Support: Configure environments for local repositories.
  • Multi-language UI: Built-in i18n support (English & Chinese).
  • Feedback System: User feedback collection with ratings and dashboard.
# Install app dependencies
uv sync --group app

# Start the backend
uv run uvicorn app.backend.main:app --reload

# Start the frontend
cd app/frontend && npm install && npm run dev

Evaluation & Dataset Building

See ratbench/README.md for benchmark evaluation scripts, dataset building tools, and directory structure.

✨ Key Features

1. Intelligent Environment Analysis

  • Automatically analyzes repository structures.
  • Recommends optimal base images for Python, Java, Node.js, Rust, and Go.
  • Identifies dependency managers (pip, poetry, conda, maven, npm, cargo, go modules, etc.).

2. Automated Configuration

  • Installs dependencies automatically within Docker.
  • Resolves dependency conflicts autonomously.
  • Configures the runtime environment.

3. Build Verification

  • Automatically discovers and executes tests.
  • Validates that the environment is correctly configured.

4. Flexible Export Options

  • none: Ephemeral environment for quick testing.
  • dockerfile: Generates a reusable Dockerfile.
  • image: Commits the state to a local Docker image.

πŸ“‚ Project Structure

RunAnyThing/
β”œβ”€β”€ rat/                        # Core agent package
β”‚   β”œβ”€β”€ cli.py                  # Main CLI entry point
β”‚   β”œβ”€β”€ app.py                  # Streamlit web interface
β”‚   β”œβ”€β”€ setupagent.py           # Analysis Agent (recommends base image)
β”‚   β”œβ”€β”€ codeagent.py            # Configuration Agent (installs deps & configures)
β”‚   β”œβ”€β”€ docker_executor.py      # Docker command execution (subprocess-based)
β”‚   β”œβ”€β”€ config.py               # Centralized config from .env
β”‚   β”œβ”€β”€ llm.py                  # Unified LLM interface (DeepSeek, GLM, OpenAI, Tongyi, Ollama)
β”‚   β”œβ”€β”€ memory.py               # Three-tier memory system
β”‚   β”œβ”€β”€ tool_schemas.py         # OpenAI-compatible tool definitions
β”‚   β”œβ”€β”€ host_tools.py           # Host-side tool implementations (search, retrieve)
β”‚   β”œβ”€β”€ language_config.py      # Abstract LanguageConfig base class
β”‚   β”œβ”€β”€ language_configs/       # Language-specific configs (Python, Java, Node.js, Rust, Go)
β”‚   β”œβ”€β”€ analysis/               # Analysis modules (static analysis, vulnerability scanning)
β”‚   β”œβ”€β”€ utils/                  # Utility functions (language detection, Docker utils)
β”‚   β”œβ”€β”€ tools/                  # Host-side tool scripts (retrieve_image, retrieve_issue, etc.)
β”‚   β”œβ”€β”€ dockerfile_templates/   # Dockerfile template system (with version management)
β”‚   β”œβ”€β”€ tests/                  # Unit tests
β”‚   └── ...
β”œβ”€β”€ app/                        # Full-stack web application
β”‚   β”œβ”€β”€ backend/                # FastAPI backend (SSE, Docker management, analysis API)
β”‚   └── frontend/               # React + TypeScript frontend (Vite, Tailwind, i18n)
β”œβ”€β”€ ratbench/                   # Benchmark, evaluation, and dataset package (see [ratbench/README.md](ratbench/README.md))
└── pyproject.toml              # Python project metadata and dependencies

πŸ”„ Workflow

  1. Clone: Downloads the repo from GitHub.
  2. Analyze: SetupAgent scans the code and recommends a base image.
  3. Create: A Docker container is initialized based on recommendations.
  4. Configure: CodeAgent performs terminal operations to set up the environment.
  5. Export: Results are saved according to the selected save_mode.

πŸ“ Output

Depending on the selected mode, run artifacts may be stored under output/<owner>/<repo>/, such as generated Dockerfiles, execution summaries, and other local debugging files.

Supported Languages

Language Language Config Template Test Runner
Python python_config.py python.template pytest
Java java_config.py java.template Maven/Gradle
Node.js nodejs_config.py javascript.template npm test
Rust rust_config.py rust.template cargo test
Go go_config.py go.template go test

πŸ” FAQ

Q: Does it clean up Docker containers? A: Yes, containers are automatically stopped and removed after the process finishes unless you use --save_mode.

Q: Which languages are supported? A: Currently Python, Java, Node.js, Rust, and Go are supported. New languages can be easily extended by adding a LanguageConfig implementation and a Dockerfile template.

πŸ“‹ Roadmap

Core Features

  • Token consumption tracking per tool call.
  • Support for multiple languages (Python, Java, Node.js, Rust, Go).
  • Optimization of Agent logic to reduce error rates.
  • Success rate statistics and analysis.
  • RAG system for issue retrieval (retrieve_issue).
  • Dynamic image switching during configuration (change_image).

UX & Performance

  • Web UI (Streamlit).
  • Full-stack Web Application (FastAPI + React).
  • Real-time configuration progress display.
  • Parallel processing for multiple repositories.
  • Caching for common dependencies and images.

πŸ“„ License

Apache License 2.0

πŸ“š Citation

@misc{huang2026ratrunanythingfullyautomated,
      title={RAT: RunAnyThing via Fully Automated Environment Configuration},
      author={Renhong Huang and Dongdong Hua and Yifei Sun and Sitao Ding and Hanyang Yuan and Daixin Wang and Yang Yang},
      year={2026},
      eprint={2604.23190},
      archivePrefix={arXiv},
      primaryClass={cs.SE},
      url={https://arxiv.org/abs/2604.23190},
}

About

RAT: RunAnyThing via Fully Automated Environment Configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors