Appearance
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 DeepResearch2. 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_env3. Install dependencies
bash
pip install -r requirements.txt4. Configure environment variables
bash
cp .env.example .envOpen .env and fill in the following keys:
| Key | Provider | Purpose |
|---|---|---|
SERPER_KEY_ID | serper.dev | Web search and Google Scholar |
JINA_API_KEYS | jina.ai | Web page reading and extraction |
API_KEY / API_BASE | Any OpenAI-compatible API | Page summarization |
DASHSCOPE_API_KEY | dashscope.aliyun.com | File parsing (PDF, XLSX, etc.) |
SANDBOX_FUSION_ENDPOINT | SandboxFusion | Python interpreter sandbox |
MODEL_PATH | Local or remote | Path or name of model weights |
DATASET | Local file | Path to evaluation JSONL/JSON |
OUTPUT_PATH | Local directory | Where results are saved |
The
.envfile 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_weightsSet 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:
- Set
API_KEYandAPI_BASEto your OpenRouter credentials:
python
# In call_server function
api_key = "your-openrouter-api-key"
api_base = "https://openrouter.ai/api/v1"- Set the model name:
python
model = "alibaba/tongyi-deepresearch-30b-a3b"- 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.