-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[None][feat] Deep Research Implemented with Scaffolding #8452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5dedf53 to
154bb5d
Compare
📝 WalkthroughWalkthroughThis pull request introduces a comprehensive DeepResearch scaffolding module that orchestrates multi-step research workflows combining supervisor-researcher control patterns, MCP-based tool integration, and Tavily-powered web search capabilities, along with a complete example server and supporting utilities. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant RunScript as run_deep_research.py
participant Supervisor
participant Researcher
participant MCPWorker as MCP<br/>(Tavily)
participant OpenAI as OpenAI<br/>Worker
User->>RunScript: Execute with prompt
RunScript->>Supervisor: Create & start orchestration
Supervisor->>OpenAI: Generate research brief<br/>(ChatTask)
OpenAI-->>Supervisor: research_brief
loop Up to max_research_iter
Supervisor->>OpenAI: chat_with_tools<br/>(think_tool, conduct_research,<br/>complete_research)
OpenAI-->>Supervisor: tool calls
alt think_tool
Supervisor->>Supervisor: Record reflection
else conduct_research
Supervisor->>Researcher: Create ResearchTask(s)
loop Up to max_tools_iter
Researcher->>OpenAI: Generate with<br/>research_system_prompt
OpenAI-->>Researcher: tool calls
Researcher->>MCPWorker: Execute tavily_search
MCPWorker-->>Researcher: Search results
Researcher->>Researcher: Accumulate results
end
Researcher->>OpenAI: Compress findings<br/>(compress_system_prompt)
OpenAI-->>Researcher: Compressed research
Researcher-->>Supervisor: ResearchTask with result
else complete_research
Supervisor->>Supervisor: Break loop
end
end
Supervisor->>OpenAI: Generate final report<br/>(final_report_generation_prompt)
OpenAI-->>Supervisor: final_report
Supervisor-->>RunScript: Complete with output
RunScript->>User: Print results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (3)
examples/scaffolding/contrib/DeepResearch/TavilyMCP/README.md (1)
7-9: Add a language tag to the fenced block.Markdownlint is flagging this fence; please annotate it (e.g., ```bash) so the snippet renders and linting passes.
tensorrt_llm/scaffolding/contrib/DeepResearch/__init__.py (1)
1-4: Sort__all__to satisfy RUF022.Ruff expects
__all__in isort order, so please swap the entries to["Researcher", "Supervisor"].
(docs.astral.sh)examples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.py (1)
22-31: Validate the Tavily API key before performing searches.If
TAVILY_API_KEYis missing,TavilyClientraisesMissingAPIKeyErrorwhensearchruns; failing fast with a descriptive exception (or defaulting toTavilyClient()so it auto-loads the key) makes debugging much easier for users.
(docs.tavily.com)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
examples/scaffolding/contrib/DeepResearch/TavilyMCP/README.md(1 hunks)examples/scaffolding/contrib/DeepResearch/TavilyMCP/pyproject.toml(1 hunks)examples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.py(1 hunks)examples/scaffolding/contrib/DeepResearch/run_deep_research.py(1 hunks)tensorrt_llm/scaffolding/contrib/DeepResearch/__init__.py(1 hunks)tensorrt_llm/scaffolding/contrib/DeepResearch/prompts.py(1 hunks)tensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py(1 hunks)tensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.py(1 hunks)tensorrt_llm/scaffolding/contrib/DeepResearch/utils.py(1 hunks)tensorrt_llm/scaffolding/contrib/mcp/chat_task.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use only spaces, no tabs; indent with 4 spaces.
Files:
examples/scaffolding/contrib/DeepResearch/run_deep_research.pyexamples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.pytensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.pytensorrt_llm/scaffolding/contrib/DeepResearch/utils.pytensorrt_llm/scaffolding/contrib/DeepResearch/__init__.pytensorrt_llm/scaffolding/contrib/mcp/chat_task.pytensorrt_llm/scaffolding/contrib/DeepResearch/prompts.pytensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.
Files:
examples/scaffolding/contrib/DeepResearch/run_deep_research.pyexamples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.pytensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.pytensorrt_llm/scaffolding/contrib/DeepResearch/utils.pytensorrt_llm/scaffolding/contrib/DeepResearch/__init__.pytensorrt_llm/scaffolding/contrib/mcp/chat_task.pytensorrt_llm/scaffolding/contrib/DeepResearch/prompts.pytensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).
Files:
examples/scaffolding/contrib/DeepResearch/run_deep_research.pyexamples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.pytensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.pytensorrt_llm/scaffolding/contrib/DeepResearch/utils.pytensorrt_llm/scaffolding/contrib/DeepResearch/__init__.pytensorrt_llm/scaffolding/contrib/mcp/chat_task.pytensorrt_llm/scaffolding/contrib/DeepResearch/prompts.pytensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py
🧬 Code graph analysis (5)
examples/scaffolding/contrib/DeepResearch/run_deep_research.py (5)
tensorrt_llm/scaffolding/worker.py (2)
OpenaiWorker(62-120)register_task_handler(20-23)tensorrt_llm/scaffolding/scaffolding_llm.py (1)
ScaffoldingLlm(22-237)tensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py (2)
Researcher(30-138)WorkerTag(32-33)tensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.py (2)
Supervisor(31-202)WorkerTag(33-34)tensorrt_llm/scaffolding/contrib/mcp/chat_task.py (1)
ChatTask(8-29)
examples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.py (1)
tests/unittest/disaggregated/test_cluster_storage.py (1)
Server(29-41)
tensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.py (5)
tensorrt_llm/scaffolding/contrib/mcp/chat_task.py (3)
ChatTask(8-29)create_from_prompt(15-20)from_messages(23-29)tensorrt_llm/scaffolding/controller.py (1)
Controller(15-31)tensorrt_llm/scaffolding/task.py (1)
Task(12-20)tensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py (5)
Researcher(30-138)ResearchTask(18-27)WorkerTag(32-33)process(75-138)from_topic(23-27)tensorrt_llm/scaffolding/contrib/DeepResearch/utils.py (5)
AssistantMessage(43-46)SystemMessage(50-53)UserMessage(36-39)get_today_str(6-13)to_dict(27-28)
tensorrt_llm/scaffolding/contrib/DeepResearch/__init__.py (2)
tensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py (1)
Researcher(30-138)tensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.py (1)
Supervisor(31-202)
tensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py (5)
tensorrt_llm/scaffolding/controller.py (1)
Controller(15-31)tensorrt_llm/scaffolding/task.py (1)
Task(12-20)tensorrt_llm/scaffolding/contrib/mcp/chat_task.py (2)
ChatTask(8-29)from_messages(23-29)tensorrt_llm/scaffolding/contrib/DeepResearch/utils.py (5)
AssistantMessage(43-46)SystemMessage(50-53)UserMessage(36-39)get_today_str(6-13)to_dict(27-28)tensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.py (2)
WorkerTag(33-34)process(90-202)
🪛 markdownlint-cli2 (0.18.1)
examples/scaffolding/contrib/DeepResearch/TavilyMCP/README.md
7-7: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🪛 Ruff (0.14.2)
examples/scaffolding/contrib/DeepResearch/run_deep_research.py
31-31: f-string without any placeholders
Remove extraneous f prefix
(F541)
examples/scaffolding/contrib/DeepResearch/TavilyMCP/travily.py
44-44: Unused noqa directive (non-enabled: SLF001)
Remove unused noqa directive
(RUF100)
62-62: Unused noqa directive (unknown: WPS437)
Remove unused noqa directive
(RUF100)
67-67: Possible binding to all interfaces
(S104)
tensorrt_llm/scaffolding/contrib/DeepResearch/supervisor.py
40-40: Undefined name tools
(F821)
90-90: Unused method argument: kwargs
(ARG002)
tensorrt_llm/scaffolding/contrib/DeepResearch/__init__.py
4-4: __all__ is not sorted
Apply an isort-style sorting to __all__
(RUF022)
tensorrt_llm/scaffolding/contrib/DeepResearch/researcher.py
75-75: Unused method argument: kwargs
(ARG002)
126-128: Consider iterable unpacking instead of concatenation
Replace with iterable unpacking
(RUF005)
feb1b64 to
90f9b07
Compare
|
/bot run |
|
PR_Github #23159 [ run ] triggered by Bot. Commit: |
|
PR_Github #23159 [ run ] completed with state |
|
/bot run |
|
PR_Github #23315 [ run ] triggered by Bot. Commit: |
|
PR_Github #23315 [ run ] completed with state |
90f9b07 to
12d9744
Compare
|
/bot run |
|
PR_Github #23397 [ run ] triggered by Bot. Commit: |
|
PR_Github #23397 [ run ] completed with state |
b49326c to
fd245cd
Compare
|
/bot run |
|
PR_Github #23480 [ run ] triggered by Bot. Commit: |
|
PR_Github #23480 [ run ] completed with state |
fd245cd to
35f9bc6
Compare
|
/bot run |
|
PR_Github #23554 [ run ] triggered by Bot. Commit: |
|
PR_Github #23554 [ run ] completed with state |
|
/bot run --disable-fail-test |
|
/bot run --help |
|
/bot --help |
GitHub Bot Help
Provide a user friendly way for developers to interact with a Jenkins server. Run See details below for each supported subcommand.
Launch build/test pipelines. All previously running jobs will be killed.
kill
Kill all running builds associated with pull request. skip
Skip testing for latest commit on pull request. reuse-pipeline
Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break. |
|
/bot run --disable-fail-fast |
|
PR_Github #23569 Bot args parsing error: usage: /bot [-h] |
|
PR_Github #23572 Bot args parsing error: usage: /bot [-h] |
|
PR_Github #23574 [ run ] triggered by Bot. Commit: |
|
PR_Github #23574 [ run ] completed with state |
35f9bc6 to
04a7753
Compare
|
/bot run --disable-fail-test |
|
PR_Github #23629 Bot args parsing error: usage: /bot [-h] |
|
/bot run |
|
PR_Github #23646 [ run ] triggered by Bot. Commit: |
|
PR_Github #23646 [ run ] completed with state |
Signed-off-by: Yi Sun <[email protected]>
04a7753 to
5e53d68
Compare
|
/bot run |
1 similar comment
|
/bot run |
|
PR_Github #23656 [ run ] triggered by Bot. Commit: |
|
PR_Github #23655 [ run ] triggered by Bot. Commit: |
|
PR_Github #23656 [ run ] completed with state |
|
PR_Github #23655 [ run ] completed with state |
Summary by CodeRabbit
Release Notes
Description
This PR implements deep research with scaffolding.
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.