fix(a2a): load remote agent cards before transfer prompts#6234
Open
gyx09212214-prog wants to merge 1 commit into
Open
fix(a2a): load remote agent cards before transfer prompts#6234gyx09212214-prog wants to merge 1 commit into
gyx09212214-prog wants to merge 1 commit into
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
RemoteA2aAgentcurrently resolves its agent card only when the remote agent is invoked. That means the root agent's transfer prompt can be built before the remote card description is available, creating a cold-start routing problem. If a local description is supplied, the current blank-description guard also prevents the resolved agent-card description from ever becoming the routing description.Agent-card skills and examples are also useful delegation context, but they are not surfaced in the transfer prompt before delegation.
Solution:
This PR makes the resolved agent card the source of transfer context for
RemoteA2aAgentby building the agent description from the card description plus its skills, tags, and examples. The transfer request processor now resolves transfer targets that expose_ensure_resolved()before building transfer instructions, so remote target descriptions are available before the LLM decides where to delegate.Resolution is done concurrently with
asyncio.gather()so multiple remote targets do not serialize card lookup.Duplicate check:
Before opening this PR, I searched existing PRs for:
4064 RemoteA2aAgent agent card descriptionremote agent card description skills examples_ensure_resolved agent_card descriptiongyx09212214-prog:fix-remote-a2a-agent-card-descriptionNo open or closed PR with the same #4064 fix scope was found. The related older PR #3297 is closed and unmerged; the linked commit that closed it only refactored transfer instruction building and does not resolve #4064's cold-start agent-card lookup behavior.
Testing Plan
Unit Tests:
Passed locally:
Result:
Also ran:
pre-commitpassed forruff,isort,pyink, trailing whitespace, and end-of-file hooks. I skipped the two local bash-only hooks (addlicense,check-new-py-prefix) because/bin/bashis not available in this Windows environment; no new Python files were added.No whitespace errors.
Manual End-to-End (E2E) Tests:
Not run. The regression is covered by unit tests for both direct
RemoteA2aAgentresolution and transfer-prompt construction before delegation.Checklist
Additional context
This keeps the behavior narrow to transfer metadata resolution and
RemoteA2aAgentdescription synchronization. It does not add agent-card refresh policy; resolved agents continue to use the existing_ensure_resolved()lifecycle.