Skip to content

feat(agentregistry): add ADK authentication samples - #15003

Merged
NimJay merged 2 commits into
mainfrom
feat/agentregistry-adk-auth-samples
Dec 1, 2026
Merged

NimJay merged 2 commits into
mainfrom
feat/agentregistry-adk-auth-samples

Conversation

@fatoboist

Copy link
Copy Markdown
Contributor

Description

Adds the Agent Registry authentication samples and pytest suites under agentregistry/adk/ (PR B of migrating inline Agent Registry documentation snippets to GitHub; builds on #15002; internal tracking: b/581932768).

Files added

  • agentregistry/adk/auth_remote_a2a_agent.py + auth_remote_a2a_agent_test.py (agentregistry_adk_auth_remote_a2a_agent)
  • agentregistry/adk/auth_mcp_toolset.py + auth_mcp_toolset_test.py (agentregistry_adk_auth_mcp_toolset)
  • agentregistry/adk/resolve_auth_bindings.py + resolve_auth_bindings_test.py (agentregistry_adk_resolve_auth_bindings)
  • agentregistry/adk/resolve_auth_bindings_3lo.py + resolve_auth_bindings_3lo_test.py (agentregistry_adk_resolve_auth_bindings_3lo)
  • agentregistry/adk/mcp_custom_headers.py + mcp_custom_headers_test.py (agentregistry_adk_mcp_custom_headers)

API & Test Infrastructure Notes

  • Depends on agentregistry/adk/requirements.txt, noxfile_config.py, and agentregistry/README.md from feat(agentregistry): add ADK and Agent Engine samples with CI scaffolding #15002, plus agentregistry.googleapis.com enablement and fixture setup on the shared test project (AGENTREGISTRY_TEST_AGENT_ID, AGENTREGISTRY_TEST_MCP_SERVER_ID).
  • Optional fixture env vars for 3LO and external MCP server integration tests: AGENTREGISTRY_TEST_3LO_MCP_SERVER_ID and AGENTREGISTRY_TEST_EXTERNAL_MCP_SERVER_ID (these tests skip cleanly when not set; test_my_auth_headers runs as a unit test without API calls).

Checklist

Testing

Compliance & Style


Post-Approval Actions

  • Please merge this PR for me once it is approved

@fatoboist
fatoboist requested review from a team as code owners November 27, 2026 17:21
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@snippet-bot

snippet-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label Bot added api: agentregistry Issues related to the Agent Registry API. samples Issues that are directly related to samples. labels Nov 27, 2026
@fatoboist

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces several new Python scripts and corresponding tests under agentregistry/adk/ demonstrating how to authenticate and resolve bindings for MCP toolsets and remote A2A agents using the Agent Registry ADK. Feedback on the changes suggests simplifying the custom authentication flow in auth_remote_a2a_agent.py by utilizing the official google.auth.transport.httpx.Auth class instead of implementing a custom httpx.Auth class, which also helps streamline the imported dependencies.

@evelyn-goo evelyn-goo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for putting together the auth samples

Comment thread agentregistry/adk/auth_mcp_toolset.py Resolved
Comment thread agentregistry/adk/mcp_custom_headers.py Resolved
@fatoboist
fatoboist requested a review from evelyn-goo November 30, 2026 15:16

@evelyn-goo evelyn-goo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you! Looks great


def resolve_auth_bindings(
mcp_server_name: str = "mcpServers/SERVER_ID",
model: str = "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.

Suggestion: Gemini 2.5 reached end-of-life today. Under the hood, I believe Gemini Flash 3+ would be used here. Consider changing the model.

"""Retrieves an MCP toolset authenticated with Application Default Credentials."""
# Initialize the registry client
project_id = os.environ.get("GOOGLE_CLOUD_PROJECT")
location = os.environ.get("GOOGLE_CLOUD_LOCATION", "global")

@NimJay NimJay Dec 1, 2026 •

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.

Nit: Location and Project ID should come in through the sample function params.
See: https://googlecloudsamples.github.io/catalog/docs/effective-samples/author-samples/#minimal-arguments

This applies to all samples in this PR.

@NimJay NimJay left a comment

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.

Thank you, @fatoboist, for getting these samples in! 👏

Note that integration testing in this repo is currently broken/ignored.
Those _test.py files will not be run/verified.

I trust that you've tested these samples adequately.

I left a few non-blocking comments; feel free to address them in a follow-up PR. Merging!

@NimJay
NimJay merged commit f6e1202 into main Dec 1, 2026
14 of 19 checks passed
@NimJay
NimJay deleted the feat/agentregistry-adk-auth-samples branch December 1, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: agentregistry Issues related to the Agent Registry API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants