a2a-sdk 1.2.2__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. a2a_sdk-1.3.0/.release-please-manifest.json +3 -0
  2. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/CHANGELOG.md +52 -0
  3. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/PKG-INFO +1 -1
  4. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/migrations/v1_0/README.md +1 -0
  5. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/card_resolver.py +8 -3
  6. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/client_factory.py +58 -24
  7. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/errors.py +8 -0
  8. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/http_helpers.py +4 -0
  9. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/jsonrpc.py +83 -64
  10. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/rest.py +26 -12
  11. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/conversions.py +4 -2
  12. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/jsonrpc_adapter.py +43 -1
  13. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/jsonrpc_transport.py +16 -2
  14. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/model_conversions.py +5 -0
  15. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/proto_utils.py +9 -3
  16. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/rest_transport.py +16 -2
  17. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/helpers/proto_helpers.py +10 -0
  18. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/active_task.py +159 -30
  19. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/active_task_registry.py +19 -4
  20. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/request_handlers/default_request_handler.py +24 -2
  21. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/request_handlers/default_request_handler_v2.py +26 -1
  22. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/request_handlers/response_helpers.py +4 -0
  23. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/agent_card_routes.py +5 -0
  24. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/jsonrpc_dispatcher.py +12 -3
  25. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/base_push_notification_sender.py +32 -7
  26. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/database_task_store.py +11 -2
  27. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/push_notification_sender.py +6 -1
  28. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/task_updater.py +8 -9
  29. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/_jcs.py +8 -3
  30. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/errors.py +8 -0
  31. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/proto_utils.py +65 -2
  32. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/push_url_validator.py +18 -9
  33. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/signing.py +16 -3
  34. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/telemetry.py +17 -2
  35. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/uv.lock +83 -49
  36. a2a_sdk-1.2.2/.release-please-manifest.json +0 -3
  37. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.agents/skills/mistake-reflection/SKILL.md +0 -0
  38. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.gemini/config.yaml +0 -0
  39. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.git-blame-ignore-revs +0 -0
  40. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/CODEOWNERS +0 -0
  41. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/ISSUE_TEMPLATE/bug-report.yml +0 -0
  42. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/ISSUE_TEMPLATE/feature-request.yml +0 -0
  43. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  44. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/actions/spelling/advice.md +0 -0
  45. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/actions/spelling/allow.txt +0 -0
  46. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/actions/spelling/excludes.txt +0 -0
  47. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/actions/spelling/line_forbidden.patterns +0 -0
  48. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/actions/spelling/patterns.txt +0 -0
  49. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/conventional-commit-lint.yaml +0 -0
  50. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/dependabot.yml +0 -0
  51. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/acts-nightly.yaml +0 -0
  52. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/acts.yaml +0 -0
  53. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/auto-assign-new-issues.yaml +0 -0
  54. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/conventional-commits.yml +0 -0
  55. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/coverage-comment.yaml +0 -0
  56. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/install-smoke.yml +0 -0
  57. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/itk.yaml +0 -0
  58. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/linter.yaml +0 -0
  59. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/nightly.yaml +0 -0
  60. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/python-publish.yml +0 -0
  61. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/release-please.yml +0 -0
  62. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/release-pr-approvals.yml +0 -0
  63. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/run-tck.yaml +0 -0
  64. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/security.yaml +0 -0
  65. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/spelling.yaml +0 -0
  66. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/stale.yaml +0 -0
  67. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.github/workflows/unit-tests.yml +0 -0
  68. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.gitignore +0 -0
  69. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.jscpd.json +0 -0
  70. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.pre-commit-config.yaml +0 -0
  71. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.python-version +0 -0
  72. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.vscode/extensions.json +0 -0
  73. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.vscode/launch.json +0 -0
  74. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/.vscode/settings.json +0 -0
  75. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/AGENTS.md +0 -0
  76. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/CODE_OF_CONDUCT.md +0 -0
  77. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/CONTRIBUTING.md +0 -0
  78. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/LICENSE +0 -0
  79. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/README.md +0 -0
  80. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/SECURITY.md +0 -0
  81. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/acts/sut-behaviors.yaml +0 -0
  82. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/buf.compat.gen.yaml +0 -0
  83. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/buf.gen.yaml +0 -0
  84. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/ai/coding_conventions.md +0 -0
  85. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/ai/evidence_rules.md +0 -0
  86. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/ai/mandatory_checks.md +0 -0
  87. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/migrations/v1_0/database/README.md +0 -0
  88. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/migrations/v1_0/database/simple_migration.md +0 -0
  89. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/docs/migrations/v1_0/database/zero_downtime.md +0 -0
  90. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/README.md +0 -0
  91. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/__init__.py +0 -0
  92. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/acts_behaviors.py +0 -0
  93. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/acts_client_parse.py +0 -0
  94. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/main.py +0 -0
  95. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/pyproject.toml +0 -0
  96. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/itk/run_itk.sh +0 -0
  97. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/pyproject.toml +0 -0
  98. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/release-please-config.json +0 -0
  99. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/README.md +0 -0
  100. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/__init__.py +0 -0
  101. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/agent_card_signing.py +0 -0
  102. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/cli.py +0 -0
  103. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/clustermode/README.md +0 -0
  104. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/clustermode/__init__.py +0 -0
  105. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/clustermode/cluster_common.py +0 -0
  106. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/clustermode/exercise.py +0 -0
  107. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/clustermode/run_cluster.py +0 -0
  108. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/clustermode/server.py +0 -0
  109. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/samples/hello_world_agent.py +0 -0
  110. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/docker-compose.test.yml +0 -0
  111. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/format.sh +0 -0
  112. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/gen_proto.sh +0 -0
  113. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/gen_proto_compat.sh +0 -0
  114. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/lint.sh +0 -0
  115. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/run_db_tests.sh +0 -0
  116. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/scripts/test_install_smoke.sh +0 -0
  117. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/__init__.py +0 -0
  118. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/_base.py +0 -0
  119. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/a2a_db_cli.py +0 -0
  120. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/alembic.ini +0 -0
  121. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/auth/__init__.py +0 -0
  122. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/auth/user.py +0 -0
  123. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/__init__.py +0 -0
  124. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/auth/__init__.py +0 -0
  125. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/auth/credentials.py +0 -0
  126. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/auth/interceptor.py +0 -0
  127. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/base_client.py +0 -0
  128. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/client.py +0 -0
  129. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/interceptors.py +0 -0
  130. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/optionals.py +0 -0
  131. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/service_parameters.py +0 -0
  132. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/__init__.py +0 -0
  133. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/base.py +0 -0
  134. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/grpc.py +0 -0
  135. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/client/transports/tenant_decorator.py +0 -0
  136. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/__init__.py +0 -0
  137. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/README.md +0 -0
  138. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/__init__.py +0 -0
  139. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/a2a_v0_3.proto +0 -0
  140. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/a2a_v0_3_pb2.py +0 -0
  141. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/a2a_v0_3_pb2.pyi +0 -0
  142. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/a2a_v0_3_pb2_grpc.py +0 -0
  143. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/buf.lock +0 -0
  144. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/buf.yaml +0 -0
  145. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/context_builders.py +0 -0
  146. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/extension_headers.py +0 -0
  147. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/grpc_handler.py +0 -0
  148. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/grpc_transport.py +0 -0
  149. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/request_handler.py +0 -0
  150. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/rest_adapter.py +0 -0
  151. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/rest_handler.py +0 -0
  152. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/types.py +0 -0
  153. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/compat/v0_3/versions.py +0 -0
  154. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/extensions/__init__.py +0 -0
  155. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/extensions/common.py +0 -0
  156. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/helpers/__init__.py +0 -0
  157. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/helpers/agent_card.py +0 -0
  158. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/README.md +0 -0
  159. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/__init__.py +0 -0
  160. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/env.py +0 -0
  161. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/migration_utils.py +0 -0
  162. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/script.py.mako +0 -0
  163. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/versions/38ce57e08137_add_column_protocol_version.py +0 -0
  164. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/versions/6419d2d130f6_add_columns_owner_last_updated.py +0 -0
  165. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/versions/__init__.py +0 -0
  166. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/migrations/versions/b5e3d1c8a2f7_add_task_version_and_task_events.py +0 -0
  167. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/py.typed +0 -0
  168. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/__init__.py +0 -0
  169. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/__init__.py +0 -0
  170. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/agent_executor.py +0 -0
  171. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/context.py +0 -0
  172. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/request_context_builder.py +0 -0
  173. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/agent_execution/simple_request_context_builder.py +0 -0
  174. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/cluster/__init__.py +0 -0
  175. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/cluster/database_event_stream.py +0 -0
  176. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/cluster/database_task_store.py +0 -0
  177. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/cluster/event_stream.py +0 -0
  178. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/cluster/task_store.py +0 -0
  179. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/cluster/version.py +0 -0
  180. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/context.py +0 -0
  181. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/events/__init__.py +0 -0
  182. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/events/event_consumer.py +0 -0
  183. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/events/event_queue.py +0 -0
  184. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/events/event_queue_v2.py +0 -0
  185. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/events/in_memory_queue_manager.py +0 -0
  186. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/events/queue_manager.py +0 -0
  187. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/id_generator.py +0 -0
  188. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/jsonrpc_models.py +0 -0
  189. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/models.py +0 -0
  190. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/owner_resolver.py +0 -0
  191. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/request_handlers/__init__.py +0 -0
  192. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/request_handlers/grpc_handler.py +0 -0
  193. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/request_handlers/request_handler.py +0 -0
  194. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/__init__.py +0 -0
  195. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/_jsonrpc_schema.py +0 -0
  196. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/_proto_schema.py +0 -0
  197. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/common.py +0 -0
  198. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/fastapi_routes.py +0 -0
  199. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/jsonrpc_routes.py +0 -0
  200. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/rest_dispatcher.py +0 -0
  201. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/routes/rest_routes.py +0 -0
  202. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/__init__.py +0 -0
  203. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/copying_task_store.py +0 -0
  204. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/database_push_notification_config_store.py +0 -0
  205. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/inmemory_push_notification_config_store.py +0 -0
  206. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/inmemory_task_store.py +0 -0
  207. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/push_notification_config_store.py +0 -0
  208. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/result_aggregator.py +0 -0
  209. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/task_manager.py +0 -0
  210. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/server/tasks/task_store.py +0 -0
  211. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/types/__init__.py +0 -0
  212. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/types/a2a_pb2.py +0 -0
  213. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/types/a2a_pb2.pyi +0 -0
  214. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/types/a2a_pb2_grpc.py +0 -0
  215. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/__init__.py +0 -0
  216. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/_async_queue_compat.py +0 -0
  217. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/constants.py +0 -0
  218. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/error_handlers.py +0 -0
  219. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/grpc_status.py +0 -0
  220. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/input_mode_validator.py +0 -0
  221. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/json_utils.py +0 -0
  222. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/task.py +0 -0
  223. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/src/a2a/utils/version_validator.py +0 -0
  224. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/tck/__init__.py +0 -0
  225. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/tck/sut_agent.py +0 -0
  226. {a2a_sdk-1.2.2 → a2a_sdk-1.3.0}/tck/sut_agent_with_vertex_task_store.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.3.0"
