Skip to content

Conversation

@Ashitpatel001
Copy link

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.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Dec 13, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • New Tutorial Added: Introduces a new Jupyter notebook tutorial for building a Human-in-the-Loop Research Agent.
  • Technology Stack: Demonstrates the integration of Gemini 2.5 Flash for AI capabilities and LangGraph for orchestrating complex agent workflows.
  • Agent Capabilities: The agent is designed to intelligently plan research queries, execute web searches using the Tavily API, and synthesize findings into detailed reports.
  • Human-in-the-Loop Feature: Implements a crucial human-in-the-loop mechanism, allowing the user to review and approve the agent's research plan before it proceeds with execution.
  • Simplified Alternative: Provides a lightweight, notebook-based alternative to a more complex full-stack implementation of a research agent.
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
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 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,
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. If the execution_count has changed to something else than null, 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"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. When selecting a model, use a colab selector for easier maintainability. (link)

{
"cell_type": "code",
"source": [
"# PLANNER\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. Some notebooks can also benefit from having a form to update the prompt. (link)

{
"cell_type": "markdown",
"source": [
"**Conclusion and Future RoadMap**\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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'.
References
  1. Use second person: 'you' rather than 'we'. You will fail the lint check otherwise. (link)
  2. Use sentence case in titles/headings. (link)

Copy link
Author

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!

@Ashitpatel001
Copy link
Author

I have implemented all the requested changes (Colab forms, second-person perspective, cleaned outputs) and updated the README. Ready for re-review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tutorials support for Gemini models with LangGraph framework (for building Agentic Workflows and Agentic Design Patterns)

1 participant