to_a2a serves v0.3 JSON-RPC but its agent card has no v0.3 interface, so a2a-sdk 0.3 clients can't resolve it (missing url)
維護者通常 3 天內回覆
評估
研究方向
Start with to_a2a in google/adk/a2a/utils/agent_to_a2a.py and build_agent_card / AgentCardBuilder in google/adk/a2a/_compat.py, which decide which supportedInterfaces the card gets. Run the server and client snippets from the report and check the served /.well-known/agent-card.json. Done means a v0.3 A2ACardResolver reads the card, which requires a 0.3 interface for the RPC URL. Linked PR #8344 is already open against this, so check it before starting.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
With a2a-sdk 1.x, to_a2a turns on v0.3 compatibility for the JSON-RPC endpoint (attach_a2a_routes_to_app(..., enable_v0_3_compat=True)), but the agent card it builds lists a single interface with protocolVersion: "1.0". a2a-sdk only adds the v0.3 card fields (url, preferredTransport, protocolVersion) when the card has an interface with a legacy protocol version (agent_card_to_dict → to_compat_agent_card, which raises VersionNotSupportedError otherwise, so the fields are silently left out).
So the endpoint accepts v0.3 calls, but a v0.3 client cannot read the card and never gets to call it: a2a-sdk 0.3.x A2ACardResolver fails with Field required: url. Any A2A client still on a2a-sdk 0.3.x, including RemoteA2aAgent in ADK 1.x, cannot use an agent served by ADK 2.x.
To Reproduce
server.py, with google-adk 2.15.0 (a2a-sdk 1.3.1):
import uvicorn
from google.adk.agents import LlmAgent
from google.adk.a2a.utils.agent_to_a2a import to_a2a
agent = LlmAgent(name="hello_agent", model="gemini-2.5-flash", instruction="Say hello.")
app = to_a2a(agent, host="localhost", port=8001)
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8001)
client_v03.py, in a separate environment with a2a-sdk 0.3.26:
import asyncio
import httpx
from a2a.client import A2ACardResolver
async def main():
async with httpx.AsyncClient() as http:
# The endpoint accepts v0.3 method names:
rpc = await http.post("http://127.0.0.1:8001/", json={"jsonrpc": "2.0", "id": "1", "method": "tasks/get", "params": {"id": "missing"}})
print(rpc.json())
# but the card cannot be read by a v0.3 client:
await A2ACardResolver(http, "http://127.0.0.1:8001").get_agent_card()
asyncio.run(main())
Output:
{'jsonrpc': '2.0', 'id': '1', 'error': {'code': -32001, 'data': None, 'message': 'Task not found'}}
a2a.client.errors.A2AClientJSONError: JSON Error: Failed to validate agent card structure from http://127.0.0.1:8001/.well-known/agent-card.json: [{"type":"missing","loc":["url"],"msg":"Field required","input":{"name":"hello_agent","description":"An ADK Agent","supportedInterfaces":[{"url":"http://localhost:8001","protocolBinding":"JSONRPC","protocolVersion":"1.0"}],...}}]
The card served:
{"name": "hello_agent", "supportedInterfaces": [{"url": "http://localhost:8001", "protocolBinding": "JSONRPC", "protocolVersion": "1.0"}], ...}
Expected behavior
Since the endpoint serves v0.3, the card should advertise it too, so v0.3 clients can discover it. Adding a second interface with protocol_version="0.3" for the same URL is enough: a2a-sdk then adds the v0.3 fields and the v0.3 client resolves the card.
card = asyncio.run(AgentCardBuilder(agent=agent, rpc_url="http://localhost:8001").build())
card.supported_interfaces.append(AgentInterface(url="http://localhost:8001", protocol_binding="JSONRPC", protocol_version="0.3"))
app = to_a2a(agent, agent_card=card)
Card served then:
{"supportedInterfaces": [{"url": "http://localhost:8001", "protocolBinding": "JSONRPC", "protocolVersion": "1.0"}, {"url": "http://localhost:8001", "protocolBinding": "JSONRPC", "protocolVersion": "0.3"}], "preferredTransport": "JSONRPC", "protocolVersion": "0.3", "url": "http://localhost:8001", ...}
A possible fix: when v0.3 compatibility is enabled, have AgentCardBuilder / build_agent_card (google/adk/a2a/_compat.py) also emit a 0.3 interface for the RPC URL.
Environment
- google-adk 2.15.0, a2a-sdk 1.3.1 (server)
- a2a-sdk 0.3.26 (client)
- Python 3.14 (server), 3.12 (client), macOS
- 主要語言
- Python
- 星號
- 22.3k
- 分支
- 4.4k
- 平均合併
- 1 天 2 小時
- 30 天內合併 PR
- 6
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
google/adk-python 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
google/adk-python#8360 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
google/adk-python#8359 ·
維護者通常 3 天內回覆
-
Can pin to litellm version be changed?可能已有人在做 @llalitkumarrr 於 10 天前認領。 未關閉models
難度 1/5 1 小時以內 新手友好度 65/100
google/adk-python#8129 · 2 則留言 · 已指派 1 人 ·
維護者通常 3 天內回覆
-
OpenAPI tools ignore operation- and path-level server overrides可能已有人在做 @sanketpatil06 於 14 天前認領。 未關閉tools
難度 2/5 1-3 小時 新手友好度 75/100
google/adk-python#8064 · 4 則留言 · 已指派 1 人 ·
維護者通常 3 天內回覆
-
Two docstrings in openapi_tool document parameters the signatures do not accept可能已有人在做 @surajksharma07 於 17 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 88/100
google/adk-python#8024 · 1 則留言 · 已指派 1 人 ·
維護者通常 3 天內回覆
查看 google/adk-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
vllm-project/vllm#70030 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
TigreGotico/tugaphone#408 ·
維護者通常 1 天內回覆
-
needs-triage
難度 2/5 1-3 小時 新手友好度 74/100
gke-labs/kube-agents#7308 ·
維護者通常 1 天內回覆
-
t: bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 3 天內回覆
-
chore
難度 1/5 1-3 小時 新手友好度 88/100
lugassawan/swe-workbench#841 ·