[Feat]: A2A client to work as a router and route request to respective agent based on prompt (we can provide multiple agent cards to A2A client)
- Dominant language
- Shell
- Stars
- 25.7k
- Forks
- 2.6k
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 16
Description
### Is your feature request related to a problem? Please describe.
Currently, when working with multiple A2A agents, developers need to build a separate router/orchestration agent to determine which agent should handle a user's request. This approach has several drawbacks:
**Additional Development Overhead:** Requires building and maintaining a dedicated routing agent with its own LLM calls, prompt engineering, and decision logic
**Performance Impact:** Adds an extra network hop and LLM inference call just for routing:
**Maintenance Burden:** The router agent needs to be updated whenever:
New agents are added
Agent capabilities change
Sample prompts evolve
### Describe the solution you'd like
Enhance the A2A Client SDK to support built-in intelligent routing by accepting multiple agent cards and automatically selecting the appropriate agent based on the user's prompt.
How It Works:
**Agent Card Metadata:** A2A client reads from each agent card:
**Smart Matching:** A2A client uses lightweight matching algorithm (keyword matching, in-memory embeddings) to score each agent card against the user prompt
**Automatic Routing**: Selects the best-match agent and forwards the request
**Fallback Mechanism:** If no clear match, return error or ask user to clarify
**Audit:** Log which agent was selected and why (routing metadata)
**Compatibility**
**Backward Compatible:** Existing single-agent usage continues to work
**Opt-in Feature:** Routing only enabled when multiple agents registered
**Graceful Degradation:** If routing fails, return error with suggestions
### Describe alternatives you've considered
- using our own embeddings to find which agent to route to.
### Additional context
_No response_
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.