- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
Agent card skills usage #3297
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
base: main
Are you sure you want to change the base?
Agent card skills usage #3297
Conversation
| Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. | 
| Summary of ChangesHello @luis5tb, 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 enhances the root agent's ability to intelligently delegate tasks to subagents. By integrating and leveraging detailed information from subagent 'agent cards'—such as descriptions and specific skills—the system can now provide richer context to the LLM. This improvement, coupled with a re-engineered instruction prompt, aims to optimize the decision-making process for agent transfers, leading to more accurate and efficient task routing. Highlights
 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
 | 
| Response from ADK Triaging Agent Hello @luis5tb, thank you for creating this PR! To help us review your contribution, could you please address the following points from our contribution guidelines: 
 Providing this information will help us to review your PR more efficiently. Thanks! | 
There was a problem hiding this 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 enhances the agent transfer mechanism by incorporating detailed information from subagents' agent cards, including descriptions and skills. This provides richer context to the root agent for making more informed transfer decisions. The prompt for the root agent has also been significantly improved with better structure and clarity for the LLM.
My review includes two suggestions for improvement in src/google/adk/flows/llm_flows/agent_transfer.py:
- Add logging for agent card resolution failures to aid in debugging.
- Use asyncio.gatherto resolve agent cards concurrently, which can improve performance when multiple remote agents are involved.
A critical point is that the unit tests in tests/unittests/flows/llm_flows/test_agent_transfer_system_instructions.py appear to be outdated. They test the old system prompt structure and will likely fail with the new changes. It's important to update these tests to ensure the new, more complex prompt generation logic is correctly validated.
71037fe    to
    a4dfdf4      
    Compare
  
    | @luis5tb thinking about our particular needs/use cases a few things come to mind: 
 | 
| 
 This is a good point. I agree it must be handled but not as part of this PR, right? I think it is loaded the first time the root agent needs to invoke the subagents (at least it is when I see the request on the subagent) 
 Another great point! Thanks for raising! Perhaps one way to configure using or not the description/skills on the agent card is by defining or not a description when creating the RemoteA2aAgent. What do you think? Note the agent card must be read as the endpoint is being retrieved from there (as well as other details such as the security needed for instance) | 
| 
 no, not as part of this PR per se, but it's the next logical question once the ADK has this behavior (to be fair this concern also applies to the existing ADK behavior because for example a new version of the agent card could update how security is managed), so maybe "when should agent cards be refreshed/how is it controlled" is a distinct RFE that just has implications for this behavior. 
 yeah, ultimately these feel like config/parameter choices when constructing the remote agent: 
 | 
| 
 Yeah, currently (with this PR I mean) if both are provided, both are included:  | 
Problem:
The subagents agent cards information is not being used by the root agent to decide on which subagent should the request be transfered to
Solution:
This PR ensures the subagents agent cards information (description, skills) are being used as context for the root agent so that it can better decide on the subagent to transfer the request.
It also includes a bit or rewording/formatting so that information about each subagent can be better processed
Testing Plan
Unit test (test_agent_transfer_system_instructions.py) has been modified to cover the new expected context
Unit Tests:
Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.
Checklist
Additional context