Skip to content

Conversation

@zzhangpurdue
Copy link
Collaborator

📝 PR Type

  • Add new sample
  • Update existing sample
  • Add new test cases
  • Fix test failures
  • Documentation/Configuration update

support deepresearch serving and webui.

📚 Description

[Please briefly describe the background, changes, and purpose of this PR. For example:

  • Added game_werewolves to demonstrate XYZ functionality in agentscope.
  • Fixed test failures in game_test.py caused by agentscope interface changes.
  • Updated dependency installation instructions in README.md of agentscope-samples.]

🧪 Testing Validation

[Please explain how to validate the changes:

  1. How to run the added/modified test cases?
  2. Is integration testing with agentscope required?
  3. Has code been formatted (e.g., pre-commit)?]

✅ Checklist

Please complete the following checks before submitting the PR:

  • All sample code has been formatted with pre-commit run --all-files
  • All new/modified test cases have passed (run pytest tests/)
  • Test coverage has not decreased (if applicable)
  • Sample code follows agentscope best practices (e.g., config management, logging)
  • Related documentation in agentscope-samples has been updated (e.g., README.md)

@cla-assistant
Copy link

cla-assistant bot commented Dec 3, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Zhicheng Zhang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for deploying the Deep Research agent as a service with a web UI, integrating ModelStudio web search as the default search tool, and adding optional Aliyun OSS storage for generated reports.

Key changes:

  • Added deployment capability via deploy.py with AgentScope runtime integration
  • Switched default search from Tavily to ModelStudio web search while maintaining Tavily as optional
  • Added Aliyun OSS integration for uploading generated research reports with signed URLs

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
tests/agent_deep_research_test.py Updated import to use renamed run function instead of main
deep_research/agent_deep_research/utils.py Added OSS upload utility function and reduced TOOL_RESULTS_MAX_WORDS from 5000 to 500
deep_research/agent_deep_research/requirements.txt Added agentscope-runtime and oss2 dependencies
deep_research/agent_deep_research/main.py Renamed main function to run and changed example query to Chinese
deep_research/agent_deep_research/deploy.py New file implementing agent deployment with session management and state persistence
deep_research/agent_deep_research/deep_research_agent.py Integrated ModelStudio search, added OSS upload to report generation, modified message handling for list inputs, and uncommented debug print statements
deep_research/agent_deep_research/built_in_prompt/*.md Added language sensitivity instructions to prompts to maintain user's input language
deep_research/agent_deep_research/README.md Updated documentation for ModelStudio search setup and deployment instructions
.gitignore Added log/ directory to ignore list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to 45
Once run the deploy script, the deepresearch will run at `http://0.0.0.0:8090/process` with sync manner,
and a webui will start at `http://localhost:5173/`, then user could test the service at the webui.


Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "sync" should be "asynchronous" or "async". The description "with sync manner" is grammatically awkward and technically inaccurate since the deploy script uses async functions. Consider rewording to: "the deepresearch will run at http://0.0.0.0:8090/process and a webui will start at http://localhost:5173/, then user could test the service at the webui."

Suggested change
Once run the deploy script, the deepresearch will run at `http://0.0.0.0:8090/process` with sync manner,
and a webui will start at `http://localhost:5173/`, then user could test the service at the webui.
Once you run the deploy script, the deepresearch service will be available at `http://0.0.0.0:8090/process`, and a webui will start at `http://localhost:5173/`. You can test the service using the webui.

Copilot uses AI. Check for mistakes.
)
await tavily_search_client.connect()
```
and make sure disable modelstudio_web_search, and enable tavily-search, in `deep_research_agent.py` at line 170 and line 177, respectively.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error: "and make sure disable" should be "and make sure to disable". Also, the instruction could be clearer about the specific changes needed.

Suggested change
and make sure disable modelstudio_web_search, and enable tavily-search, in `deep_research_agent.py` at line 170 and line 177, respectively.
and make sure to disable `modelstudio_web_search` and to enable `tavily-search` in `deep_research_agent.py` at line 170 and line 177, respectively.

Copilot uses AI. Check for mistakes.
return write_report_tool_res_msg, detailed_report_path, oss_url

async def _summarizing(self) -> Msg:
"""Generate a report based on the exsisting findings when the
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the docstring: "exsisting" should be "existing".

Suggested change
"""Generate a report based on the exsisting findings when the
"""Generate a report based on the existing findings when the

Copilot uses AI. Check for mistakes.
Comment on lines +181 to +183
await self.toolkit.register_mcp_client(search_mcp_client)
# using modelstudio web search
self.toolkit.tools.pop("tavily-search")
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When search_mcp_client is None (which is now allowed by the Optional parameter), calling await self.toolkit.register_mcp_client(search_mcp_client) will likely fail. The code should check if search_mcp_client is not None before attempting to register it.

Suggested change
await self.toolkit.register_mcp_client(search_mcp_client)
# using modelstudio web search
self.toolkit.tools.pop("tavily-search")
if search_mcp_client is not None:
await self.toolkit.register_mcp_client(search_mcp_client)
# using modelstudio web search
self.toolkit.tools.pop("tavily-search")

Copilot uses AI. Check for mistakes.
Comment on lines +178 to +185
loop = asyncio.get_running_loop()

async def _init_mcp_client():
await self.toolkit.register_mcp_client(search_mcp_client)
# using modelstudio web search
self.toolkit.tools.pop("tavily-search")

loop.create_task(_init_mcp_client())
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task to initialize the MCP client is created but not awaited, which could lead to race conditions. The code immediately sets self.search_function = "modelstudio_web_search" on line 187, but attempts to pop "tavily-search" from self.toolkit.tools inside the unawaited task. If the agent is used before this task completes, "tavily-search" might still be present in the toolkit, or the registration might not be complete.

Copilot uses AI. Check for mistakes.
Comment on lines +62 to 64
and make sure disable modelstudio_web_search, and enable tavily-search, in `deep_research_agent.py` at line 170 and line 177, respectively.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line number references (line 170 and line 177) are now outdated after the code changes. With the new code structure, line 170 is where self.toolkit.register_tool_function(self.generate_response) is, and line 177 is within the modelstudio tool registration. The instructions should be updated to provide accurate line numbers or be more descriptive (e.g., "comment out the modelstudio search registration and uncomment the tavily-search line").

Suggested change
and make sure disable modelstudio_web_search, and enable tavily-search, in `deep_research_agent.py` at line 170 and line 177, respectively.
In `deep_research_agent.py`, make sure to disable the modelstudio web search registration and enable the tavily-search registration.
Specifically, comment out the line that registers the modelstudio search tool, and uncomment the line that registers the tavily-search tool.

Copilot uses AI. Check for mistakes.
make sure `export DASHSCOPE_API_KEY="your_dashscope_api_key_here" have enable the web search from
[here](https://bailian.console.aliyun.com/?tab=app#/mcp-market/detail/WebSearch)

3. **Optional:Test Tavily MCP Server**:
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing colon after "Optional". The correct formatting should be "3. Optional: Test Tavily MCP Server:"

Suggested change
3. **Optional:Test Tavily MCP Server**:
3. **Optional: Test Tavily MCP Server**:

Copilot uses AI. Check for mistakes.
request: AgentRequest = None,
**kwargs,
):
assert kwargs is not None, "kwargs is Required for query_func"
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert statement is checking kwargs which is always truthy (it's a dict, even if empty). This assertion will never fail. If you want to check that kwargs is not empty, use assert kwargs or assert len(kwargs) > 0. However, the comment suggests kwargs is required but the code doesn't actually use kwargs, so this assertion may not be needed at all.

Suggested change
assert kwargs is not None, "kwargs is Required for query_func"

Copilot uses AI. Check for mistakes.
Comment on lines +347 to +352
# if (
# tool_call["name"] != self.finish_function_name
# or (tool_call["name"] == self.finish_function_name
# and not chunk.metadata.get("success"))
# ):
await self.print(tool_res_msg, chunk.is_last)
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out code should be removed rather than left in place. If this conditional printing logic is no longer needed, remove it. If it might be needed later, document why it was removed in a comment or commit message. The unconditional await self.print(tool_res_msg, chunk.is_last) on line 352 now prints all tool results including the finish function, which may not be the desired behavior based on the original logic.

Copilot uses AI. Check for mistakes.
# ):
await self.print(tool_res_msg, chunk.is_last)

logger.info(f"chunk: {chunk}")
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This debug logging statement should be removed or changed to use the appropriate log level (debug instead of info). Logging "chunk" for every iteration could produce excessive logs in production.

Suggested change
logger.info(f"chunk: {chunk}")
logger.debug(f"chunk: {chunk}")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant