Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
TP9-dev opened this issue May 16, 2025 · 2 comments

Comments

@TP9-dev
Copy link

TP9-dev commented May 16, 2025

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 #87, #88, and #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 #87, #88, and #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

  • I agree to follow this project's Code of Conduct
@robert-at-pretension-io

Very cool, I'll take a look later on.

@robert-at-pretension-io

@TP9-dev https://github.com/robert-at-pretension-io/A2A/tree/main/src/bidirectional <- that works but I'm going to re-write in python so people can use it more easily

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

No branches or pull requests

2 participants