a2aproject / a2aproject/A2A

[Feat]: Support multi-agent composition by registering HostAgent via create_agent as an AgentTool

オープン
#563 コメント 4 件 リアクション 0 件 担当者 1 名 @rajeshvelicheti が担当を希望しています GitHub で見る
enhancement In Progress
主要言語
Shell
スター
25.7k
フォーク
2.6k
平均マージ
3日 6時間
マージ済み PR(30日)
16

説明

### Is your feature request related to a problem? Please describe.

While multi-agent composition is possible using tools like google_adk, existing implementations do not yet demonstrate how the A2A protocol can be used in a multi-layered or recursive fashion—i.e., chaining agent-to-agent calls across multiple levels.

This feature request stems from our successful implementation of such an architecture: a remote agent is created via HostAgent(...).create_agent() and registered as an AgentTool in the main agent. The main agent can then delegate queries to the remote agent, effectively enabling a multi-stage A2A composition that had not been previously demonstrated.

This implementation also complements the ideas discussed in https://github.com/google/A2A/issues/87, https://github.com/google/A2A/issues/88, and https://github.com/google/A2A/issues/119, where various extensions of the A2A protocol are proposed. Our work provides a practical example of how these ideas can be realized in a multi-agent setting.

### Describe the solution you'd like

We would like to see official support and documentation for a pattern where a remote agent—instantiated via HostAgent(...).create_agent()—can be wrapped with AgentTool and included in the main agent’s tool list. This enables the root agent to delegate queries to the remote agent using the A2A protocol, allowing for dynamic, multi-layered agent compositions.

To make this work reliably in streaming scenarios (where tasks were not being generated as expected), we explicitly created an ADKHostManager instance and passed its task_callback to the HostAgent. This ensures proper handling of streamed outputs from the remote agent.

Here’s a simplified example:

A2A/samples/python/agents/google_adk/agent.py

```
adkHostManager = ADKHostManager()
self.client_agent = HostAgent(
["{remote_agent_url}"],
adkHostManager.task_callback,
).create_agent()

# Register as AgentTool
tools = [
agent_tool.AgentTool(agent=self.client_agent),
]
```
This approach demonstrates how recursive A2A-based delegation can be implemented. It complements and extends ideas proposed in https://github.com/google/A2A/issues/87, https://github.com/google/A2A/issues/88, and https://github.com/google/A2A/issues/119, offering a concrete path toward more robust, modular multi-agent systems.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

The issue references A2A/samples/python/agents/google_adk/agent.py as a starting point. Examine the HostAgent and ADKHostManager classes to understand how to create a remote agent and pass a task_callback. The goal is to wrap the remote agent in an AgentTool and integrate it into a main agent's tool list, enabling multi-layered delegation. Review linked issues #87, #88, and #119 for context on A2A protocol extensions.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
ai-infra-agents
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。