Skip to content

fix(deep_research_agent): fix the bug in multi-turn deep research#1239

Merged
DavdGao merged 3 commits intoagentscope-ai:mainfrom
Luohh5:bugfix_0213
Mar 11, 2026
Merged

fix(deep_research_agent): fix the bug in multi-turn deep research#1239
DavdGao merged 3 commits intoagentscope-ai:mainfrom
Luohh5:bugfix_0213

Conversation

@Luohh5
Copy link
Copy Markdown
Member

@Luohh5 Luohh5 commented Feb 13, 2026

fix(deep_research_agent): fix the bug in multi-turn deep research

Checklist

Please check the following items before code is ready to be reviewed.

  • [x ] Code has been formatted with pre-commit run --all-files command
  • [x ] All tests are passing
  • [x ] Docstrings are in Google style
  • [x ] Related documentation has been updated (e.g. links, examples, etc.)
  • [x ] Code is ready for review

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Luohh5, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug in the DeepResearch Agent's multi-turn conversation capabilities. The changes ensure that the agent can properly process and respond within a conversational flow, maintain context across turns, and generate more organized intermediate reports. The accompanying documentation has also been updated to guide users on implementing multi-turn interactions.

Highlights

  • Multi-turn conversation support: The DeepResearch Agent's reply method was updated to correctly handle message lists, enabling multi-turn conversations by processing the latest message in a sequence.
  • Improved report file naming: Intermediate research reports now include the user's query in their filenames, making them more descriptive and easier to track.
  • Summary retention in memory: The final summary generated by the agent is now explicitly added to its memory, ensuring that the agent retains context from previous turns.
  • Documentation update: The README.md example was expanded to demonstrate how to implement multi-turn conversations with the DeepResearch Agent.
Changelog
  • examples/agent/deep_research_agent/README.md
    • Updated the step numbering for running the script.
    • Added a new section with Python code demonstrating how to implement multi-turn conversations with the Deep Research Agent.
  • examples/agent/deep_research_agent/deep_research_agent.py
    • Modified the reply method to check if the input msg is a list, extracting the last message for processing in multi-turn scenarios.
    • Updated the user_query and current_msg.content assignments to use the current_msg variable, ensuring correct message handling.
    • Changed the naming convention for intermediate report files in summarize_intermediate_results and _generate_deepresearch_report to include self.user_query for better identification.
    • Ensured that the summarize_result is added to the agent's memory within the _summarizing method before being returned.
Activity
  • The author, Luohh5, has completed the checklist items, indicating that the code has been formatted, tests are passing, docstrings are in Google style, related documentation has been updated, and the code is ready for review.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix for multi-turn conversations in the DeepResearchAgent. The changes correctly adapt the reply method to handle message history and make report filenames unique to avoid conflicts between turns. However, the review identified a critical security vulnerability (path traversal) from using unsanitized user input in filenames, and a critical bug where a coroutine is not awaited, preventing messages from being saved to memory. Additionally, there's an issue in the updated documentation's example code and a violation of the project's docstring standards. Addressing these issues is crucial for the stability and security of the agent.

Comment thread examples/agent/deep_research_agent/deep_research_agent.py
Comment thread examples/agent/deep_research_agent/deep_research_agent.py
Comment thread examples/agent/deep_research_agent/README.md
Comment thread examples/agent/deep_research_agent/deep_research_agent.py
@DavdGao DavdGao linked an issue Feb 13, 2026 that may be closed by this pull request
@DavdGao DavdGao merged commit 45200b2 into agentscope-ai:main Mar 11, 2026
12 checks passed
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.

Error with list type

2 participants