Skip to content

Commit 03798de

Browse files
author
He Tao
committed
feat: lite deep researcher implementation
0 parents  commit 03798de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4242
-0
lines changed

‎.env.example‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Application Settings
2+
DEBUG=True
3+
APP_ENV=development
4+
5+
# Add other environment variables as needed
6+
TAVILY_API_KEY=tvly-xxx
7+
# JINA_API_KEY=jina_xxx # Optional, default is None
8+

‎.github/workflows/lint.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint Check
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install the latest version of uv
16+
uses: astral-sh/setup-uv@v5
17+
with:
18+
version: "latest"
19+
20+
- name: Install dependencies
21+
run: |
22+
uv venv --python 3.12
23+
uv pip install -e ".[dev]"
24+
25+
- name: Run linters
26+
run: |
27+
source .venv/bin/activate
28+
make lint

‎.github/workflows/test.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test Cases Check
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install the latest version of uv
16+
uses: astral-sh/setup-uv@v5
17+
with:
18+
version: "latest"
19+
20+
- name: Install dependencies
21+
run: |
22+
uv venv --python 3.12
23+
uv pip install -e ".[dev]"
24+
uv pip install -e ".[test]"
25+
26+
- name: Run test cases
27+
run: |
28+
source .venv/bin/activate
29+
TAVILY_API_KEY=mock-key make test

‎.gitignore‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
.coverage
9+
agent_history.gif
10+
static/browser_history/*.gif
11+
12+
# Virtual environments
13+
.venv
14+
15+
# Environment variables
16+
.env
17+
18+
# user conf
19+
conf.yaml
20+
21+
.idea/

‎.python-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

‎.vscode/launch.json‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python: 当前文件",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"program": "${file}",
9+
"console": "integratedTerminal",
10+
"justMyCode": true
11+
},
12+
{
13+
"name": "Python: main.py",
14+
"type": "debugpy",
15+
"request": "launch",
16+
"program": "${workspaceFolder}/main.py",
17+
"console": "integratedTerminal",
18+
"justMyCode": false,
19+
"env": {
20+
"PYTHONPATH": "${workspaceFolder}"
21+
},
22+
"args": [
23+
"--debug", "--max_plan_iterations", "1", "--max_step_num", "3"
24+
]
25+
},
26+
{
27+
"name": "Python: llm.py",
28+
"type": "debugpy",
29+
"request": "launch",
30+
"program": "${workspaceFolder}/src/llms/llm.py",
31+
"console": "integratedTerminal",
32+
"justMyCode": true,
33+
"env": {
34+
"PYTHONPATH": "${workspaceFolder}"
35+
}
36+
}
37+
]
38+
}

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 lite-deep-researcher
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎Makefile‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: lint format install-dev serve test coverage
2+
3+
install-dev:
4+
uv pip install -e ".[dev]" && uv pip install -e ".[test]"
5+
6+
format:
7+
uv run black --preview .
8+
9+
lint:
10+
uv run black --check .
11+
12+
serve:
13+
uv run server.py
14+
15+
test:
16+
uv run pytest tests/
17+
18+
coverage:
19+
uv run pytest --cov=src tests/ --cov-report=term-missing

‎README.md‎

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# lite-deep-researcher
2+
3+
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
6+
> Come from Open Source, Back to Open Source
7+
8+
lite-deep-researcher is a community-driven AI automation framework that builds upon the incredible work of the open source community. Our goal is to combine language models with specialized tools for tasks like web search, crawling, and Python code execution, while giving back to the community that made this possible.
9+
10+
## Quick Start
11+
12+
```bash
13+
# Clone the repository
14+
git clone https://github.com/hetaoBackend/lite-deep-researcher.git
15+
cd lite-deep-researcher
16+
17+
# Install dependencies, uv will take care of the python interpreter and venv creation
18+
uv sync
19+
20+
# Configure .env
21+
cp .env.example .env
22+
23+
# Configure config.yaml
24+
cp config.yaml.example config.yaml
25+
26+
# Run the project
27+
uv run main.py
28+
```
29+
30+
## Development
31+
32+
### Testing
33+
34+
Run the test suite:
35+
36+
```bash
37+
# Run all tests
38+
make test
39+
40+
# Run specific test file
41+
pytest tests/integration/test_workflow.py
42+
43+
# Run with coverage
44+
make coverage
45+
```
46+
47+
### Code Quality
48+
49+
```bash
50+
# Run linting
51+
make lint
52+
53+
# Format code
54+
make format
55+
```
56+
57+
## Architecture
58+
59+
lite-deep-researcher implements a modular multi-agent system architecture designed for automated research and code analysis. The system is built on LangGraph, enabling a flexible state-based workflow where components communicate through a well-defined message passing system.
60+
61+
![Architecture Diagram](./assets/architecture.png)
62+
63+
The system employs a streamlined workflow with the following components:
64+
65+
1. **Coordinator**: The entry point that manages the workflow lifecycle
66+
- Initiates the research process based on user input
67+
- Delegates tasks to the planner when appropriate
68+
- Acts as the primary interface between the user and the system
69+
70+
2. **Planner**: Strategic component for task decomposition and planning
71+
- Analyzes research objectives and creates structured execution plans
72+
- Determines if enough context is available or if more research is needed
73+
- Manages the research flow and decides when to generate the final report
74+
75+
3. **Research Team**: A collection of specialized agents that execute the plan:
76+
- **Researcher**: Conducts web searches and information gathering using tools like Tavily and web crawling
77+
- **Coder**: Handles code analysis, execution, and technical tasks using Python REPL and Bash tools
78+
Each agent has access to specific tools optimized for their role and operates within the LangGraph framework
79+
80+
4. **Reporter**: Final stage processor for research outputs
81+
- Aggregates findings from the research team
82+
- Processes and structures the collected information
83+
- Generates comprehensive research reports
84+
85+
## Examples
86+
87+
The following examples demonstrate the capabilities of lite-deep-researcher:
88+
89+
### Research Reports
90+
91+
1. **What is MCP?** - A comprehensive analysis of the term "MCP" across multiple contexts
92+
- Explores Model Context Protocol in AI, Monocalcium Phosphate in chemistry, and Micro-channel Plate in electronics
93+
- [View full report](examples/what_is_mcp.md)
94+
95+
2. **Bitcoin Price Fluctuations** - Analysis of recent Bitcoin price movements
96+
- Examines market trends, regulatory influences, and technical indicators
97+
- Provides recommendations based on historical data
98+
- [View full report](examples/bitcoin_price_fluctuation.md)
99+
100+
3. **What is LLM?** - An in-depth exploration of Large Language Models
101+
- Discusses architecture, training, applications, and ethical considerations
102+
- [View full report](examples/what_is_llm.md)
103+
104+
To run these examples or create your own research reports, you can use the following commands:
105+
106+
```bash
107+
# Run with a specific query
108+
uv run main.py "What factors are influencing AI adoption in healthcare?"
109+
110+
# Run with custom planning parameters
111+
uv run main.py --max_plan_iterations 3 "How does quantum computing impact cryptography?"
112+
113+
# Or run interactively
114+
uv run main.py
115+
116+
# View all available options
117+
uv run main.py --help
118+
```
119+
120+
### Command Line Arguments
121+
122+
The application supports several command-line arguments to customize its behavior:
123+
124+
- **query**: The research query to process (can be multiple words)
125+
- **--max_plan_iterations**: Maximum number of planning cycles (default: 1)
126+
- **--max_step_num**: Maximum number of steps in a research plan (default: 3)
127+
- **--debug**: Enable detailed debug logging
128+
129+
## License
130+
131+
This project is open source and available under the [MIT License](LICENSE).
132+
133+
## Acknowledgments
134+
135+
Special thanks to all the open source projects and contributors that make lite-deep-researcher possible. We stand on the shoulders of giants.
136+
137+
In particular, we want to express our deep appreciation for:
138+
- [LangChain](https://github.com/langchain-ai/langchain) for their exceptional framework that powers our LLM interactions and chains
139+
- [LangGraph](https://github.com/langchain-ai/langgraph) for enabling our sophisticated multi-agent orchestration
140+
141+
These amazing projects form the foundation of lite-deep-researcher and demonstrate the power of open source collaboration.

‎assets/architecture.png‎

177 KB
Loading

0 commit comments

Comments
 (0)