A2aAgentExecutor sends the raw exception text to the A2A caller when the run fails
メンテナーはふだん 6 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
調査の方向性
まず a2a/executor/a2a_agent_executor.py と a2a/executor/a2a_agent_executor_impl.py にある 2 つの例外処理パスから始め、続いて同梱の ASGI 再現を実行します。失敗したタスクが、生の例外の詳細を含まない汎用メッセージまたはサーバーが選択したメッセージを返し、一方で完全な例外はサーバーログで引き続き利用可能であることを確認します。
索引モデルが issue の本文から書いたものです。
説明
🔴 Required Information
Describe the Bug:
When the agent run raises, A2aAgentExecutor.execute ends the task with a TASK_STATE_FAILED status whose message is str(e) (make_text_part(str(e)) in a2a/executor/a2a_agent_executor.py, and the same line in a2a_agent_executor_impl.py). Whatever the exception says goes to the A2A caller verbatim.
Some exceptions say a lot. LiteLLM's APIConnectionError, for one, embeds the Python traceback in its message, so the caller receives the server's file paths:
litellm.APIConnectionError: litellm.APIError: LiteLLM: provider returned a response with no 'choices'. ...
Traceback (most recent call last):
File "<server venv>/lib/python3.12/site-packages/litellm/llms/openai/openai.py", line 900, in acompletion
final_response_obj = convert_to_model_response_object(
...
When the caller is an ADK RemoteA2aAgent, that text then reaches the calling agent's event stream as a plain text part (#6708), so its end user reads it as the agent's answer. That is how we found it: a user of one of our agents got the traceback above as a reply.
The server already logs the exception with exc_info=True on the line before, so the caller does not need the detail.
Steps to Reproduce:
pip install "google-adk[a2a]==2.11.0" "a2a-sdk[http-server]==1.2.1"- Run the script below. It serves an ADK
A2aAgentExecutorin process overhttpx.ASGITransport, with a model that raises, and sends oneSendMessage. It needs no network or credentials.
repro.py
"""What an A2A caller receives when the served ADK agent's run raises."""
import asyncio
import json
import logging
import warnings
import httpx
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.routes import add_a2a_routes_to_fastapi, create_jsonrpc_routes
from a2a.server.tasks import InMemoryTaskStore
from a2a.types import AgentCapabilities, AgentCard, AgentInterface
from fastapi import FastAPI
from google.adk.a2a.executor.a2a_agent_executor import A2aAgentExecutor
from google.adk.agents import LlmAgent
from google.adk.models.base_llm import BaseLlm
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
warnings.filterwarnings("ignore")
logging.disable(logging.CRITICAL)
class FailingModel(BaseLlm): # stands in for a provider error
async def generate_content_async(self, llm_request, stream=False):
raise RuntimeError(
"provider rejected the call: Traceback (most recent call last):\n"
' File "/srv/agent/.venv/lib/python3.12/site-packages/provider/client.py", line 900'
)
yield
async def main():
card = AgentCard(
name="agent",
description="agent",
version="1",
capabilities=AgentCapabilities(streaming=True),
default_input_modes=["text/plain"],
default_output_modes=["text/plain"],
supported_interfaces=[
AgentInterface(url="http://agent.test/a2a", protocol_binding="JSONRPC")
],
)
agent = LlmAgent(name="agent", model=FailingModel(model="fake"), instruction="x")
executor = A2aAgentExecutor(
runner=Runner(
app_name="app",
agent=agent,
session_service=InMemorySessionService(),
auto_create_session=True,
)
)
app = FastAPI()
add_a2a_routes_to_fastapi(
app,
jsonrpc_routes=create_jsonrpc_routes(
DefaultRequestHandler(executor, InMemoryTaskStore(), card), rpc_url="/a2a"
),
)
async with httpx.AsyncClient(
transport=httpx.ASGITransport(app=app), base_url="http://agent.test"
) as client:
response = await client.post(
"/a2a",
headers={"A2A-Version": "1.0"},
json={
"jsonrpc": "2.0",
"id": 1,
"method": "SendMessage",
"params": {
"message": {
"messageId": "m1",
"role": "ROLE_USER",
"parts": [{"text": "hello"}],
}
},
},
)
status = response.json()["result"]["task"]["status"]
print(json.dumps(status, indent=2))
asyncio.run(main())
Expected Behavior:
The failed status carries a generic message, or one the server chooses, and the exception's details stay in the server's log. ADK already has a path for a chosen message: convert_event_to_a2a_events turns an event with error_code into a TASK_STATE_FAILED status carrying the event's error_message, or DEFAULT_ERROR_MESSAGE. Only an exception that escapes the run takes the str(e) path.
Observed Behavior:
{
"state": "TASK_STATE_FAILED",
"message": {
"messageId": "5f89d64d-db72-4846-a968-c014801f3870",
"role": "ROLE_AGENT",
"parts": [
{
"text": "provider rejected the call: Traceback (most recent call last):\n File \"/srv/agent/.venv/lib/python3.12/site-packages/provider/client.py\", line 900"
}
]
},
"timestamp": "2026-10-02T20:45:29.502125Z"
}
Environment Details:
- ADK Library Version (pip show google-adk): 2.11.0, with a2a-sdk 1.2.1. Both
make_text_part(str(e))lines are unchanged onmain. - Desktop OS: macOS
- Python Version (python -V): 3.12.12
Model Information:
- Are you using LiteLLM: Yes in production, where the exception came from. No in the reproduction, which uses a
BaseLlmthat raises. - Which model is being used: Gemini through a LiteLLM proxy in production, N/A for the reproduction.
🟡 Optional Information
Regression:
Not known.
Related:
- #6708: on the client side,
RemoteA2aAgentpasses a failed task's status message on as ordinary content. - #7248 / #7251: on the client side, a failed task never closes a task-mode delegation.
- 主要言語
- Python
- スター
- 21.6k
- フォーク
- 4k
- 平均マージ
- 9時間 59分
- マージ済み PR(30日)
- 5
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/adk-python のほかの issue
-
dependencies/vertexai.py eagerly imports the deprecated vertexai.preview.rag, so every evaluation import warns対応中かも @a2105z が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
google/adk-python#7415 · コメント 2 件 ·
メンテナーはふだん 6 日以内に返信
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cache対応中かも @jennymeshaiah09 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google/adk-python#7409 ·
メンテナーはふだん 6 日以内に返信
-
web
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
google/adk-python#7381 · 担当者 1 名 ·
メンテナーはふだん 6 日以内に返信
-
[A2A] RemoteA2aAgent(use_legacy=False): extension header written to state['http_kwargs'], ignored by a2a-sdk 1.x transports対応中かも @surajksharma07 が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
google/adk-python#7334 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 6 日以内に返信
-
RestApiTool raises uncaught KeyError when a required path param is omitted対応中かも @llalitkumarrr が 8 日前に担当しました。 オープンrequest clarification tools
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
google/adk-python#7282 · コメント 5 件 · 担当者 1 名 ·
メンテナーはふだん 6 日以内に返信
google/adk-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
FuRongJun-1999/dsh-memory#65 ·
メンテナーはふだん 1 日以内に返信
-
ci needs-ac
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Ikalus1988/MisakaNet#2930 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Qiskit/qiskit-aer#2466 ·
-
area/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100