Skip to content

chore: merge proto refactor into 1.0-dev#697

Merged
ishymko merged 3 commits into1.0-devfrom
ishymko/1.0-a2a_proto_refactor
Feb 17, 2026
Merged

chore: merge proto refactor into 1.0-dev#697
ishymko merged 3 commits into1.0-devfrom
ishymko/1.0-a2a_proto_refactor

Conversation

@ishymko
Copy link
Member

@ishymko ishymko commented Feb 17, 2026

Merge proto refactor into 1.0-dev.

This will apply changes from #572 and #665 on top of 1.0-dev previously synchronized with main.

See #696 for the diff from 1.0-dev applied on top of proto refactor.

Re #559

FYI

I am going to review it further, current goal was to resolve merge conflicts and have tests passing, I will dive into the actual changes and will review Gemini comments from this PR.

muscariello and others added 2 commits January 24, 2026 11:30
## Summary

This PR migrates the a2a-python SDK from Pydantic-based types to
protobuf-generated types, completing the upgrade to A2A v1.0. Fixes #559

## Breaking Changes

- Replace Pydantic-based type system with protobuf types from `a2a_pb2`
- Update `Part` usage from `Part(root=TextPart(text=...))` to
`Part(text=...)`
- Update `Role` enum from `Role.user`/`Role.agent` to
`Role.ROLE_USER`/`Role.ROLE_AGENT`
- Update `TaskState` enum to use `TASK_STATE_*` prefix

## Changes

- Update all source files to use proto types directly from `a2a_pb2`
- Replace `model_dump()` with `MessageToDict()` for JSON serialization
- Replace `model_copy(deep=True)` with `CopyFrom()` for proto cloning
- Add new types module with proto imports and SDK-specific extras
- Add `proto_utils` module with identity conversion utilities
- Fix REST handler resource name formats for push notification configs
- Fix gRPC handler to use `SubscribeToTask` instead of
`TaskSubscription`
- Fix database task store to handle proto objects from ORM
- Update all test files for proto patterns and assertions
- Fix spelling check failures by updating allow list
- Fix inclusive language check failures:
    - Replace `master` with `main` in documentation
    - Rename `Dummy` classes to `Mock` in tests

## Testing

- **601 tests passing**
- 23 tests skipped (expected - require DB connections or cryptography
deps)

## Related

Builds on top of PR #556

Release-As: 1.0.0

---------

Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
Co-authored-by: Lukasz Kawka <luk.kawka@gmail.com>
Co-authored-by: Agent2Agent (A2A) Bot <a2a-bot@google.com>
Co-authored-by: Didier Durand <2927957+didier-durand@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Iva Sokolaj <102302011+sokoliva@users.noreply.github.com>
Co-authored-by: Will Chen <36873565+chenweiyang0204@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## Description
Updates the SDK to support the A2A Protocol v1.0.0-rc specifications.

## Changes
- **Protocol Update**: Updated core types, definitions, `Client`, and
`Server` implementations to match Protocol v1.0.0-rc.
- **Bug Fixes**:
    - Fixed `RestTransport` URL construction.
- Resolved `pyright`, `ruff`, and `mypy` linting errors across the
codebase.
- Fixed import resolution issues for optional dependencies (`grpc`,
`sqlalchemy`, `opentelemetry`).
- **Tests**:
    - Fixed all failing unit and integration tests.
- Added support for running PostgreSQL and MySQL integration tests
(verified locally).
- **Cleanup**: Removed redundant `pyrightconfig.json`.

## Testing
- All unit and integration tests are passing.
- Database integration tests verified locally with Docker containers
(docker-compose file was used for verification but is not included in
the repo).

Re #559

---------

Signed-off-by: Luca Muscariello <muscariello@ieee.org>
@ishymko ishymko force-pushed the ishymko/1.0-a2a_proto_refactor branch from 03ba6d9 to 7f51011 Compare February 17, 2026 16:06
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ishymko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a foundational refactor by transitioning the A2A SDK's internal data models from Pydantic to native Protobuf messages. This change streamlines data serialization and deserialization across client and server components, standardizes the API definitions, and modernizes the code generation pipeline. The update affects nearly all layers of the SDK, from core type definitions and client-server communication to build processes and dependency management, aiming for improved performance and consistency with gRPC standards.

Highlights

  • Protobuf Migration: The core A2A types have been migrated from Pydantic models to native Protobuf messages, significantly impacting client and server data handling and serialization.
  • Code Generation Workflow: The type generation workflow has been overhauled, removing datamodel-code-generator and introducing buf for Protobuf and OpenAPI spec generation, managed by a new gen_proto.sh script and Hatch build hooks.
  • Client API Updates: Client interfaces have been updated to reflect the new Protobuf types, including changes to method signatures (e.g., send_message, get_task), renamed methods (resubscribe to subscribe, get_card to get_extended_agent_card), and adapted internal logic for handling streaming and non-streaming responses.
  • Server API Updates: Server-side request handlers and application logic have been refactored to directly consume and produce Protobuf messages, replacing Pydantic model validation and serialization with Protobuf's ParseDict and MessageToDict.
  • Legacy Client Removal: Deprecated legacy client interfaces (A2AClient, A2AGrpcClient) and their associated files have been removed, streamlining the client codebase.
  • Build System and Dependencies: The pyproject.toml has been updated to include new dependencies like json-rpc and googleapis-common-protos, configure hatch-build-scripts for proto generation, and adjust mypy and coverage exclusions for the new src/a2a/types directory.
