Skip to content

feat(agents): add support for remote agents#16013

Merged
adamfweidman merged 13 commits intomainfrom
afw/remote-agents2
Jan 6, 2026
Merged

feat(agents): add support for remote agents#16013
adamfweidman merged 13 commits intomainfrom
afw/remote-agents2

Conversation

@adamfweidman
Copy link
Copy Markdown
Contributor

@adamfweidman adamfweidman commented Jan 6, 2026

Summary

Enables the Gemini CLI to interact with remote agents via the Agent-to-Agent (A2A) protocol. This introduces the RemoteAgentInvocation capability, allowing users to define and delegate tasks to agents hosted externally (e.g., on Agent Engine).

Details

This PR adds the foundational infrastructure for remote agent communication:

  • RemoteAgentInvocation: A new tool invocation type that proxies requests to remote agents, maintaining conversation state (context and task IDs) across turns.
  • ** Fetch Adapter**: Includes createAdapterFetch, a specialized fetch adapter to handle A2A Protocol mistmatches between the python-adk and a2a-js.
    • Note: This adapter will be removed when the a2a-js team addresses the issue.

Related Issues

Closes #15096
Makes progress towards: #15098. Currently defaults to ADC Auth.

How to Validate

  1. Configuration: Add a remote agent definition to your agents.toml (or equivalent config). For example:

    [[remote_agents]]
    name = "customer-analyst-assistant"  
    kind = "remote"
    agent_card_url = "https://us-central1-aiplatform.googleapis.com/v1beta1/projects/14326790950/locations/us-central1/reasoningEngines/5606203081843802112/a2a/v1/card"
  2. Execution: Run the CLI and use the delegate_to_agent tool (or natural language) to invoke the remote agent:

    "Say hello to the customer analyst assistant"
  3. Verification: Ensure the CLI successfully sends the request, receives the response from the remote service, and displays the output.

Pre-Merge Checklist

  • Added/updated tests (added A2AClientManager.test.ts, RemoteAgentInvocation.test.ts, a2aUtils.test.ts)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods

@adamfweidman adamfweidman requested review from a team as code owners January 6, 2026 19:39
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @adamfweidman, 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 introduces the foundational infrastructure for the Gemini CLI to interact with remote agents. It enables users to define and delegate tasks to agents hosted externally, such as on Agent Engine, by adding a new invocation type, a protocol adaptation layer to handle communication nuances, and updated configuration support. This significantly expands the CLI's capabilities by allowing it to leverage external AI services.

Highlights

  • Remote Agent Support: The Gemini CLI now supports interacting with remote agents via the Agent-to-Agent (A2A) protocol, enabling delegation of tasks to externally hosted agents like those on Agent Engine.
  • RemoteAgentInvocation: A new tool invocation type, RemoteAgentInvocation, has been introduced to proxy requests to remote agents, maintaining conversation state (context and task IDs) across interactions.
  • A2A Protocol Adapter: A specialized fetch adapter (createAdapterFetch) was added to handle protocol mismatches between the python-adk and a2a-js for Vertex AI Agent Engine compatibility. This adapter normalizes task state enums and maps request/response dialects.
  • TOML Configuration: The agent configuration loader has been updated to support defining remote agents with kind = "remote" in agents.toml.
  • Tooling Integration: DelegateToAgentTool and SubagentToolWrapper have been updated to seamlessly switch between local and remote agent execution based on the agent definition.
  • A2A Utility Functions: New utility functions in a2aUtils.ts were added to extract human-readable text from A2A messages and tasks, and to manage conversational IDs (contextId, taskId) for state persistence.
  • Authentication Handler: An ADCHandler (Google Application Default Credentials) has been implemented to provide authentication for remote agent calls.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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.

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 significant new functionality for interacting with remote agents using the A2A protocol. The implementation includes a compatibility adapter, new invocation types, and state management for conversations. While the overall structure is sound, I've identified a few critical issues related to the robustness of the compatibility layer, a lack of testing, and error handling in the authentication mechanism. Addressing these points will be crucial for ensuring the stability and reliability of this new feature.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 6, 2026

Size Change: +9.61 kB (+0.04%)

Total Size: 22.3 MB

Filename Size Change
./bundle/gemini.js 22.2 MB +9.61 kB (+0.04%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

Copy link
Copy Markdown
Contributor

@sehoon38 sehoon38 left a comment

Choose a reason for hiding this comment

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

LGTM with minor comments

@adamfweidman adamfweidman added this pull request to the merge queue Jan 6, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 6, 2026
@adamfweidman adamfweidman added this pull request to the merge queue Jan 6, 2026
Merged via the queue into main with commit 96b9be3 Jan 6, 2026
29 of 33 checks passed
@adamfweidman adamfweidman deleted the afw/remote-agents2 branch January 6, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2A Client Manager in RemoteAgentInvocation

3 participants