One extra field turned an A2A error into a TypeError. Fixed in a2a-sdk 1.3.0
说明与用途
在 a2a-sdk 1.3.0 中,来自代理的错误响应现在被正确处理:额外字段不再触发 TypeError,而是映射为类型化的 A2A 异常或 A2AClientError。
问题
When an agent sent back an error, the A2A Python SDK passed the reply to a third‑party JSON‑RPC library before inspecting it, causing a TypeError when the reply contained an unexpected field.
结果
The change eliminates unexpected TypeErrors, provides consistent typed exceptions, and improves error handling for third‑party agents.
工作流
- 1. Agent sends an error response with an extra field or malformed body.
- 2. SDK receives the raw reply and checks if the body is an object, contains an error object, or a result field.
- 3. If an error object exists, the SDK maps the error code to a typed A2A exception; otherwise it raises A2AClientError.
- 4. For streaming, each event’s data is parsed and any JSONDecodeError is converted to A2AClientError.
- 5. Client code can now catch specific A2A exceptions (e.g., TaskNotFoundError) or a single A2AClientError for all other failures.
证据
When an agent sent back an error, the SDK handed the reply to a third‑party library before looking at it itself. That library is strict about which fields an error may carry, so one extra field, the kind the A2A spec says to ignore, made it throw a raw TypeError.
Version 1.3.0 reads the reply itself first, at one place, and the library only builds requests now.
The tests live in a new class, TestMalformedJsonRpcResponses, with 11 cases. Ten fail on main with the exceptions in the table and pass with the change.
- 记录日期: 2026-11-01T02:58:45.521Z