3
+ }
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0](https://github.com/a2aproject/a2a-python/compare/v1.2.3...v1.3.0) (2026-10-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * **server:** release parked interrupted tasks after a configurable timeout ([#1338](https://github.com/a2aproject/a2a-python/issues/1338)) ([b22a68d](https://github.com/a2aproject/a2a-python/commit/b22a68d242c32edddaa8953d0040ca82897e0b9b))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **client:** Create separate httpx per client when none configured ([#1358](https://github.com/a2aproject/a2a-python/issues/1358)) ([d316d0e](https://github.com/a2aproject/a2a-python/commit/d316d0e85e4d229df261d0cee0e9d9c0e5263207))
14
+ * **client:** raise A2A errors for malformed JSON-RPC responses ([#1375](https://github.com/a2aproject/a2a-python/issues/1375)) ([7e55413](https://github.com/a2aproject/a2a-python/commit/7e554137514b693cc952e6544a9eaf36c7d56643))
15
+ * **client:** rejections from unrecognized fields ([#1354](https://github.com/a2aproject/a2a-python/issues/1354)) ([91929cd](https://github.com/a2aproject/a2a-python/commit/91929cda989caba089584ceafa7796583f25bec4))
16
+ * **compat:** keep an unset v0.3 status message and provider as None ([#1362](https://github.com/a2aproject/a2a-python/issues/1362)) ([cdb4799](https://github.com/a2aproject/a2a-python/commit/cdb479957e81600f68f946f8ff0122667673cb35)), closes [#1361](https://github.com/a2aproject/a2a-python/issues/1361)
17
+ * **compat:** return A2A error codes from the v0.3 JSON-RPC adapter ([#1369](https://github.com/a2aproject/a2a-python/issues/1369)) ([8e32d53](https://github.com/a2aproject/a2a-python/commit/8e32d53173f8924beb7df0d3210e28a9fe9020f9))
18
+ * **compat:** set last_updated when storing a task in v0.3 format ([#1372](https://github.com/a2aproject/a2a-python/issues/1372)) ([30b6d50](https://github.com/a2aproject/a2a-python/commit/30b6d5067a9256447e3d5324163b091fc4bbad74)), closes [#1371](https://github.com/a2aproject/a2a-python/issues/1371)
19
+ * **core:** restore structured __repr__ on A2A exceptions ([#1348](https://github.com/a2aproject/a2a-python/issues/1348)) ([79a6f45](https://github.com/a2aproject/a2a-python/commit/79a6f451f49fdeaec099d723542363b5bc6dead7))
20
+ * **server:** allow recovery after status event validation fails ([#1365](https://github.com/a2aproject/a2a-python/issues/1365)) ([ca3ef0d](https://github.com/a2aproject/a2a-python/commit/ca3ef0d6c63384228db88d4984536a8189831d08))
21
+ * **server:** apply history_length to legacy streaming sends ([#1364](https://github.com/a2aproject/a2a-python/issues/1364)) ([261c074](https://github.com/a2aproject/a2a-python/commit/261c074aa4de522dfa609882666c98c5bd1a52d0))
22
+ * **server:** include legacy task states in database list filters ([#1337](https://github.com/a2aproject/a2a-python/issues/1337)) ([e12d494](https://github.com/a2aproject/a2a-python/commit/e12d494b4136351d5b5d07b5c6beae95a500fc4e))
23
+ * **server:** record executor failures through the event consumer ([#1366](https://github.com/a2aproject/a2a-python/issues/1366)) ([ad85806](https://github.com/a2aproject/a2a-python/commit/ad85806d9e43249eef5e3ad9724b0a5540cf99fb))
24
+ * **server:** reject boolean JSON-RPC request IDs ([#1350](https://github.com/a2aproject/a2a-python/issues/1350)) ([05392b3](https://github.com/a2aproject/a2a-python/commit/05392b373f70fea18349b8c66bfffb669b3b1137))
25
+ * skip malformed agent card signature headers ([#1335](https://github.com/a2aproject/a2a-python/issues/1335)) ([b21a144](https://github.com/a2aproject/a2a-python/commit/b21a1445c8e3a4dcd9edfa1d23e7e6af8382d8b7))
26
+
27
+
28
+ ### Documentation
29
+
30
+ * **helpers:** note that whole numbers in a data Part come back as floats ([#1373](https://github.com/a2aproject/a2a-python/issues/1373)) ([654774f](https://github.com/a2aproject/a2a-python/commit/654774f3d43b471e17fc2c6901998c71015ec450))
31
+
32
+
33
+ ### Miscellaneous Chores
34
+
35
+ * release 1.3.0 ([#1389](https://github.com/a2aproject/a2a-python/issues/1389)) ([fb6373f](https://github.com/a2aproject/a2a-python/commit/fb6373f2e4bad3c9e6130325dd2ba092749f8998))
36
+
37
+ ## [1.2.3](https://github.com/a2aproject/a2a-python/compare/v1.2.2...v1.2.3) (2026-10-17)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **client:** ignore the patch version when preferring a 1.0 interface ([#1304](https://github.com/a2aproject/a2a-python/issues/1304)) ([cbb2d84](https://github.com/a2aproject/a2a-python/commit/cbb2d8418df26567b4ed4ed9e160071dd04904d8))
43
+ * **client:** normalize malformed agent card parsing errors ([#1307](https://github.com/a2aproject/a2a-python/issues/1307)) ([486f0f6](https://github.com/a2aproject/a2a-python/commit/486f0f65b753077f401f2428490e26ca0eedc092))
44
+ * **compat:** block on a v0.3 gRPC and REST send without configuration ([#1334](https://github.com/a2aproject/a2a-python/issues/1334)) ([8160310](https://github.com/a2aproject/a2a-python/commit/8160310dd36e55ae33879d95692e2535e1cfdab8)), closes [#1321](https://github.com/a2aproject/a2a-python/issues/1321)
45
+ * **compat:** treat a v0.3 history_length of 0 as unlimited in JSON-RPC and REST ([#1312](https://github.com/a2aproject/a2a-python/issues/1312)) ([e86695c](https://github.com/a2aproject/a2a-python/commit/e86695cb2076874950f36f53d49771c8e09e185e))
46
+ * **jcs:** count open containers for the nesting bound, so an empty container leaf is refused ([#1294](https://github.com/a2aproject/a2a-python/issues/1294)) ([5653daf](https://github.com/a2aproject/a2a-python/commit/5653daf8315ab58c8dacc53be720c4ed632ee7ce))
47
+ * **server:** isolate push notification failures from the task lifecycle ([#1329](https://github.com/a2aproject/a2a-python/issues/1329)) ([0ee47d7](https://github.com/a2aproject/a2a-python/commit/0ee47d7baa47a706e33934a4e4c3d46bad16298f))
48
+ * **server:** mark internal lifecycle events done so a cancelled stream frees its producer ([#1336](https://github.com/a2aproject/a2a-python/issues/1336)) ([a4c4fc9](https://github.com/a2aproject/a2a-python/commit/a4c4fc91a22778f3d805e5e592bf690915a33033))
49
+ * **server:** reject push URLs in shared address space ([#1326](https://github.com/a2aproject/a2a-python/issues/1326)) ([01da00b](https://github.com/a2aproject/a2a-python/commit/01da00b0951ba6201af860d17b4c088be7902d43))
50
+ * **server:** release the ActiveTask after a direct Message response ([#1297](https://github.com/a2aproject/a2a-python/issues/1297)) ([49ebce6](https://github.com/a2aproject/a2a-python/commit/49ebce66389171dce38b74ebefb31ae4ad042e7e))
51
+ * **server:** run follow-up messages in the sender's contextvars ([#1317](https://github.com/a2aproject/a2a-python/issues/1317)) ([a016002](https://github.com/a2aproject/a2a-python/commit/a0160025d6d211b0be1762cb829e7a47c147191a))
52
+ * **server:** warn when an AgentCard is missing required fields ([#1279](https://github.com/a2aproject/a2a-python/issues/1279)) ([4f4101c](https://github.com/a2aproject/a2a-python/commit/4f4101cefd5e636a932c8017a8b3b11634be1d67))
53
+ * **telemetry:** let trace_function alone decide a span's status ([#1309](https://github.com/a2aproject/a2a-python/issues/1309)) ([59dcbfb](https://github.com/a2aproject/a2a-python/commit/59dcbfb16f73c7c596e6d60cb700ed71193c5cce))
54
+
3
55
  ## [1.2.2](https://github.com/a2aproject/a2a-python/compare/v1.2.1...v1.2.2) (2026-10-03)
4
56
 
5
57
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: a2a-sdk
3
- Version: 1.2.2
3
+ Version: 1.3.0
4
4
  Summary: A2A Python SDK
5
5
  Project-URL: homepage, https://a2a-protocol.org/
6
6
  Project-URL: repository, https://github.com/a2aproject/a2a-python
@@ -99,6 +99,7 @@ Constructing messages is simplified in v1.0. The old API required wrapping conte
99
99
  **Note**:
100
100
  * When using `File (bytes)` in v1.0, data serialization (via base64 encoding) is not required because A2A now uses Protobuf, which handles it automatically.
101
101
  * In v1.0, `Part.DataPart.data` is renamed to `Part.data` and is of type `google.protobuf.Value`. Use `ParseDict` to convert a Python dict into a suitable value. See the examples below for more details.
102
+ * `google.protobuf.Value` stores every number as a double, so whole numbers in a data Part are read back as floats on every transport (`4326` becomes `4326.0`). This is a fidelity loss, not a spec violation, since JSON does not distinguish the two. On the receiving side, narrow floats for fields you model as integers (for example with `float.is_integer()`) and leave other fields alone.
102
103
 
103
104
  **Before (v0.3):**
104
105
  ```python
@@ -20,9 +20,14 @@ logger = logging.getLogger(__name__)
20
20
 
21
21
  def parse_agent_card(agent_card_data: dict[str, Any]) -> AgentCard:
22
22
  """Parse AgentCard JSON dictionary and handle backward compatibility."""
23
- _handle_extended_card_compatibility(agent_card_data)
24
- _handle_connection_fields_compatibility(agent_card_data)
25
- _handle_security_compatibility(agent_card_data)
23
+ if not isinstance(agent_card_data, dict):
24
+ raise ParseError('Agent card must be a JSON object')
25
+ try:
26
+ _handle_extended_card_compatibility(agent_card_data)
27
+ _handle_connection_fields_compatibility(agent_card_data)
28
+ _handle_security_compatibility(agent_card_data)
29
+ except (TypeError, AttributeError) as e:
30
+ raise ParseError(f'Invalid agent card structure: {e}') from e
26
31
 
27
32
  return ParseDict(agent_card_data, AgentCard(), ignore_unknown_fields=True)
28
33
 
@@ -55,6 +55,12 @@ TransportProducer = Callable[
55
55
  ]
56
56
 
57
57
 
58
+ def major_minor(version: str) -> tuple[int, int]:
59
+ """Returns the `Major.Minor` release of a protocol version."""
60
+ v = Version(version)
61
+ return (v.major, v.minor)
62
+
63
+
58
64
  class ClientFactory:
59
65
  """Factory for creating clients that communicate with A2A agents.
60
66
 
@@ -71,6 +77,9 @@ class ClientFactory:
71
77
 
72
78
  The client can be used consistently regardless of the transport. This
73
79
  aligns the client configuration with the server's capabilities.
80
+
81
+ Each created client gets its own `httpx.AsyncClient` and closes it on
82
+ `close()`, unless `ClientConfig.httpx_client` is set.
74
83
  """
75
84
 
76
85
  def __init__(
@@ -78,16 +87,25 @@ class ClientFactory:
78
87
  config: ClientConfig | None = None,
79
88
  ):
80
89
  config = config or ClientConfig()
81
- httpx_client = config.httpx_client or httpx.AsyncClient()
82
- httpx_client.headers.setdefault(
83
- VERSION_HEADER, PROTOCOL_VERSION_CURRENT
84
- )
90
+ if config.httpx_client:
91
+ config.httpx_client.headers.setdefault(
92
+ VERSION_HEADER, PROTOCOL_VERSION_CURRENT
93
+ )
85
94
 
86
95
  self._config = config
87
- self._httpx_client = httpx_client
88
96
  self._registry: dict[str, TransportProducer] = {}
89
97
  self._register_defaults(config.supported_protocol_bindings)
90
98
 
99
+ def _resolve_http_client(self) -> tuple[httpx.AsyncClient, bool]:
100
+ """Returns an HTTP client and whether it is shared across clients."""
101
+ if self._config.httpx_client:
102
+ return self._config.httpx_client, True
103
+ httpx_client = httpx.AsyncClient()
104
+ httpx_client.headers.setdefault(
105
+ VERSION_HEADER, PROTOCOL_VERSION_CURRENT
106
+ )
107
+ return httpx_client, False
108
+
91
109
  def _register_defaults(self, supported: list[str]) -> None:
92
110
  # Empty support list implies JSON-RPC only.
93
111
 
@@ -109,21 +127,25 @@ class ClientFactory:
109
127
  else PROTOCOL_VERSION_CURRENT
110
128
  )
111
129
 
130
+ httpx_client, is_shared_httpx = self._resolve_http_client()
131
+
112
132
  if is_legacy_version(version):
113
133
  from a2a.compat.v0_3.jsonrpc_transport import ( # noqa: PLC0415
114
134
  CompatJsonRpcTransport,
115
135
  )
116
136
 
117
137
  return CompatJsonRpcTransport(
118
- self._httpx_client,
138
+ httpx_client,
119
139
  card,
120
140
  url,
141
+ is_shared_httpx=is_shared_httpx,
121
142
  )
122
143
 
123
144
  return JsonRpcTransport(
124
- self._httpx_client,
145
+ httpx_client,
125
146
  card,
126
147
  url,
148
+ is_shared_httpx=is_shared_httpx,
127
149
  )
128
150
 
129
151
  self.register(
@@ -148,21 +170,25 @@ class ClientFactory:
148
170
  else PROTOCOL_VERSION_CURRENT
149
171
  )
150
172
 
173
+ httpx_client, is_shared_httpx = self._resolve_http_client()
174
+
151
175
  if is_legacy_version(version):
152
176
  from a2a.compat.v0_3.rest_transport import ( # noqa: PLC0415
153
177
  CompatRestTransport,
154
178
  )
155
179
 
156
180
  return CompatRestTransport(
157
- self._httpx_client,
181
+ httpx_client,
158
182
  card,
159
183
  url,
184
+ is_shared_httpx=is_shared_httpx,
160
185
  )
161
186
 
162
187
  return RestTransport(
163
- self._httpx_client,
188
+ httpx_client,
164
189
  card,
165
190
  url,
191
+ is_shared_httpx=is_shared_httpx,
166
192
  )
167
193
 
168
194
  self.register(
@@ -229,10 +255,10 @@ class ClientFactory:
229
255
  if not candidates:
230
256
  return None
231
257
 
232
- # Prefer interface with version 1.0
233
- for i in candidates:
234
- if i.protocol_version == PROTOCOL_VERSION_1_0:
235
- return i
258
+ # Prefer interface with version 1.0. Patch versions must not affect
259
+ # negotiation, so '1.0.0' counts as '1.0'.
260
+ v1_0 = major_minor(PROTOCOL_VERSION_1_0)
261
+ v0_3 = major_minor(PROTOCOL_VERSION_0_3)
236
262
 
237
263
  best_gt_1_0 = None
238
264
  best_ge_0_3 = None
@@ -245,10 +271,12 @@ class ClientFactory:
245
271
  continue
246
272
 
247
273
  try:
248
- v = Version(i.protocol_version)
249
- if best_gt_1_0 is None and v > Version(PROTOCOL_VERSION_1_0):
274
+ v = major_minor(i.protocol_version)
275
+ if v == v1_0:
276
+ return i
277
+ if best_gt_1_0 is None and v > v1_0:
250
278
  best_gt_1_0 = i
251
- if best_ge_0_3 is None and v >= Version(PROTOCOL_VERSION_0_3):
279
+ if best_ge_0_3 is None and v >= v0_3:
252
280
  best_ge_0_3 = i
253
281
  except InvalidVersion:
254
282
  pass
@@ -265,8 +293,9 @@ class ClientFactory:
265
293
  ) -> Client:
266
294
  """Create a `Client` by resolving an `AgentCard` from a URL.
267
295
 
268
- Resolves the agent card from the given URL using the factory's
269
- configured httpx client, then creates a client via `create`.
296
+ Resolves the agent card from the given URL, then creates a client
297
+ via `create`. The card is fetched with `ClientConfig.httpx_client`
298
+ when one is set, otherwise with a temporary client.
270
299
 
271
300
  If the agent card is already available, use `create` directly
272
301
  instead.
@@ -287,12 +316,17 @@ class ClientFactory:
287
316
  Returns:
288
317
  A `Client` object.
289
318
  """
290
- resolver = A2ACardResolver(self._httpx_client, url)
291
- card = await resolver.get_agent_card(
292
- relative_card_path=relative_card_path,
293
- http_kwargs=resolver_http_kwargs,
294
- signature_verifier=signature_verifier,
295
- )
319
+ httpx_client, is_shared_httpx = self._resolve_http_client()
320
+ try:
321
+ resolver = A2ACardResolver(httpx_client, url)
322
+ card = await resolver.get_agent_card(
323
+ relative_card_path=relative_card_path,
324
+ http_kwargs=resolver_http_kwargs,
325
+ signature_verifier=signature_verifier,
326
+ )
327
+ finally:
328
+ if not is_shared_httpx:
329
+ await httpx_client.aclose()
296
330
  return self.create(card, interceptors)
297
331
 
298
332
  def register(self, label: str, generator: TransportProducer) -> None:
@@ -14,6 +14,14 @@ class AgentCardResolutionError(A2AClientError):
14
14
  super().__init__(message)
15
15
  self.status_code = status_code
16
16
 
17
+ def __repr__(self) -> str:
18
+ """Return a developer-friendly representation exposing the status code."""
19
+ return (
20
+ f'{self.__class__.__name__}('
21
+ f'status_code={self.status_code!r}, '
22
+ f'message={self.message!r})'
23
+ )
24
+
17
25
 
18
26
  class A2AClientTimeoutError(A2AClientError):
19
27
  """Exception for timeout errors during a request."""
@@ -57,6 +57,8 @@ async def send_http_request(
57
57
  | None = None,
58
58
  ) -> dict[str, Any]:
59
59
  """Sends an HTTP request and parses the JSON response, handling common exceptions."""
60
+ if httpx_client.is_closed:
61
+ raise A2AClientError('HTTP client is closed')
60
62
  with handle_http_exceptions(status_error_handler):
61
63
  response = await httpx_client.send(request)
62
64
  response.raise_for_status()
@@ -125,6 +127,8 @@ async def send_http_stream_request(
125
127
  Should raise an appropriate domain-specific exception.
126
128
  **kwargs: Additional keyword arguments forwarded to ``aconnect_sse``.
127
129
  """
130
+ if httpx_client.is_closed:
131
+ raise A2AClientError('HTTP client is closed')
128
132
  with handle_http_exceptions(status_error_handler):
129
133
  async with _SSEEventSource(
130
134
  httpx_client, method, url, **kwargs
@@ -1,3 +1,4 @@
1
+ import json
1
2
  import logging
2
3
 
3
4
  from collections.abc import AsyncGenerator
@@ -7,7 +8,7 @@ from uuid import uuid4
7
8
  import httpx
8
9
 
9
10
  from google.protobuf import json_format
10
- from jsonrpc.jsonrpc2 import JSONRPC20Request, JSONRPC20Response
11
+ from jsonrpc.jsonrpc2 import JSONRPC20Request
11
12
 
12
13
  from a2a.client.client import ClientCallContext
13
14
  from a2a.client.errors import A2AClientError
@@ -36,6 +37,7 @@ from a2a.types.a2a_pb2 import (
36
37
  TaskPushNotificationConfig,
37
38
  )
38
39
  from a2a.utils.errors import JSON_RPC_ERROR_CODE_MAP
40
+ from a2a.utils.proto_utils import parse_lenient
39
41
  from a2a.utils.telemetry import SpanKind, trace_class
40
42
 
41
43
 
@@ -56,11 +58,13 @@ class JsonRpcTransport(ClientTransport):
56
58
  httpx_client: httpx.AsyncClient,
57
59
  agent_card: AgentCard,
58
60
  url: str,
61
+ is_shared_httpx: bool = False,
59
62
  ):
60
63
  """Initializes the JsonRpcTransport."""
61
64
  self.url = url
62
65
  self.httpx_client = httpx_client
63
66
  self.agent_card = agent_card
67
+ self.is_shared_httpx = is_shared_httpx
64
68
 
65
69
  async def send_message(
66
70
  self,
@@ -77,11 +81,8 @@ class JsonRpcTransport(ClientTransport):
77
81
  response_data = await self._send_request(
78
82
  dict(rpc_request.data), context
79
83
  )
80
- json_rpc_response = JSONRPC20Response(**response_data)
81
- if json_rpc_response.error:
82
- raise self._create_jsonrpc_error(json_rpc_response.error)
83
- response: SendMessageResponse = json_format.ParseDict(
84
- json_rpc_response.result, SendMessageResponse()
84
+ response: SendMessageResponse = parse_lenient(
85
+ response_data['result'], SendMessageResponse()
85
86
  )
86
87
  return response
87
88
 
@@ -118,10 +119,7 @@ class JsonRpcTransport(ClientTransport):
118
119
  response_data = await self._send_request(
119
120
  dict(rpc_request.data), context
120
121
  )
121
- json_rpc_response = JSONRPC20Response(**response_data)
122
- if json_rpc_response.error:
123
- raise self._create_jsonrpc_error(json_rpc_response.error)
124
- response: Task = json_format.ParseDict(json_rpc_response.result, Task())
122
+ response: Task = parse_lenient(response_data['result'], Task())
125
123
  return response
126
124
 
127
125
  async def list_tasks(
@@ -139,11 +137,8 @@ class JsonRpcTransport(ClientTransport):
139
137
  response_data = await self._send_request(
140
138
  dict(rpc_request.data), context
141
139
  )
142
- json_rpc_response = JSONRPC20Response(**response_data)
143
- if json_rpc_response.error:
144
- raise self._create_jsonrpc_error(json_rpc_response.error)
145
- response: ListTasksResponse = json_format.ParseDict(
146
- json_rpc_response.result, ListTasksResponse()
140
+ response: ListTasksResponse = parse_lenient(
141
+ response_data['result'], ListTasksResponse()
147
142
  )
148
143
  return response
149
144
 
@@ -162,10 +157,7 @@ class JsonRpcTransport(ClientTransport):
162
157
  response_data = await self._send_request(
163
158
  dict(rpc_request.data), context
164
159
  )
165
- json_rpc_response = JSONRPC20Response(**response_data)
166
- if json_rpc_response.error:
167
- raise self._create_jsonrpc_error(json_rpc_response.error)
168
- response: Task = json_format.ParseDict(json_rpc_response.result, Task())
160
+ response: Task = parse_lenient(response_data['result'], Task())
169
161
  return response
170
162
 
171
163
  async def create_task_push_notification_config(
@@ -183,11 +175,8 @@ class JsonRpcTransport(ClientTransport):
183
175
  response_data = await self._send_request(
184
176
  dict(rpc_request.data), context
185
177
  )
186
- json_rpc_response = JSONRPC20Response(**response_data)
187
- if json_rpc_response.error:
188
- raise self._create_jsonrpc_error(json_rpc_response.error)
189
- response: TaskPushNotificationConfig = json_format.ParseDict(
190
- json_rpc_response.result, TaskPushNotificationConfig()
178
+ response: TaskPushNotificationConfig = parse_lenient(
179
+ response_data['result'], TaskPushNotificationConfig()
191
180
  )
192
181
  return response
193
182
 
@@ -206,11 +195,8 @@ class JsonRpcTransport(ClientTransport):
206
195
  response_data = await self._send_request(
207
196
  dict(rpc_request.data), context
208
197
  )
209
- json_rpc_response = JSONRPC20Response(**response_data)
210
- if json_rpc_response.error:
211
- raise self._create_jsonrpc_error(json_rpc_response.error)
212
- response: TaskPushNotificationConfig = json_format.ParseDict(
213
- json_rpc_response.result, TaskPushNotificationConfig()
198
+ response: TaskPushNotificationConfig = parse_lenient(
199
+ response_data['result'], TaskPushNotificationConfig()
214
200
  )
215
201
  return response
216
202
 
@@ -229,14 +215,8 @@ class JsonRpcTransport(ClientTransport):
229
215
  response_data = await self._send_request(
230
216
  dict(rpc_request.data), context
231
217
  )
232
- json_rpc_response = JSONRPC20Response(**response_data)
233
- if json_rpc_response.error:
234
- raise self._create_jsonrpc_error(json_rpc_response.error)
235
- response: ListTaskPushNotificationConfigsResponse = (
236
- json_format.ParseDict(
237
- json_rpc_response.result,
238
- ListTaskPushNotificationConfigsResponse(),
239
- )
218
+ response: ListTaskPushNotificationConfigsResponse = parse_lenient(
219
+ response_data['result'], ListTaskPushNotificationConfigsResponse()
240
220
  )
241
221
  return response
242
222
 
@@ -252,12 +232,7 @@ class JsonRpcTransport(ClientTransport):
252
232
  params=json_format.MessageToDict(request),
253
233
  _id=str(uuid4()),
254
234
  )
255
- response_data = await self._send_request(
256
- dict(rpc_request.data), context
257
- )
258
- json_rpc_response = JSONRPC20Response(**response_data)
259
- if json_rpc_response.error:
260
- raise self._create_jsonrpc_error(json_rpc_response.error)
235
+ await self._send_request(dict(rpc_request.data), context)
261
236
 
262
237
  async def subscribe(
263
238
  self,
@@ -297,23 +272,28 @@ class JsonRpcTransport(ClientTransport):
297
272
  dict(rpc_request.data),
298
273
  context,
299
274
  )
300
- json_rpc_response = JSONRPC20Response(**response_data)
301
- if json_rpc_response.error:
302
- raise self._create_jsonrpc_error(json_rpc_response.error)
275
+ result = response_data['result']
303
276
  # Validate type of the response
304
- if not isinstance(json_rpc_response.result, dict):
305
- raise A2AClientError(
306
- f'Invalid response type: {type(json_rpc_response.result)}'
307
- )
308
- response: AgentCard = json_format.ParseDict(
309
- json_rpc_response.result, AgentCard()
310
- )
277
+ if not isinstance(result, dict):
278
+ raise A2AClientError(f'Invalid response type: {type(result)}')
279
+ response: AgentCard = parse_lenient(result, AgentCard())
311
280
 
312
281
  return response
313
282
 
314
283
  async def close(self) -> None:
315
- """Closes the httpx client."""
316
- await self.httpx_client.aclose()
284
+ """Closes the httpx client unless it is shared."""
285
+ if self.is_shared_httpx:
286
+ logger.debug(
287
+ 'Cannot close a shared httpx client; only the provider '
288
+ 'that supplied it via ClientConfig.httpx_client can close it.'
289
+ )
290
+ return
291
+ if self.httpx_client.is_closed:
292
+ raise A2AClientError('HTTP client is already closed')
293
+ try:
294
+ await self.httpx_client.aclose()
295
+ except Exception as e:
296
+ raise A2AClientError(f'Failed to close HTTP client: {e}') from e
317
297
 
318
298
  def _create_jsonrpc_error(self, error_dict: dict[str, Any]) -> Exception:
319
299
  """Creates the appropriate A2AError from a JSON-RPC error dictionary."""
@@ -346,7 +326,37 @@ class JsonRpcTransport(ClientTransport):
346
326
  request = self.httpx_client.build_request(
347
327
  'POST', self.url, json=payload, **(http_kwargs or {})
348
328
  )
349
- return await send_http_request(self.httpx_client, request)
329
+ response_data = await send_http_request(self.httpx_client, request)
330
+ return self._check_jsonrpc_response(response_data)
331
+
332
+ def _check_jsonrpc_response(self, response_data: Any) -> dict[str, Any]:
333
+ """Returns a JSON-RPC success response, raising for anything else.
334
+
335
+ An error response raises the A2A error mapped from its code, even when
336
+ the error object lacks a ``message`` or carries extra members. A body
337
+ that is not a JSON-RPC 2.0 response object (a list, a string, an object
338
+ with neither ``result`` nor ``error``, or an ``error`` that is not an
339
+ object) raises ``A2AClientError`` instead of leaking a ``TypeError`` or
340
+ ``ValueError`` from the ``json-rpc`` package.
341
+ """
342
+ if not isinstance(response_data, dict):
343
+ raise A2AClientError(
344
+ 'Invalid JSON-RPC response: expected an object, got '
345
+ f'{type(response_data).__name__}'
346
+ )
347
+ error = response_data.get('error')
348
+ if error:
349
+ if not isinstance(error, dict):
350
+ raise A2AClientError(
351
+ f'Invalid JSON-RPC response: error is not an object: '
352
+ f'{error!r}'
353
+ )
354
+ raise self._create_jsonrpc_error(error)
355
+ if 'result' not in response_data:
356
+ raise A2AClientError(
357
+ "Invalid JSON-RPC response: it has neither 'result' nor 'error'"
358
+ )
359
+ return response_data
350
360
 
351
361
  async def _send_stream_request(
352
362
  self,
@@ -364,17 +374,26 @@ class JsonRpcTransport(ClientTransport):
364
374
  json=rpc_request_payload,
365
375
  **http_kwargs,
366
376
  ):
367
- json_rpc_response = JSONRPC20Response.from_json(sse_data)
368
- if json_rpc_response.error:
369
- raise self._create_jsonrpc_error(json_rpc_response.error)
370
- response: StreamResponse = json_format.ParseDict(
371
- json_rpc_response.result, StreamResponse()
377
+ try:
378
+ response_data = json.loads(sse_data)
379
+ except json.JSONDecodeError as e:
380
+ raise A2AClientError(
381
+ f'Invalid JSON-RPC response in SSE stream: {e}'
382
+ ) from e
383
+ response_data = self._check_jsonrpc_response(response_data)
384
+ response: StreamResponse = parse_lenient(
385
+ response_data['result'], StreamResponse()
372
386
  )
373
387
  yield response
374
388
 
375
389
  def _handle_sse_error(self, sse_data: str) -> NoReturn:
376
390
  """Handles SSE error events by parsing JSON-RPC error payload and raising the appropriate domain error."""
377
- json_rpc_response = JSONRPC20Response.from_json(sse_data)
378
- if json_rpc_response.error:
379
- raise self._create_jsonrpc_error(json_rpc_response.error)
391
+ try:
392
+ response_data = json.loads(sse_data)
393
+ except json.JSONDecodeError:
394
+ response_data = None
395
+ if isinstance(response_data, dict) and isinstance(
396
+ response_data.get('error'), dict
397
+ ):
398
+ raise self._create_jsonrpc_error(response_data['error'])
380
399
  raise A2AClientError(f'SSE stream error: {sse_data}')