Changelog
  • .git-blame-ignore-revs
    • Updated V8 Git blame ignore revisions template URL from 'master' to 'main'.
  • .github/actions/spelling/allow.txt
    • Added numerous words related to protobuf, security (JOSE, JWT), FastAPI, and Starlette to the spelling allow list.
  • .github/actions/spelling/excludes.txt
    • Added src/a2a/types/ and a2a.json to the spelling exclusion list to ignore generated files.
  • .gitignore
    • Added src/a2a/types/a2a.json and docker-compose.yaml to the ignore list.
  • .pre-commit-config.yaml
    • Removed the entire pre-commit configuration file.
  • CODE_OF_CONDUCT.md
    • Updated the Google New Project repository URL from 'master' to 'main'.
  • buf.gen.yaml
    • Updated the subdir for the A2A specification from specification/grpc to specification.
    • Changed the output directory for Python protobuf generation from src/a2a/grpc to src/a2a/types.
    • Added the openapiv2 plugin to generate a2a.swagger.json.
  • pyproject.toml
    • Added json-rpc and googleapis-common-protos to project dependencies.
    • Added hatch-build-scripts to build system requirements.
    • Configured hatch-build-scripts to run scripts/gen_proto.sh and include src/a2a/types/a2a.json as a build artifact.
    • Removed datamodel-code-generator from dev dependencies.
    • Added PyJWT to dev dependencies.
    • Updated mypy and coverage exclusions to target src/a2a/types instead of src/a2a/grpc.
    • Added filterwarnings for SQLAlchemy and asyncio resource warnings in pytest configuration.
  • scripts/checkout_experimental_types.sh
    • Removed the script for checking out experimental types.
  • scripts/gen_proto.sh
    • Added a new script to generate protobuf code and OpenAPI spec using buf.
    • Included logic to rename generated a2a.swagger.json to a2a.json.
    • Added a step to fix imports in a2a_pb2_grpc.py.
  • scripts/generate_types.sh
    • Removed the script for generating types using datamodel-code-generator.
  • scripts/grpc_gen_post_processor.py
    • Removed the gRPC generation post-processor script.
  • src/a2a/client/init.py
    • Removed imports and __all__ entries for A2AClient and A2AGrpcClient.
  • src/a2a/client/auth/interceptor.py
    • Updated imports for AgentCard and security schemes to a2a.types.a2a_pb2.
    • Adapted authentication logic to use Protobuf message fields and methods like HasField.
  • src/a2a/client/base_client.py
    • Updated type hints for request and response objects to Protobuf messages (e.g., ListTasksRequest, StreamResponse).
    • Refactored send_message to handle StreamResponse and SendMessageConfiguration.
    • Renamed resubscribe method to subscribe.
    • Renamed get_card method to get_extended_agent_card.
  • src/a2a/client/card_resolver.py
    • Replaced pydantic.ValidationError with google.protobuf.json_format.ParseError for agent card validation.
    • Updated AgentCard.model_validate to ParseDict for deserialization.
  • src/a2a/client/client.py
    • Updated type hints for various request and response objects to Protobuf messages.
    • Changed supported_transports to supported_protocol_bindings in ClientConfig.
    • Updated ClientEvent type definition.
    • Renamed resubscribe to subscribe and get_card to get_extended_agent_card.
  • src/a2a/client/client_factory.py
    • Updated _register_defaults to use string constants for transport protocols.
    • Adapted transport selection logic to use AgentCard.supported_interfaces.
  • src/a2a/client/client_task_manager.py
    • Updated imports to a2a.types.a2a_pb2.
    • Renamed save_task_event to process and adapted its logic to handle StreamResponse and Protobuf message fields.
    • Updated update_with_message to use Protobuf message methods for history and status message handling.
  • src/a2a/client/errors.py
    • Removed import of JSONRPCErrorResponse.
    • Simplified A2AClientJSONRPCError to directly accept a dictionary for error details.
  • src/a2a/client/helpers.py
    • Updated imports to a2a.types.a2a_pb2.
    • Modified create_text_message_object to directly use Part(text=content) and Role.ROLE_USER.
  • src/a2a/client/legacy.py
    • Removed the deprecated A2AClient legacy client compatibility layer.
  • src/a2a/client/legacy_grpc.py
    • Removed the deprecated A2AGrpcClient legacy gRPC client compatibility layer.
  • src/a2a/client/middleware.py
    • Updated import for AgentCard to a2a.types.a2a_pb2.
  • src/a2a/client/optionals.py
    • Updated grpc.aio import type hint ignore from reportAssignmentType to reportMissingModuleSource.
    • Changed comment from 'Dummy class' to 'Stub class'.
  • src/a2a/client/transports/base.py
    • Updated type hints for request and response objects to Protobuf messages.
    • Renamed resubscribe to subscribe and get_card to get_extended_agent_card.
  • src/a2a/client/transports/grpc.py
    • Updated grpc import to ignore reportMissingModuleSource.
    • Changed imports from a2a.grpc to a2a.types.
    • Removed proto_utils conversions, now directly uses Protobuf messages for all method calls and responses.
    • Updated _needs_extended_card check to use agent_card.capabilities.extended_agent_card.
  • src/a2a/client/transports/jsonrpc.py
    • Imported MessageToDict, ParseDict from google.protobuf.json_format and JSONRPC20Request, JSONRPC20Response from jsonrpc.jsonrpc2.
    • Updated url initialization to use agent_card.supported_interfaces.
    • Adapted send_message, send_message_streaming, get_task, list_tasks, cancel_task, set_task_callback, get_task_callback, subscribe, and get_extended_agent_card to use Protobuf messages and jsonrpc.jsonrpc2 objects for request/response handling.
    • Updated _model_to_query_params to use MessageToDict.
  • src/a2a/client/transports/rest.py
    • Imported Message from google.protobuf.message.
    • Updated imports to a2a.types.a2a_pb2.
    • Removed proto_utils conversions, now directly uses Protobuf messages for all method calls and responses.
    • Updated url initialization to iterate through agent_card.supported_interfaces.
    • Updated _model_to_query_params to use MessageToDict.
  • src/a2a/extensions/common.py
    • Updated imports for AgentCard and AgentExtension to a2a.types.a2a_pb2.
  • src/a2a/grpc/a2a_pb2.py
    • Removed the old proto-generated Python file.
  • src/a2a/server/agent_execution/agent_executor.py
    • Updated TaskState.canceled to TaskState.TASK_STATE_CANCELED for consistency with Protobuf enum.
  • src/a2a/server/agent_execution/context.py
    • Updated imports to a2a.types.a2a_pb2.
    • Imported InvalidParamsError from a2a.utils.errors.
    • Changed type hints for request and configuration to Protobuf messages.
    • Adapted metadata property to handle Protobuf Struct directly.
  • src/a2a/server/agent_execution/request_context_builder.py
    • Updated imports to a2a.types.a2a_pb2.
  • src/a2a/server/agent_execution/simple_request_context_builder.py
    • Updated imports to a2a.types.a2a_pb2.
  • src/a2a/server/apps/jsonrpc/fastapi_app.py
    • Imported importlib.resources and json.
    • Removed Pydantic schema generation for A2ARequest and added logic to load a2a.json from a2a.types.
    • Updated agent_card.supports_authenticated_extended_card to agent_card.capabilities.extended_agent_card.
  • src/a2a/server/apps/jsonrpc/jsonrpc_app.py
    • Added jsonrpc_models.py imports for JSON-RPC error definitions.
    • Updated METHOD_TO_MODEL to map directly to Protobuf message types.
    • Refactored error handling to use build_error_response and JSONRPC20Request/JSONRPC20Response.
    • Adapted _process_streaming_request and _process_non_streaming_request to work with Protobuf messages.
  • src/a2a/server/apps/jsonrpc/starlette_app.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated agent_card.supports_authenticated_extended_card to agent_card.capabilities.extended_agent_card.
  • src/a2a/server/apps/rest/fastapi_app.py
    • Updated imports to a2a.types.a2a_pb2.
  • src/a2a/server/apps/rest/rest_adapter.py
    • Imported MessageToDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Updated agent_card.supports_authenticated_extended_card to agent_card.capabilities.extended_agent_card.
    • Updated handle_get_agent_card and handle_authenticated_agent_card to use MessageToDict.
    • Renamed on_resubscribe_to_task to on_subscribe_to_task.
  • src/a2a/server/events/event_consumer.py
    • Updated imports to a2a.types.a2a_pb2.
    • Imported InternalError from a2a.utils.errors.
    • Updated is_final_event logic to use Protobuf TaskState enum values.
  • src/a2a/server/events/event_queue.py
    • Updated imports to a2a.types.a2a_pb2.
  • src/a2a/server/jsonrpc_models.py
    • Added a new file defining Pydantic models for JSON-RPC 2.0 errors, replacing previous inline definitions.
  • src/a2a/server/models.py
    • Imported MessageToDict, ParseDict, ProtoMessage.
    • Modified PydanticType and PydanticListType to handle Protobuf message serialization and deserialization.
    • Updated _to_orm and _from_orm methods to work with Protobuf Task objects.
  • src/a2a/server/request_handlers/default_request_handler.py
    • Updated imports to a2a.types.a2a_pb2.
    • Imported specific error types from a2a.utils.errors.
    • Updated TERMINAL_TASK_STATES to use Protobuf TaskState enum values.
    • Changed type hints for request parameters to Protobuf messages.
    • Adapted on_list_tasks to handle Protobuf Task and ListTasksResponse.
    • Renamed on_set_task_push_notification_config to on_create_task_push_notification_config.
    • Renamed on_resubscribe_to_task to on_subscribe_to_task.
  • src/a2a/server/request_handlers/grpc_handler.py
    • Updated grpc imports to ignore reportMissingModuleSource.
    • Changed imports from a2a.grpc to a2a.types.
    • Imported JSONParseError from a2a.server.jsonrpc_models.
    • Removed proto_utils conversions for most methods, directly using Protobuf messages.
    • Renamed TaskSubscription to SubscribeToTask and GetAgentCard to GetExtendedAgentCard.
  • src/a2a/server/request_handlers/jsonrpc_handler.py
    • Imported MessageToDict, JSONRPC20Response.
    • Imported JSON-RPC error models from a2a.server.jsonrpc_models.
    • Updated EXCEPTION_MAP and ERROR_CODE_MAP for new error types.
    • Adapted _build_success_response and _build_error_response to use jsonrpc.jsonrpc2 and MessageToDict.
    • Changed type hints for request parameters to Protobuf messages.
    • Renamed on_set_task_push_notification_config to on_create_task_push_notification_config.
    • Renamed on_resubscribe_to_task to on_subscribe_to_task.
  • src/a2a/server/request_handlers/request_handler.py
    • Updated imports to a2a.types.a2a_pb2.
    • Changed type hints for request parameters and return types to Protobuf messages.
    • Renamed on_set_task_push_notification_config to on_create_task_push_notification_config.
    • Renamed on_resubscribe_to_task to on_subscribe_to_task.
  • src/a2a/server/request_handlers/response_helpers.py
    • Removed Pydantic RootModel types.
    • Now directly uses MessageToDict and JSONRPC20Response for building responses.
    • Updated EventTypes and build_error_response to work with Protobuf messages and jsonrpc.jsonrpc2 error models.
  • src/a2a/server/request_handlers/rest_handler.py
    • Imported ParseDict, Message from google.protobuf.message.
    • Updated imports to a2a.types.a2a_pb2.
    • Removed proto_utils usage, directly uses Protobuf messages.
    • Renamed on_resubscribe_to_task to on_subscribe_to_task.
  • src/a2a/server/tasks/base_push_notification_sender.py
    • Imported MessageToDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted _dispatch_notification to send StreamResponse(task=task) as JSON.
  • src/a2a/server/tasks/database_push_notification_config_store.py
    • Imported MessageToJson, Parse.
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted _to_orm and _from_orm to handle Protobuf PushNotificationConfig.
  • src/a2a/server/tasks/database_task_store.py
    • Imported MessageToDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted _to_orm and _from_orm to handle Protobuf Task objects.
    • Updated list method to handle Protobuf ListTasksRequest and ListTasksResponse.
  • src/a2a/server/tasks/inmemory_push_notification_config_store.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted set_info to check notification_config.id for truthiness.
  • src/a2a/server/tasks/inmemory_task_store.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted list method to handle Protobuf ListTasksRequest and ListTasksResponse.
    • Updated sorting logic to use Protobuf HasField and ToJsonString.
  • src/a2a/server/tasks/push_notification_config_store.py
    • Updated imports to a2a.types.a2a_pb2.
  • src/a2a/server/tasks/push_notification_sender.py
    • Updated imports to a2a.types.a2a_pb2.
  • src/a2a/server/tasks/result_aggregator.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated is_auth_required logic to use Protobuf TaskState enum value.
  • src/a2a/server/tasks/task_manager.py
    • Updated imports to a2a.types.a2a_pb2.
    • Imported InvalidParamsError from a2a.utils.errors.
    • Adapted save_task_event to handle Protobuf message fields.
    • Updated _init_task_obj to use Protobuf TaskState enum value.
  • src/a2a/server/tasks/task_updater.py
    • Imported Timestamp.
    • Updated imports to a2a.types.a2a_pb2.
    • Updated _terminal_states to use Protobuf TaskState enum values.
    • Adapted update_status to use Protobuf Timestamp and TaskStatus.
    • Removed final parameter from update_status and related methods.
    • Updated new_agent_message to use Protobuf Role enum value.
  • src/a2a/types.py
    • Removed the Pydantic-based a2a.types module.
  • src/a2a/types/init.py
    • Added a new __init__.py file to re-export Protobuf-generated types and SDK-specific error types.
    • Defined A2ARequest as a union of Protobuf request types.
  • src/a2a/types/a2a_pb2.py
    • Added the new Protobuf-generated Python file for A2A types.
  • src/a2a/types/a2a_pb2.pyi
    • Renamed from src/a2a/grpc/a2a_pb2.pyi.
    • Updated TaskState.TASK_STATE_CANCELLED to TASK_STATE_CANCELED.
    • Updated field definitions for SendMessageConfiguration, Part, Message, TaskStatusUpdateEvent, AuthenticationInfo, AgentInterface, AgentCard, AgentCapabilities, AgentSkill, TaskPushNotificationConfig, SecurityRequirement, APIKeySecurityScheme, OAuth2SecurityScheme, OpenIdConnectSecurityScheme, OAuthFlows, AuthorizationCodeOAuthFlow, ClientCredentialsOAuthFlow, ImplicitOAuthFlow, PasswordOAuthFlow, DeviceCodeOAuthFlow, SendMessageRequest, GetTaskRequest, ListTasksRequest, ListTasksResponse, CancelTaskRequest, GetTaskPushNotificationConfigRequest, DeleteTaskPushNotificationConfigRequest, CreateTaskPushNotificationConfigRequest, SubscribeToTaskRequest, ListTaskPushNotificationConfigRequest, GetExtendedAgentCardRequest, SendMessageResponse, StreamResponse, TaskState, and Role to reflect new Protobuf definitions and field names.
  • src/a2a/types/a2a_pb2_grpc.py
    • Renamed from src/a2a/grpc/a2a_pb2_grpc.py.
    • Updated docstrings for A2AServiceStub and A2AServiceServicer.
    • Renamed TaskSubscription to SubscribeToTask and GetAgentCard to GetExtendedAgentCard in both stub and servicer definitions.
  • src/a2a/utils/init.py
    • Imported proto_utils and to_stream_response.
    • Added new constants TRANSPORT_GRPC, TRANSPORT_HTTP_JSON, TRANSPORT_JSONRPC, and TransportProtocol class.
    • Updated __all__ to include new imports.
  • src/a2a/utils/artifact.py
    • Imported Struct, Value from google.protobuf.struct_pb2.
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted new_text_artifact and new_data_artifact to use Protobuf Part directly.
  • src/a2a/utils/constants.py
    • Added TRANSPORT_JSONRPC, TRANSPORT_HTTP_JSON, TRANSPORT_GRPC constants.
    • Added TransportProtocol class for transport protocol string constants.
    • Added DEFAULT_MAX_CONTENT_LENGTH and JSONRPC_PARSE_ERROR_CODE.
  • src/a2a/utils/error_handlers.py
    • Imported JSON-RPC error models from a2a.server.jsonrpc_models.
    • Updated A2AErrorToHttpStatus to use new error types.
    • Adapted error logging to use getattr for code, message, and data attributes.
  • src/a2a/utils/errors.py
    • Refactored: Removed Pydantic A2ABaseModel inheritance.
    • Defined new A2AError base class and specific error classes inheriting from it.
    • Added A2AException as an alias for A2AError for backward compatibility.
  • src/a2a/utils/helpers.py
    • Imported MessageToDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Changed create_task_obj to use SendMessageRequest and directly construct Protobuf Task.
    • Adapted append_artifact_to_task to use Protobuf CopyFrom and append.
    • Updated build_text_artifact to use Protobuf Part directly.
    • Updated canonicalize_agent_card to use MessageToDict and handle Protobuf signatures.
  • src/a2a/utils/message.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted new_agent_text_message and new_agent_parts_message to use Protobuf Role and Part directly.
  • src/a2a/utils/parts.py
    • Imported Sequence, MessageToDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted get_text_parts, get_data_parts, get_file_parts to work with Protobuf Part objects.
  • src/a2a/utils/proto_utils.py
    • Removed all ToProto and FromProto classes.
    • Added to_stream_response function to convert internal events to StreamResponse proto.
  • src/a2a/utils/signing.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted agent_card_signer to use Protobuf signatures.append.
  • src/a2a/utils/task.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted new_task to use Protobuf TaskState and check part.HasField('text').
    • Updated completed_task to use Protobuf TaskState.
    • Adapted apply_history_length to use Protobuf CopyFrom and extend.
  • src/a2a/utils/test_helpers.py
    • Added a new file containing helper functions and fixtures for testing Protobuf-related changes.
  • tck/sut_agent.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted cancel to use Protobuf TaskState and datetime objects.
    • Adapted execute to use Protobuf Part and TaskState.
    • Updated test_agent_card to use supported_interfaces and capabilities.extended_agent_card.
  • tests/README.md
    • Fixed a minor typo in the cleanup instructions.
  • tests/client/legacy.py
    • Removed the legacy client test file.
  • tests/client/legacy_grpc.py
    • Removed the legacy gRPC client test file.
  • tests/client/test_auth_middleware.py
    • Updated imports to a2a.types.a2a_pb2 and TransportProtocol.
    • Adapted build_success_response to use json_format.MessageToDict and SendMessageResponse.
    • Updated build_message to use Protobuf Role.ROLE_USER.
    • Updated test_auth_interceptor_skips_when_no_agent_card and test_auth_interceptor_variants to use new Protobuf structures and method names.
    • Added wrap_security_scheme helper for Protobuf SecurityScheme.
  • tests/client/test_base_client.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted sample_agent_card to use supported_interfaces.
    • Updated sample_message to use Protobuf Role.ROLE_USER and Part.
    • Updated test_send_message_streaming to use StreamResponse.
    • Updated test_send_message_non_streaming and test_send_message_callsite_config_overrides_non_streaming to use SendMessageResponse.
  • tests/client/test_card_resolver.py
    • Updated valid_agent_card_data to use supported_interfaces.
    • Removed patch.object(AgentCard, 'model_validate') as it's no longer needed with ParseDict.
  • tests/client/test_client_factory.py
    • Updated imports to a2a.types.a2a_pb2 and TransportProtocol.
    • Adapted base_agent_card to use supported_interfaces.
    • Updated test_client_factory_selects_secondary_transport_url and test_client_factory_server_preference to use supported_interfaces.
    • Updated test_client_factory_no_compatible_transport to use supported_protocol_bindings.
    • Updated test_client_factory_connect_with_custom_transport to use supported_interfaces.
  • tests/client/test_client_task_manager.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted sample_task and sample_message to use Protobuf structures.
    • Updated test_process_with_task, test_process_with_task_already_set_raises_error, test_process_with_status_update, test_process_with_artifact_update, test_process_creates_task_if_not_exists_on_status_update to use StreamResponse and Protobuf message fields.
    • Updated test_update_with_message_moves_status_message to use Protobuf HasField and ClearField.
  • tests/client/test_errors.py
    • Updated imports to jsonrpc.jsonrpc2.
    • Simplified test_repr for A2AClientJSONRPCError.
  • tests/client/transports/test_grpc_client.py
    • Updated mock_grpc_stub to MagicMock.
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted sample_agent_card to use supported_interfaces.
    • Updated grpc_transport to use MagicMock for channel.
    • Updated sample_message_send_params to use SendMessageRequest.
    • Updated sample_task to use Protobuf TaskState.TASK_STATE_COMPLETED.
    • Updated sample_message to use Protobuf Role.ROLE_AGENT and Part.
    • Updated sample_artifact to use Protobuf Part.
    • Updated sample_task_status_update_event to use Protobuf TaskState.TASK_STATE_WORKING.
    • Updated sample_authentication_info to use Protobuf AuthenticationInfo.
    • Updated sample_task_push_notification_config to include id.
    • Updated test_send_message_task_response and test_send_message_message_response to use SendMessageResponse and Protobuf messages directly.
    • Updated test_send_message_streaming to use StreamResponse and Protobuf messages directly.
    • Updated test_get_task to use GetTaskRequest and Protobuf messages directly.
    • Updated test_list_tasks to use ListTasksRequest and Protobuf messages directly.
    • Updated test_cancel_task to use CancelTaskRequest and Protobuf messages directly.
    • Updated test_set_task_callback_with_valid_task to use CreateTaskPushNotificationConfigRequest and Protobuf messages directly.
    • Updated test_set_task_callback_with_invalid_task to use CreateTaskPushNotificationConfigRequest and Protobuf messages directly.
    • Updated test_get_task_callback_with_valid_task to use GetTaskPushNotificationConfigRequest and Protobuf messages directly.
    • Updated test_get_task_callback_with_invalid_task to use GetTaskPushNotificationConfigRequest and Protobuf messages directly.
  • tests/client/transports/test_jsonrpc_client.py
    • Updated imports to json_format, uuid4, mock, EventSource, SSEError.
    • Removed A2ACardResolver, create_text_message_object.
    • Updated imports to a2a.types.a2a_pb2.
    • Updated agent_card fixture to use Protobuf AgentCard and AgentInterface.
    • Removed AGENT_CARD_EXTENDED, MINIMAL_TASK, MINIMAL_CANCELLED_TASK dicts.
    • Updated create_send_message_request to use Protobuf SendMessageRequest.
    • Updated _assert_extensions_header.
    • Updated TestJsonRpcTransportInit to use Protobuf AgentCard and AgentInterface.
    • Updated TestSendMessage to use Protobuf SendMessageResponse and SendMessageRequest.
    • Updated TestGetTask to use Protobuf GetTaskRequest and Task.
    • Updated TestCancelTask to use Protobuf CancelTaskRequest and Task.
    • Updated TestTaskCallback to use Protobuf GetTaskPushNotificationConfigRequest and TaskPushNotificationConfig.
    • Updated TestClose.
    • Updated TestStreamingErrors to use Protobuf SendMessageRequest.
    • Updated TestInterceptors to use Protobuf SendMessageRequest.
    • Updated TestExtensions to use Protobuf SendMessageRequest.
  • tests/client/transports/test_rest_client.py
    • Updated imports to json_format.
    • Removed respx.
    • Updated imports to a2a.types.a2a_pb2.
    • Removed proto_utils.
    • Updated mock_agent_card to use supported_interfaces and capabilities.
    • Updated test_send_message_streaming_timeout, test_send_message_with_default_extensions, test_send_message_streaming_with_new_extensions, test_send_message_streaming_server_error_propagates to use SendMessageRequest.
    • Updated test_get_card_no_card_provided_with_extensions, test_get_card_with_extended_card_support_with_extensions to use Protobuf AgentCard and AgentInterface.
  • tests/e2e/init.py
    • Added a new __init__.py file for e2e tests package.
  • tests/e2e/push_notifications/init.py
    • Added a new __init__.py file for push notifications e2e tests package.
  • tests/e2e/push_notifications/agent_app.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted test_agent_card to use supported_interfaces and capabilities.extended_agent_card.
    • Adapted invoke to use Protobuf Part and text field directly.
  • tests/e2e/push_notifications/notifications_app.py
    • Imported Any, ConfigDict, StreamResponse, Task, ParseDict, MessageToDict.
    • Updated Notification to use dict[str, Any] for task.
    • Adapted add_notification to parse StreamResponse and extract Task.
    • Updated list_notifications_by_task path.
  • tests/e2e/push_notifications/test_default_push_notification_support.py
    • Updated imports to a2a.types.a2a_pb2 and TransportProtocol.
    • Adapted test_notification_triggering_with_in_message_config_e2e to use supported_protocol_bindings, Protobuf Part, Role, StreamResponse, and task dict.
    • Adapted test_notification_triggering_after_config_change_e2e to use supported_protocol_bindings, Protobuf Part, Role, StreamResponse, CreateTaskPushNotificationConfigRequest, and task dict.
  • tests/e2e/push_notifications/utils.py
    • Updated imports to multiprocessing, sys.
    • Changed create_app_process to use multiprocessing.get_context for platform compatibility.
  • tests/extensions/test_common.py
    • Updated imports to a2a.types.a2a_pb2.
    • Adapted test_find_extension_by_uri and test_find_extension_by_uri_no_extensions to use supported_interfaces.
  • tests/integration/test_client_server_integration.py
    • Imported MessageToDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Updated TASK_FROM_STREAM, TASK_FROM_BLOCKING, GET_TASK_RESPONSE, CANCEL_TASK_RESPONSE to use Protobuf TaskState.
    • Updated CALLBACK_CONFIG to include id.
    • Updated create_key_provider type hint.
    • Updated mock_request_handler to return Protobuf ListTasksResponse.
    • Updated agent_card to use supported_interfaces.
    • Updated test_http_transport_sends_message_streaming to use Protobuf Role, Part, SendMessageRequest, and StreamResponse.
    • Updated test_grpc_transport_sends_message_streaming to use Protobuf Role, Part, SendMessageRequest, and StreamResponse.
    • Updated test_http_transport_sends_message_blocking to use Protobuf Role, Part, SendMessageRequest, and SendMessageResponse.
    • Updated test_grpc_transport_sends_message_blocking to use Protobuf Role, Part, SendMessageRequest.
    • Updated test_http_transport_get_task and test_grpc_transport_get_task to use GetTaskRequest.
    • Removed test_http_transport_list_tasks and test_grpc_transport_list_tasks.
    • Updated test_http_transport_cancel_task and test_grpc_transport_cancel_task to use CancelTaskRequest.
    • Updated test_http_transport_set_task_callback and test_grpc_transport_set_task_callback to use CreateTaskPushNotificationConfigRequest.
    • Updated test_http_transport_get_task_callback and test_grpc_transport_get_task_callback to use GetTaskPushNotificationConfigRequest.
    • Updated test_http_transport_resubscribe and test_grpc_transport_resubscribe to use SubscribeToTaskRequest.
    • Updated test_http_transport_get_card to use transport.agent_card.
    • Updated test_http_transport_get_authenticated_card to use capabilities.extended_agent_card and Protobuf AgentCard.
    • Updated test_grpc_transport_get_card to use capabilities.extended_agent_card.
    • Updated test_json_transport_base_client_send_message_with_extensions to use Protobuf Role, Part, SendMessageRequest, and MessageToDict.
    • Updated test_json_transport_get_signed_base_card, test_json_transport_get_signed_extended_card, test_json_transport_get_signed_base_and_extended_cards, test_rest_transport_get_signed_card, test_grpc_transport_get_signed_card to use capabilities.extended_agent_card and Protobuf AgentCard.
  • tests/server/agent_execution/test_context.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated mock_params to use SendMessageRequest.
    • Updated test_init_raises_error_on_task_id_mismatch and test_init_raises_error_on_context_id_mismatch to check exc_info.value.error.
    • Updated test_with_related_tasks_provided to handle related_tasks type.
  • tests/server/agent_execution/test_simple_request_context_builder.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated create_sample_message to use Protobuf Role.ROLE_USER and Part.
    • Updated create_sample_task to use Protobuf TaskState.TASK_STATE_SUBMITTED.
    • Updated test_build_basic_context_no_populate, test_build_populate_true_reference_ids_empty_or_none, test_build_populate_true_task_store_none, test_build_populate_false_with_reference_task_ids, test_build_with_custom_id_generators, test_build_with_provided_ids_and_custom_id_generators to use SendMessageRequest.
  • tests/server/apps/jsonrpc/test_fastapi_app.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated mock_app_params to remove supports_authenticated_extended_card.
  • tests/server/apps/jsonrpc/test_jsonrpc_app.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated mock_agent_card to remove supports_authenticated_extended_card.
    • Updated test_jsonrpc_app_build_method_abstract_raises_typeerror to ignore abstract type.
    • Updated mock_handler to return Protobuf Message.
    • Updated test_app to set capabilities.streaming.
    • Updated _make_send_message_request to use Protobuf Role.ROLE_USER and messageId.
    • Updated test_method_added_to_call_context_state to check SendMessage.
    • Updated test_response_with_activated_extensions to return Protobuf Message.
  • tests/server/apps/jsonrpc/test_serialization.py
    • Imported ConfigDict.
    • Updated imports to a2a.types.a2a_pb2.
    • Updated agent_card_with_api_key to use Protobuf APIKeySecurityScheme and SecurityScheme.
    • Updated test_starlette_agent_card_with_api_key_scheme_alias to test_starlette_agent_card_serialization and test_starlette_agent_card_with_api_key_scheme.
    • Updated test_fastapi_agent_card_with_api_key_scheme_alias to test_fastapi_agent_card_serialization.
    • Updated test_handle_invalid_json and test_handle_oversized_payload to use minimal_agent_card.
    • Updated test_handle_unicode_characters to use minimal_agent_card, Protobuf Role, Part, and messageId.
    • Updated test_fastapi_sub_application to use minimal_agent_card.
  • tests/server/apps/rest/test_rest_fastapi_app.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated agent_card and streaming_agent_card to remove supports_authenticated_extended_card.
    • Updated test_send_message_success_message and test_send_message_success_task to use Protobuf Message and Task.
    • Updated test_streaming_endpoint_with_invalid_content_type to use Protobuf Message.
    • Updated test_send_message_rejected_task to use Protobuf Message.
  • tests/server/events/test_event_consumer.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated MINIMAL_TASK and MESSAGE_PAYLOAD to create_sample_task and create_sample_message.
    • Updated test_consume_one_task_event, test_consume_one_message_event, test_consume_one_a2a_error_event, test_consume_all_multiple_events, test_consume_until_message, test_consume_message_events, test_consume_all_continues_on_queue_empty_if_not_really_closed, test_consume_all_continues_on_queue_empty_when_not_closed to use new helper functions.
  • tests/server/events/test_event_queue.py
    • Updated imports to a2a.types.a2a_pb2.
    • Updated MINIMAL_TASK and MESSAGE_PAYLOAD to create_sample_task and create_sample_message.
    • Updated test_enqueue_and_dequeue_event, test_dequeue_event_no_wait, test_dequeue_event_wait, test_task_done, test_enqueue_different_event_types, test_enqueue_event_propagates_to_children, test_enqueue_event_when_closed, test_close_sets_flag_and_handles_internal_queue_old_python, test_close_sets_flag_and_handles_internal_queue_new_python, test_close_graceful_py313_waits_for_join_and_children, test_close_propagates_to_children, test_close_idempotent, test_close_with_immediate_true, test_close_immediate_propagates_to_children, test_clear_events_current_queue_only, test_clear_events_with_children, test_clear_events_closed_queue to use new helper functions and Protobuf types.
Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/linter.yaml
    • .github/workflows/unit-tests.yml
    • .github/workflows/update-a2a-types.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ishymko ishymko force-pushed the ishymko/1.0-a2a_proto_refactor branch from 7f51011 to 9727f48 Compare February 17, 2026 16:09
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant refactor of the A2A SDK, transitioning from Pydantic-based models to Protobuf-generated types for core protocol entities. This change aligns the Python SDK with the official A2A specification and improves interoperability with other language implementations. The refactor includes updates to client transports (gRPC, JSON-RPC, REST), server request handlers, and task management logic. While the overall structure is sound, I have identified a critical inconsistency in the JSONRPCHandler.list_tasks method which returns a proto object instead of a dictionary, potentially breaking JSON-RPC responses. I've also suggested improvements for error handling in fallthrough cases and noted a minor typo in the documentation.

Comment on lines +182 to +184
# Should we handle this fallthrough?
pass

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallthrough case where task_or_message is neither a Task nor a Message should be handled by raising an error. Returning an empty response might lead to unexpected behavior or silent failures on the client side.

            else:
                raise ServerError(
                    error=InvalidAgentResponseError(
                        message=f'Handler returned unexpected type: {type(task_or_message)}'
                    )
                )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I am going to review it further, current goal was to resolve merge conflicts and have tests passing, I will dive into the actual changes and will review Gemini comments from this PR.

(Follow the onscreen instructions to export DSNs and run pytest manually).

In case of failures, you can clean up the cache:
In case of failures, you can clean up the cache:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Minor typo: double space in "clean up".

Suggested change
In case of failures, you can clean up the cache:
In case of failures, you can clean up the cache:

@ishymko ishymko marked this pull request as ready for review February 17, 2026 16:12
@ishymko ishymko requested review from a team and a2a-bot as code owners February 17, 2026 16:12
@ishymko ishymko merged commit 9727f48 into 1.0-dev Feb 17, 2026
9 checks passed
@ishymko ishymko deleted the ishymko/1.0-a2a_proto_refactor branch February 17, 2026 16:13
ishymko added a commit that referenced this pull request Feb 18, 2026
Fixes
#697 (comment),
bad merge in #696.

Cover "list tasks" in client-server integration tests which would
prevent it.

Re #559.
ishymko added a commit that referenced this pull request Feb 18, 2026
JSON-RPC diverged a bit, update it to match other transports. Domain
request handler returns `Task | Message` from `on_message_send` already.

Fixes
#697 (comment).

Re #559.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments