-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add Human-in-the-Loop Research Agent tutorial #1063
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
base: main
Are you sure you want to change the base?
Add Human-in-the-Loop Research Agent tutorial #1063
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Summary of ChangesHello @Ashitpatel001, 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 introduces a comprehensive tutorial demonstrating the creation of a Human-in-the-Loop Research Agent. The agent leverages Gemini 2.5 Flash and LangGraph to intelligently plan, execute web searches, and generate reports, with a key feature being the ability for human intervention to approve the research plan, ensuring controlled and effective information gathering. Highlights
Using Gemini Code AssistThe 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
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 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
|
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.
Code Review
This pull request adds a valuable tutorial on creating a Human-in-the-Loop Research Agent. The notebook is well-structured and demonstrates the concepts clearly. However, there are several areas that need improvement to align with the repository's style guide. Key issues include the use of !pip instead of %pip, hardcoded model names and user inputs instead of using Colab forms, inconsistent API key handling, and markdown text not adhering to the second-person perspective. Additionally, the notebook's execution_count fields are populated, indicating that the formatting script has not been run. Finally, please remember to add a reference to this new notebook in the appropriate README file(s) as per the contribution guidelines.
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 38, |
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.
The execution_count for this cell is not null. As per the repository style guide (lines 43-44), this indicates that the notebook formatting script has not been run. Please run the formatter before submitting to clear all execution counts.
References
- If the
execution_counthas changed to something else thannull, it usually indicates that the formatting script has not been run. A warning should be raised. (link)
| { | ||
| "cell_type": "code", | ||
| "source": [ | ||
| "!pip install -U -q langgraph langchain-google-genai langchain-community tavily-python" |
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.
The style guide (line 55) requires using %pip instead of !pip for installations in notebooks. Please update this command.
!%pip install -U -q langgraph langchain-google-genai langchain-community tavily-python
References
- use %pip instead of !pip (link)
| " steps: List[str] = Field(description=\"List of search queries to run.\")\n", | ||
| "\n", | ||
| "#initialize the model and search tool\n", | ||
| "model = ChatGoogleGenerativeAI(model=\"gemini-2.5-flash\", temperature=0) # We use Gemini 2.5 Flash for speed and structured output capabilities\n", |
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.
The model ID is hardcoded. The repository style guide (line 72) recommends using a Colab form parameter for model selection to make it easier for users to experiment with different models. Please define a MODEL_ID variable with a @param and use it here, for example:
MODEL_ID = "gemini-2.5-flash" # @param ["gemini-2.5-flash", "gemini-2.5-pro"]
model = ChatGoogleGenerativeAI(model=MODEL_ID, temperature=0)References
- When selecting a model, use a colab selector for easier maintainability. (link)
| { | ||
| "cell_type": "code", | ||
| "source": [ | ||
| "# PLANNER\n", |
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.
Several comments in this cell do not follow the style guide (line 179), which requires comments to be complete sentences starting with a capital letter. For example, # PLANNER should be something like # This is the planner node..
References
- Use complete sentences: Start comments with a capital letter and use proper punctuation. (link)
| "source": [ | ||
| "## Step 3: Build the Graph with \"Human-in-the-Loop\"\n", | ||
| "\n", | ||
| "We connect the nodes using **LangGraph**.\n", |
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.
The style guide (line 91) requires using the second person ('you'). This sentence uses 'We'. Please rephrase.
You connect the nodes using **LangGraph**.\n
References
- Use second person: 'you' rather than 'we'. You will fail the lint check otherwise. (link)
| "thread = {\"configurable\": {\"thread_id\": \"1\"}}\n", | ||
| "\n", | ||
| "#Enter your query here\n", | ||
| "user_input = {\"topic\": \"the mystery of pyramid giza\"}\n", |
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.
The user input topic is hardcoded. The style guide (lines 74-77) suggests using a Colab form parameter to allow users to easily change the input. Please use a @param for the topic.
user_input = {"topic": "the mystery of pyramid giza"} # @param {type:"string"}
References
- Some notebooks can also benefit from having a form to update the prompt. (link)
| { | ||
| "cell_type": "markdown", | ||
| "source": [ | ||
| "**Conclusion and Future RoadMap**\n", |
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.
This markdown cell contains several violations of the style guide:
- Line 91: The text uses 'we' (e.g., 'restart where we left off', 'we are only able to debug'). Please use the second person ('you').
- Line 88: The heading 'Conclusion and Future RoadMap' should be in sentence case, e.g., 'Conclusion and future roadmap'.
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.
I have implemented all the requested changes (Colab forms, second-person perspective, cleaned outputs) and updated the README. Ready for re-review!
|
I have implemented all the requested changes (Colab forms, second-person perspective, cleaned outputs) and updated the README. Ready for re-review! |
Resolves #992.
Adds
examples/Agents/Gemini_LangGraph_Research_Agent.ipynb.This tutorial demonstrates a Human-in-the-Loop Research Agent using Gemini 2.5 Flash and LangGraph.
This serves as a lightweight, notebook-based alternative to the Fullstack Quickstart.