feat(a2a): enable native gRPC support and protocol routing#21403
feat(a2a): enable native gRPC support and protocol routing#21403alisa-alisa merged 8 commits intomainfrom
Conversation
|
Hi @alisa-alisa, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
|
This PR is a part of another big split PR: #21348 |
Summary of ChangesHello, 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 significantly upgrades the agent-to-agent (A2A) communication layer by introducing native gRPC support and intelligent protocol routing. It prioritizes high-performance gRPC for AI agent interactions while maintaining robust security through comprehensive SSRF validation. These changes ensure efficient and secure communication, laying the groundwork for more advanced agent capabilities. Highlights
Changelog
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
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant enhancements by adding native gRPC support, protocol routing, and robust, multi-layered SSRF protection. The changes are well-structured, and the inclusion of comprehensive tests for the new security measures is excellent. I have one suggestion regarding the maintainability of the gRPC transport configuration to make it more resilient to future SDK changes.
d1a90c2 to
7e03bc0
Compare
51e02ec to
04b1ac3
Compare
7e03bc0 to
489fa40
Compare
04b1ac3 to
0e8c9b6
Compare
489fa40 to
9b131e2
Compare
0e8c9b6 to
c78e367
Compare
9b131e2 to
1817c62
Compare
|
Thanks |
c78e367 to
f43956b
Compare
c61ed08 to
15156e3
Compare
f43956b to
2742c7c
Compare
15156e3 to
51aa3cf
Compare
11f1e5a to
ec8bf97
Compare
|
Size Change: +121 kB (+0.46%) Total Size: 26.1 MB
ℹ️ View Unchanged
|
…rect gRPC URL - Pass empty string to resolver.resolve() to prevent SDK from appending /.well-known/agent-card.json to direct card URLs - Simplify normalizeAgentCard to only handle proto field name aliases (supportedInterfaces → additionalInterfaces, protocolBinding → transport) - Use gRPC-specific URL from additionalInterfaces for credentials - Remove dead helper functions and unnecessary behaviors - Add shallow copy to prevent SDK object mutation
861ccac to
16c5c0b
Compare
Co-authored-by: Adam Weidman <adamfweidman@google.com>
…mini#21403) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…mini#21403) Co-authored-by: Adam Weidman <adamfweidman@google.com>
Summary
This PR significantly simplifies and optimizes the A2A (Agent-to-Agent) client
implementation, focusing on gRPC transport reliability, streamlined card
normalization, and robust URL resolution. It removes complex SSRF/DNS-rebinding
protection logic that was causing connection issues and moves towards a leaner,
more maintainable architecture.
Details
1. Simplified gRPC Transport & A2A Client Manager
rebinding logic with a direct
GrpcTransportFactoryinstantiation usingstandard gRPC credentials.
loadAgentto useresolver.resolve(agentCardUrl, ''). This prevents the A2A SDK fromautomatically appending
.well-known/agent-card.jsonto URLs that are alreadyfully qualified, fixing 404 errors when using direct card URLs.
loadAgentto usefactory.createFromAgentCard(agentCard)instead of re-fetching the card fromthe URL, improving performance and reliability.
sendMessageStream,getTask, andcancelTaskto aid in debugging remoteagent interactions.
2. Streamlined Agent Card Normalization (
a2aUtils.ts)normalizeAgentCardto use manualfield mapping and type guards instead of Zod schemas, reducing complexity and
bundle size.
supportedInterfacesto
additionalInterfacesandprotocolBindingtotransportto supportdifferent A2A protocol versions.
prevent unintended mutation of the SDK's cached objects.
3. Cleanup & Refactoring
pinUrlToIp,getGrpcChannelOptions,getGrpcCredentials, andextractNormalizedInterfaces.node:dns,zod,safeLookup) and updated related unit tests.Related Issues
Related to #18642.
How to Validate
npm test -w @google/gemini-cli-core -- src/agents/a2a-client-manager.test.ts src/agents/a2aUtils.test.tsagent_card_url(e.g.,http://127.0.0.1:9001/.well-known/agent-card.json).Hello, call the grpc-test-agent tool and say hi).Pre-Merge Checklist