Skip to content

Install

Tongyi DeepResearch is a Python-based inference framework that runs the 30B-A3B model locally (requires significant GPU VRAM) or against a remote API such as OpenRouter. The steps below cover the local self-hosted path. For the API-only path, skip to Option B.


Option A: Local self-hosted (requires GPU)

1. Clone the repository

bash
git clone https://github.com/Alibaba-NLP/DeepResearch.git
cd DeepResearch

2. Create an isolated Python environment

Python 3.10.0 is required. Other versions may cause dependency conflicts.

bash
conda create -n react_infer_env python=3.10.0
conda activate react_infer_env

3. Install dependencies

bash
pip install -r requirements.txt

4. Configure environment variables

bash
cp .env.example .env

Open .env and fill in the following keys:

KeyProviderPurpose
SERPER_KEY_IDserper.devWeb search and Google Scholar
JINA_API_KEYSjina.aiWeb page reading and extraction
API_KEY / API_BASEAny OpenAI-compatible APIPage summarization
DASHSCOPE_API_KEYdashscope.aliyun.comFile parsing (PDF, XLSX, etc.)
SANDBOX_FUSION_ENDPOINTSandboxFusionPython interpreter sandbox
MODEL_PATHLocal or remotePath or name of model weights
DATASETLocal filePath to evaluation JSONL/JSON
OUTPUT_PATHLocal directoryWhere results are saved

The .env file is gitignored. Do not commit it.

5. Download model weights

Download from HuggingFace or ModelScope:

bash
# HuggingFace (requires huggingface-cli)
huggingface-cli download Alibaba-NLP/Tongyi-DeepResearch-30B-A3B --local-dir ./model_weights

# ModelScope alternative
modelscope download --model iic/Tongyi-DeepResearch-30B-A3B --local_dir ./model_weights

Set MODEL_PATH=./model_weights in your .env after downloading.


Option B: OpenRouter API (no GPU)

If you do not have GPU hardware, use the model via OpenRouter without downloading weights.

In inference/react_agent.py, make two changes:

  1. Set API_KEY and API_BASE to your OpenRouter credentials:
python
# In call_server function
api_key = "your-openrouter-api-key"
api_base = "https://openrouter.ai/api/v1"
  1. Set the model name:
python
model = "alibaba/tongyi-deepresearch-30b-a3b"
  1. Adjust the content concatenation as described in the inline comments on lines 88-90 of react_agent.py.

Then follow steps 1-4 above (clone, create env, install deps, configure .env) and skip the weight download.