-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix: Make memory_service optional in CLI to match Runner implementation (Issue #3251) #3253
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
Fix: Make memory_service optional in CLI to match Runner implementation (Issue #3251) #3253
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @totsukash, 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 an inconsistency in the 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
|
|
Response from ADK Triaging Agent Hello @totsukash, thank you for your contribution! Before we can proceed with the review, could you please sign the Contributor License Agreement (CLA)? The CLA check is currently failing. For details, please see the comment from the Thanks! |
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 addresses issue #3251 by making the memory_service optional in the CLI, aligning its behavior with the Runner class implementation. This change prevents unnecessary memory accumulation and potential OOM issues in long-running production environments. The changes include modifying src/google/adk/cli/fast_api.py to set memory_service to None by default and adding unit tests in tests/unittests/cli/test_fast_api.py to verify the new behavior. The code changes look good and the tests are comprehensive.
a066884 to
4e140e5
Compare
- Changed default memory_service from InMemoryMemoryService() to None when --memory_service_uri is not specified - Aligns CLI behavior with Runner class implementation where memory_service is Optional[BaseMemoryService] - Prevents unnecessary memory accumulation and potential OOM issues in long-running production environments Added comprehensive unit tests: - test_memory_service_none_when_no_uri_provided: Verifies memory_service defaults to None when no URI is specified - test_memory_service_created_when_uri_provided: Verifies memory_service is created correctly when URI is provided - test_invalid_memory_service_uri_raises_exception: Verifies proper exception handling for invalid URIs Fixes google#3251
4e140e5 to
f2ba333
Compare
|
Close as the original issue was a false alarm. |
Summary
memory_servicedefault toNonein CLI when--memory_service_uriis not specifiedRunnerclass implementation wherememory_serviceis optionalProblem Statement
When running
adk api_serverwithout the--memory_service_uriflag, the CLI automatically creates anInMemoryMemoryServiceinstance by default. This behavior is inconsistent with theRunnerclass implementation, where memory service can beNone, and can lead to memory accumulation and potential Out Of Memory (OOM) errors in production environments.Changes
Modified file:
src/google/adk/cli/fast_api.py(line 98-101)Before:
After:
Testing Plan
Unit Tests
Added three comprehensive unit tests in
tests/unittests/cli/test_fast_api.py:memory_serviceisNonewhen no URI is providedmemory_serviceis created correctly when URI is providedManual E2E Testing (To be performed)
Scenario 1: Start server without
--memory_service_uriflagScenario 2: Start server with explicit
--memory_service_uriadk api_server test_agent --port 8000 --memory_service_uri "memory://in_memory"Scenario 3: Verify compatibility with other services
Impact
Optional[BaseMemoryService]Related Issue
Fixes #3251
Checklist
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]