GPT Researcher:AI深度研究自动化智能体安装与使用指南
官方信息
| 项目名称 | GPT Researcher |
| 仓库地址 | https://github.com/assafelovic/gpt-researcher |
| 官方文档 | https://docs.gptr.dev/ |
| 在线体验 | https://app.gptr.dev/ |
| 最新更新 | 2026-10-10 |
| 项目定位 | 自动检索 + 多智能体协作 + 生成带引用研究报告 |
| 开源协议 | MIT |
项目背景
OpenAI Deep Research 和 Gemini Deep Research 发布后,"给一个主题,AI 自动上网检索几十篇资料、交叉验证、最后输出一份带引用的研究报告"成了新宠。但官方版数据要经过它们的服务器,对隐私敏感的用户和企业来说并不友好。GPT Researcher 就是这个方向上最老牌、最活跃的开源替代品。
项目由 Aviv Assafelovic 发起,在 GitHub 上已斩获 20k+ Star,采用 Python 编写。它的核心思路是 Plan-and-Execute + RAG:先让大模型把你的问题拆成若干个子研究问题,再派出爬虫代理并行搜索网页、学术论文、社交媒体,对每篇结果做摘要并保留来源链接,最后由一个"撰写者"智能体把所有素材汇总成结构化报告。
它支持 OpenAI、Anthropic、Google、DeepSeek、Ollama、本地 vLLM 等几乎所有主流 LLM,搜索后端支持 Tavily、Google、Serper、DuckDuckGo、Wikipedia 等,可以完全私有化跑起来,适合做行业调研、文献综述、竞品分析、周报素材收集。
核心特性
- 自主拆解研究计划:自动把大问题拆成 5-10 个子问题,并行检索。
- 多源搜索:网页、学术论文(ArXiv)、社交媒体、新闻、YouTube 全覆盖。
- 带引用的报告:每段结论都标注来源链接,可追溯、可核查。
- 多种输出格式:Markdown、PDF、Word、JSON,支持提纲、详细报告、短摘要。
- 多 LLM 后端:OpenAI、Claude、Gemini、DeepSeek、Ollama、本地模型均可。
- Web UI 与 API:既有可视化界面,也提供 REST API 嵌入业务系统。
- 深度/广度可调:通过 report_type、depth、breadth 参数控制耗时和覆盖范围。
- MCP 与 CrewAI 集成:可作为工具挂到其他智能体框架里。
环境要求
- Python 3.10 - 3.12(推荐 3.11/3.12)。
- 至少一个 LLM API Key(OpenAI 最省事;也可用 Ollama 本地模型)。
- 推荐配置:2 核 4G 内存;用本地大模型则需 GPU。
- 可选:Tavily API Key(官方推荐搜索后端,免费额度足够个人用)。
详细部署步骤
方式一:pip 快速安装(命令行体验)
# 创建虚拟环境 python3.11 -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate安装
pip install --upgrade gpt-researcher
配置 API Key
export OPENAI_API_KEY="sk-你的key" export TAVILY_API_KEY="tvly-你的tavily key" # 可选,强烈推荐
直接跑一次研究
gpt-researcher "2026年大模型推理框架对比:vLLM vs SGLang vs TensorRT-LLM"
运行后会在终端输出研究进度,最终报告保存在当前目录的 outputs/ 下。
方式二:源码部署 Web UI(推荐)
git clone https://github.com/assafelovic/gpt-researcher.git cd gpt-researcherpython3.11 -m venv venv source venv/bin/activate
安装依赖
pip install -r requirements.txt
配置环境变量
cp .env.example .env nano .env
在 .env 中至少配置:
OPENAI_API_KEY=sk-你的key
TAVILY_API_KEY=tvly-你的key
# 如果用 DeepSeek:
# FAST_LLM=deepseek/deepseek-chat
# SMART_LLM=deepseek/deepseek-reasoner
# STRATEGIC_LLM=deepseek/deepseek-reasoner
# OPENAI_API_BASE=http://你的deepseek中转/v1
# 如果用 Ollama 本地模型:
# FAST_LLM=ollama/llama3.1
# SMART_LLM=ollama/llama3.1
# OPENAI_API_BASE=http://localhost:11434/v1启动 Web UI:
streamlit run gpt_researcher/web/streamlit/app.py浏览器访问 http://localhost:8501 即可看到可视化界面。
方式三:Docker Compose 部署(服务器推荐)
git clone https://github.com/assafelovic/gpt-researcher.git
cd gpt-researcher
cp .env.example .env
# 编辑 .env 填入 API Key
docker compose up -d启动后访问 http://服务器IP:8080(具体端口以 compose 文件为准)。
关键参数说明
report_type:research_report(标准报告)、detailed_report(详细)、outline_report(仅提纲)、resource_report(仅资源列表)。depth:研究深度,1=快,2=深(默认),越大越慢越全。breadth:每次搜索的并行子问题数量,默认 3。FAST_LLM / SMART_LLM / STRATEGIC_LLM:分别负责快速总结、日常推理、战略规划三个层级的模型,省钱可把 FAST 配成小模型。
使用方法示例
from gpt_researcher import GPTResearcherasync def main(): researcher = GPTResearcher( query="对比 2026 年主流开源 RAG 框架:RAGFlow、Dify、FastGPT", report_type="research_report", depth=2, breadth=4, ) await researcher.conduct_research() report = await researcher.write_report() print(report)
import asyncio asyncio.run(main())
常见问题(FAQ)
Q1:没有 Tavily Key 能用吗?
A:可以,但需要在 .env 里把 SEARCH_API 换成 duckduckgo、google 或 serper,搜索质量和稳定性不如 Tavily。个人用 Tavily 免费额度(每月 1000 次)基本够。
Q2:可以完全本地跑、不调用外部 LLM 吗?
A:可以,配合 Ollama 跑 Qwen2.5、Llama3.1 等模型,搜索后端用 DuckDuckGo,全程数据不出本机。但报告质量会比 GPT-4o/Claude 差不少。
Q3:跑一次研究要花多少钱?
A:默认 depth=2、breadth=3,一次报告大约消耗 5-15 万 token,用 GPT-4o 大概 0.3-1 美元;换成 DeepSeek 大约几毛钱人民币。
Q4:报告能导出 PDF 吗?
A:可以,安装 weasyprint 后调用 researcher.write_report() 后用 output_formatter 导出 pdf/docx。
跳转链接
- GitHub 仓库:https://github.com/assafelovic/gpt-researcher
- 官方文档:https://docs.gptr.dev/
- 在线体验:https://app.gptr.dev/
- PyPI:gpt-researcher
安装部署(实操步骤)
1. 前置准备
- 项目仓库:assafelovic/gpt-researcher(https://github.com/assafelovic/gpt-researcher)
- 需要本机具备 Git;按项目语言准备对应运行时(Python / Node.js / Go / Java 等)
- 建议先在本机或测试服务器上跑通,再部署到生产环境
- 遇到依赖版本问题时,以仓库 README 与 Releases 说明为准
2. 官方安装 / 启动命令(摘自项目 README,可直接复制执行)
git clone https://github.com/assafelovic/gpt-researcher.git
cd gpt-researcher
pip install -r requirements.txt
python -m uvicorn main:app --reload
pip install gpt-researcherSee the [Context Filter docs](https://docs.gptr.dev/docs/gpt-researcher/gptr/context-filter) and the [full benchmark](evals/context_filter) for method, caveats and how to reproduce it.
## Run with Docker
> **Step 1** - [Install Docker](https://docs.gptr.dev/docs/gpt-researcher/getting-started/getting-started-with-docker)
> **Step 2** - Clone the '.env.example' file, add your API Keys to the cloned file and save the file as '.env'
> **Step 3** - Within the docker-compose file comment out services that you don't want to run with Docker.> **Step 4** - By default, if you haven't uncommented anything in your docker-compose file, this flow will start 2 processes:
- the Python server running on localhost:8000<br>
- the React app running on localhost:3000<br>
Visit localhost:3000 on any browser and enjoy researching!
## 📄 Research on Local Documents
You can instruct the GPT Researcher to run research tasks based on your local documents. Currently supported file formats are: PDF, plain text, CSV, Excel, Markdown, PowerPoint, and Word documents.
Step 1: Add the env variable `DOC_PATH` pointing to the folder where your documents are located.3. 部署流程
- 克隆仓库:
git clone https://github.com/assafelovic/gpt-researcher - 进入目录后按上面的官方命令安装依赖
- 参考 README 的配置说明填写配置文件或环境变量
- 按官方说明启动服务,确认监听端口与访问地址
- 浏览器访问验证功能,确认无报错后再开放外网
4. 常见问题排查
- 依赖安装失败:先升级包管理器,再确认运行时版本符合 README 要求
- 启动报端口占用:修改配置中的端口或释放被占用端口
- 页面打不开:检查防火墙 / 安全组是否放行对应端口
- 功能异常:查看运行日志,对照 Issues 中同类问题处理