Skip to content

feat: add ADK agent samples for Parameter Manager#14103

Open
amitmodak wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
amitmodak:add-pm-adk-samples
Open

feat: add ADK agent samples for Parameter Manager#14103
amitmodak wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
amitmodak:add-pm-adk-samples

Conversation

@amitmodak
Copy link
Copy Markdown
Contributor

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

@amitmodak amitmodak requested review from a team as code owners April 22, 2026 14:54
@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Apr 22, 2026
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 new samples and tests for using the Agent Development Kit (ADK) with Google Cloud Parameter Manager, covering both global and regional configurations. The review feedback highlights several areas for improvement, including correcting the regional API endpoint format and model version names, resolving environment variable mismatches in the documentation, and ensuring that fetched payloads are actually utilized in the sample code. Additionally, the Nox configuration should be updated to include modern Python versions in the test suite to ensure proper coverage.


@pytest.fixture()
def client(location: str) -> parametermanager_v1.ParameterManagerClient:
api_endpoint = f"parametermanager.{location}.rep.googleapis.com"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The API endpoint format parametermanager.{location}.rep.googleapis.com seems incorrect for a public sample. The standard regional endpoint for Parameter Manager is typically LOCATION-parametermanager.googleapis.com.

Suggested change
api_endpoint = f"parametermanager.{location}.rep.googleapis.com"
api_endpoint = f"{location}-parametermanager.googleapis.com"

```env
GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The environment variable GOOGLE_CLOUD_LOCATION is not used by the global agent sample. Consider removing this line to avoid confusion for users setting up the global agent.

```env
GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The regional agent code in agent_regional/agent.py expects the environment variable GOOGLE_CLOUD_PROJECT_LOCATION, but the README uses GOOGLE_CLOUD_LOCATION. Please update this to match the implementation.

Suggested change
GOOGLE_CLOUD_LOCATION=us-central1
GOOGLE_CLOUD_PROJECT_LOCATION=us-central1

Comment on lines +41 to +42
parameter_payload = client.get_parameter(resource_name)
print("Successfully fetched parameter.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The variable parameter_payload is assigned but never used. In a sample, it is helpful to demonstrate how to access the fetched data, for example by printing it.

Suggested change
parameter_payload = client.get_parameter(resource_name)
print("Successfully fetched parameter.")
parameter_payload = client.get_parameter(resource_name)
print(f"Successfully fetched parameter: {parameter_payload}")


# Initialize Agent
root_agent = Agent(
model='gemini-2.5-flash',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The model name gemini-2.5-flash appears to be a typo. Standard Gemini model versions are typically 1.5 or 2.0. Please verify the intended model version.

Suggested change
model='gemini-2.5-flash',
model='gemini-1.5-flash',


TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The ignored_versions list includes all common Python 3 versions (3.9 through 3.12). This will cause the tests to be skipped in most CI environments. Consider removing modern versions from this list to ensure the samples are properly tested.

Suggested change
"ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
"ignored_versions": ["2.7", "3.7", "3.8"],

Comment on lines +42 to +43
parameter_payload = client.get_parameter(resource_name)
print("Successfully fetched parameter.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The variable parameter_payload is assigned but never used. In a sample, it is helpful to demonstrate how to access the fetched data, for example by printing it.

Suggested change
parameter_payload = client.get_parameter(resource_name)
print("Successfully fetched parameter.")
parameter_payload = client.get_parameter(resource_name)
print(f"Successfully fetched parameter: {parameter_payload}")


# Initialize Agent
root_agent = Agent(
model='gemini-2.5-flash',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The model name gemini-2.5-flash appears to be a typo. Standard Gemini model versions are typically 1.5 or 2.0. Please verify the intended model version.

Suggested change
model='gemini-2.5-flash',
model='gemini-1.5-flash',


TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The ignored_versions list includes all common Python 3 versions (3.9 through 3.12). This will cause the tests to be skipped in most CI environments. Consider removing modern versions from this list to ensure the samples are properly tested.

Suggested change
"ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
"ignored_versions": ["2.7", "3.7", "3.8"],

Comment on lines +55 to +56
version_path = f"projects/{project_id}/locations/{location}/parameters/{parameter_id}/versions/1"
parameter_path = f"projects/{project_id}/locations/{location}/parameters/{parameter_id}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

It is recommended to use the client's helper methods (e.g., parameter_version_path and parameter_path) to construct resource names instead of hardcoded strings. This ensures consistency and reduces the risk of formatting errors.

Suggested change
version_path = f"projects/{project_id}/locations/{location}/parameters/{parameter_id}/versions/1"
parameter_path = f"projects/{project_id}/locations/{location}/parameters/{parameter_id}"
version_path = client.parameter_version_path(project_id, location, parameter_id, "1")
parameter_path = client.parameter_path(project_id, location, parameter_id)

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

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant