Skip to content

Conversation

ishanrajsingh
Copy link

Bug Fix: Memory Bank Service Agent ID Extraction (#2940)

Problem

Users were unable to find the agent ID when setting up Memory Bank Service. The api_resource.name attribute returns the full Google Cloud resource path, but Memory Bank Service expects only the agent engine ID.

Root Cause

  • Add extract_agent_engine_id utility function with validation
  • Create comprehensive test suite (14 tests, all passing)
  • Update VertexAiMemoryBankService with enhanced documentation
  • Add warning for common full-path vs ID mistake

The core fix: Use agent_engine.api_resource.name.split('/')[-1] to extract agent ID from full resource path for Memory Bank Service initialization.

Resolves #2940: Users unable to find agent ID for Memory Bank Service

- Add extract_agent_engine_id utility function with validation
- Create comprehensive test suite (14 tests, all passing)
- Update VertexAiMemoryBankService with enhanced documentation
- Add warning for common full-path vs ID mistake

The core fix: Use agent_engine.api_resource.name.split('/')[-1] to extract
agent ID from full resource path for Memory Bank Service initialization.

Resolves google#2940: Users unable to find agent ID for Memory Bank Service
Copy link

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

Summary of Changes

Hello @ishanrajsingh, 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 resolves a critical issue where users encountered difficulties setting up the Memory Bank Service due to an incorrect understanding of the required agent ID format. The changes provide a robust solution by introducing dedicated utility functions for agent ID extraction, significantly improving the clarity of documentation, and implementing proactive warnings and more informative error messages to guide users toward successful service configuration.

Highlights

  • Agent ID Extraction Utility: Introduced a new utility function, extract_agent_engine_id, to correctly parse and extract the agent engine ID from the full Google Cloud resource path, addressing a common user issue with Memory Bank Service setup.
  • Enhanced Documentation and Warnings: Updated the VertexAiMemoryBankService class with detailed documentation and examples demonstrating the correct agent ID extraction. A warning is now logged if an agent_engine_id containing '/' is passed, guiding users to the correct format.
  • Improved Error Handling: Enhanced error messages within VertexAiMemoryBankService to provide clearer guidance when agent_engine_id is incorrectly formatted or missing, suggesting the use of agent_engine.api_resource.name.split('/')[-1].
  • New Example and Test Suite: Added a new example (memory_bank_complete_setup.py) to illustrate the complete and correct setup of Memory Bank Service, along with a comprehensive test suite (14 tests) for the new resource utility functions to ensure robustness.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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.

@adk-bot adk-bot added bot triaged [Bot] This issue is triaged by ADK bot services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc labels Sep 13, 2025
@adk-bot adk-bot requested a review from DeanChensj September 13, 2025 13:13
Copy link

@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 addresses an issue with agent ID extraction for the Memory Bank Service by introducing utility functions and improving documentation and error handling. The core logic fix is sound and well-documented. However, I've identified a few issues, including a critical bug that breaks the package's public API by redefining __all__, and another critical bug in an example script's path manipulation that will cause it to fail. I've also noted some areas for improvement regarding import conventions, exception handling, and test coverage. Please review the detailed comments.

ishanrajsingh and others added 5 commits September 13, 2025 19:03
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Fix breaking API change by extending __all__ instead of redefining
- Correct path manipulation in example file
- Replace bare except with specific Exception handling
- Use relative imports for better package organization
- Make regex patterns consistent to allow hyphens
- Add missing test coverage for utility functions
- Remove unnecessary try-catch wrapper
- Fix breaking API change by extending __all__ instead of redefining
- Correct path manipulation in example file
- Replace bare except with specific Exception handling
- Use relative imports for better package organization
- Make regex patterns consistent to allow hyphens
- Add missing test coverage for utility functions
- Remove unnecessary try-catch wrapper
@ishanrajsingh
Copy link
Author

ishanrajsingh commented Sep 13, 2025

@DeanChensj I have worked on the issue, kindly review my pr#2941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot triaged [Bot] This issue is triaged by ADK bot services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not able to find agent id for Memory Bank Service
2 participants