Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
从0实现一个简洁清晰的Deep Search Agent
| Date | Stars |
|---|---|
| 2026-07-31 | 1220 |
| 2026-08-05 | 1220 |
| 2026-08-06 | 1220 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Deep Search Agent
[](https://python.org)
[](LICENSE)
[](https://platform.deepseek.com/)
[](https://tavily.com/)
一个**无框架**的深度搜索AI代理实现,能够通过多轮搜索和反思生成高质量的研究报告。
<img src="https://github.com/666ghj/DeepSearchAgent-Demo/blob/main/img/1.png?raw=true" width="70%">
<img src="https://github.com/666ghj/DeepSearchAgent-Demo/blob/main/img/2.png?raw=true" width="70%">
<img src="https://github.com/666ghj/DeepSearchAgent-Demo/blob/main/img/3.png?raw=true" width="70%">
## 特性
- **无框架设计**: 从零实现,不依赖LangChain等重型框架
- **多LLM支持**: 支持DeepSeek、OpenAI等主流大语言模型
- **智能搜索**: 集成Tavily搜索引擎,提供高质量网络搜索
- **反思机制**: 多轮反思优化,确保研究深度和完整性
- **状态管理**: 完整的研究过程状态跟踪和恢复
- **Web界面**: Streamlit友好界面,易于使用
- **Markdown输出**: 美观的Markdown格式研究报告
## 工作原理
Deep Search Agent采用分阶段的研究方法:
```mermaid
graph TD
A[用户查询] --> B[生成报告结构]
B --> C[遍历每个段落]
C --> D[初始搜索]
D --> E[生成初始总结]
E --> F[反思循环]
F --> G[反思搜索]
G --> H[更新总结]
H --> I{达到反思次数?}
I -->|否| F
I -->|是| J{所有段落完成?}
J -->|否| C
J -->|是| K[格式化最终报告]
K --> L[输出报告]
```
### 核心流程
1. **结构生成**: 根据查询生成报告大纲和段落结构
2. **初始研究**: 为每个段落生成搜索查询并获取相关信息
3. **初始总结**: 基于搜索结果生成段落初稿
4. **反思优化**: 多轮反思,发现遗漏并补充搜索
5. **最终整合**: 将所有段落整合为完整的Markdown报告
## 快速开始
### 1. 环境准备
确保您的系统安装了Python 3.9或更高版本:
```bash
python --version
```
### 2. 克隆项目
```bash
git clone <your-repo-url>
cd Demo\ DeepSearch\ Agent
```
### 3. 安装依赖
```bash
# 激活虚拟环境(推荐)
conda activate pytorch_python11 # 或者使用其他虚拟环境
# 安装依赖
pip install -r requirements.txt
```
### 4. 配置API密钥
项目根目录下已有`config.py`配置文件,请直接编辑此文件设置您的API密钥:
```python
# Deep Search Agent 配置文件
# 请在这里填入您的API密钥
# DeepSeek API Key
DEEPSEEK_API_KEY = "your_deepseek_api_key_here"
# OpenAI API Key (可选)
OPENAI_API_KEY = "your_openai_api_key_here"
# Tavily搜索API Key
TAVILY_API_KEY = "your_tavily_api_key_here"
# 配置参数
DEFAULT_LLM_PROVIDER = "deepseek"
DEEPSEEK_MODEL = "deepseek-chat"
OPENAI_MODEL = "gpt-4o-mini"
MAX_REFLECTIONS = 2
SEARCH_RESULTS_PER_QUERY = 3
SEARCH_CONTENT_MAX_LENGTH = 20000
OUTPUT_DIR = "reports"
SAVE_INTERMEDIATE_STATES = True
```
### 5. 开始使用
现在您可以开始使用Deep Search Agent了!
## 使用方法
### 方式一:运行示例脚本
**基本使用示例**:
```bash
python examples/basic_usage.py
```
这个示例展示了最简单的使用方式,执行一个预设的研究查询并显示结果。
**高级使用示例**:
```bash
python examples/advanced_usage.py
```
这个示例展示了更复杂的使用场景,包括:
- 自定义配置参数
- 执行多个研究任务
- 状态管理和恢复
- 不同模型的使用
### 方式二:Web界面
启动Streamlit Web界面:
```bash
streamlit run examples/streamlit_app.py
```
Web界面无需配置文件,直接在界面中输入API密钥即可使用。
### 方式三:编程方式
```python
from src import DeepSearchAgent, load_config
# 加载配置
config = load_config()
# 创建Agent
agent = DeepSearchAgent(config)
# 执行研究
query = "2025年人工智能发展趋势"
final_report = agent.research(query, save_report=True)
print(final_report)
```
### 方式四:自定义配置(编程方式)
如果需要在代码中动态设置配置,可以使用以下方式:
```python
from src import DeepSearchAgent, Config
# 自定义配置
config = Config(
default_llm_provider="deepseek",
deepseek_model="deepseek-chat",
max_reflections=3, # 增加反思次数
max_search_results=5, # 增加搜索结果数
output_dir="my_reports" # 自定义输出目录
)
# 设置API密钥
config.deepseek_api_key = "your_api_key"
config.tavily_api_key = "your_tavily_key"
agent = DeepSearchAgent(config)
```
## 项目结构
```
Demo DeepSearch Agent/
├── src/ # 核心代码
│ ├── llms/ # LLM调用模块
│ │ ├── base.py # LLM基类
│ │ ├── deepseek.py # DeepSeek实现
│ │ └── openai_llm.py # OpenAI实现
│ ├── nodes/ # 处理节点
│ │ ├── base_node.py # 节点基类
│ │ ├── report_structure_node.py # 结构生成
│ │ ├── search_node.py # 搜索节点
│ │ ├── summary_node.py # 总结节点
│ │ └── formatting_node.py # 格式化节点
│ ├── prompts/ # 提示词模块
│ │ └── prompts.py # 所有提示词定义
│ ├── state/ Excerpt of 9,276 characters
Read on GitHubBaiFu · BUPT · China
5
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:3389c909a854680c, llm:Repository description (Chinese): '从0实现一个简洁清晰的Deep Search Agent' — implements a Deep Search Agent from scratch.
matched fp:3389c909a854680c, llm:Repository description (Chinese): '从0实现一个简洁清晰的Deep Search Agent' — implements a Deep Search Agent from scratch.