Skip to content

refactor: remove custom a2a.json from json rpc FastAPI#850

Merged
ishymko merged 2 commits intoa2aproject:1.0-devfrom
guglielmo-san:guglielmoc/remote_a2a_json
Mar 17, 2026
Merged

refactor: remove custom a2a.json from json rpc FastAPI#850
ishymko merged 2 commits intoa2aproject:1.0-devfrom
guglielmo-san:guglielmoc/remote_a2a_json

Conversation

@guglielmo-san
Copy link
Copy Markdown
Member

Description

This PR removes the generation and use of a2a.json.
Its content is not compatible with the JSON-RPC protocol, so there is no need to load it with the FastAPI server generation.

@guglielmo-san guglielmo-san requested review from a team and a2a-bot as code owners March 17, 2026 13:29
@guglielmo-san guglielmo-san changed the base branch from main to 1.0-dev March 17, 2026 13:29
@guglielmo-san guglielmo-san requested a review from ishymko March 17, 2026 13:31
@github-actions
Copy link
Copy Markdown

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/apps/jsonrpc/fastapi_app.py 63.41% 82.35% 🟢 +18.94%
Total 90.10% 90.22% 🟢 +0.13%

Generated by coverage-comment.yml

@ishymko ishymko merged commit be457f4 into a2aproject:1.0-dev Mar 17, 2026
6 checks passed
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 significantly refactors the A2A SDK by migrating its core data structures to Protocol Buffers, which improves robustness and interoperability. A major focus was also placed on ensuring backward compatibility with the previous v0.3 protocol, providing a smooth transition path for existing integrations. Additionally, the client-side request processing has been enhanced with a new interceptor pattern, and a dedicated CLI tool for database migrations has been introduced to manage schema updates effectively.

Highlights

  • Protocol Buffer Migration: The core data models have been migrated from Pydantic to Protocol Buffers, enhancing type safety, performance, and cross-language compatibility. This change impacts client and server-side request/response handling.
  • Backward Compatibility for v0.3: Introduced a comprehensive backward compatibility layer for the v0.3 protocol, allowing older clients and servers to interoperate with the new v1.0 SDK. This includes dedicated adapters and transports for JSON-RPC, REST, and gRPC.
  • Client Interceptor Refactoring: The client-side middleware system has been refactored into a more flexible interceptor pattern, enabling clearer separation of concerns for tasks like authentication and request modification.
  • Database Migration CLI: A new command-line interface (a2a-db) has been added for managing database schema migrations, ensuring compatibility with updated data models for tasks and push notification configurations.
  • Removal of Custom a2a.json: The generation and usage of the custom a2a.json file have been removed, streamlining the OpenAPI specification process and aligning with standard practices.
Changelog
  • .git-blame-ignore-revs
    • Updated the GitHub repository URL from 'master' to 'main'.
  • .github/actions/spelling/allow.txt
    • Added new allowed words such as 'a2a', 'A2A', 'A2AFastAPI', 'AIP', 'alg', 'base64url', 'buf', 'bufbuild', 'ES256', 'FastAPI', 'hazmat', 'HS256', 'HS384', 'importlib', 'jcs', 'JOSE', 'JSONRPC', 'middleware', 'npx', 'Oneof', 'OpenAPI', 'openapiv', 'openapiv2', 'pb2', 'poolclass', 'proto', 'protobuf', 'Protobuf', 'pydantic', 'RS256', 'SECP256R1', 'starlette', 'Starlette', 'swagger', 'typ', and 'TResponse'.
  • .github/actions/spelling/excludes.txt
    • Added new exclude patterns for 'buf.gen.yaml', 'src/a2a/types/', 'src/a2a/compat/v0_3/a2a_v0_3*', and 'a2a.json'.
  • .gitignore
    • Added 'docker-compose.yaml' and '.geminiignore' to the ignore list.
  • .jscpd.json
    • Added '/src/a2a/compat/' to the ignore list for code duplication checks.
  • .release-please-manifest.json
    • Added a new release-please manifest file.
  • CODE_OF_CONDUCT.md
    • Updated the GitHub repository URL from 'master' to 'main'.
  • buf.compat.gen.yaml
    • Added a new Buf configuration file for generating legacy v0.3 Protobuf modules.
  • buf.gen.yaml
    • Updated the Git repository reference from 'main' to 'v1.0.0' and the subdirectory from 'specification/grpc' to 'specification'.
    • Changed the output directory for Python Protobuf generation from 'src/a2a/grpc' to 'src/a2a/types'.
  • pyproject.toml
    • Added 'json-rpc>=1.15.0' and 'googleapis-common-protos>=1.70.0' to core dependencies.
    • Added 'grpcio-status>=1.60' to the 'grpc' optional dependency group.
    • Added 'db-cli' optional dependency group with 'alembic>=1.14.0'.
    • Added 'a2a-sdk[db-cli]' to the 'all' optional dependency group.
    • Removed 'datamodel-code-generator>=0.30.0' from 'dev' dependencies.
    • Added 'PyJWT>=2.0.0' and 'pyright' to 'dev' dependencies.
    • Added filter warnings for SQLAlchemy and ResourceWarnings in pytest configuration.
    • Updated 'mypy' exclude patterns to target generated Protobuf files in 'src/a2a/types' and 'src/a2a/compat/v0_3'.
    • Updated 'ruff' exclude patterns to target generated Protobuf files in 'src/a2a/types' and 'src/a2a/compat/v0_3'.
    • Added '[tool.alembic]' section for migration script location and path configuration.
    • Added '[project.scripts]' section to define the 'a2a-db' CLI entry point.
  • release-please-config.json
    • Added a new release-please configuration file.
  • scripts/checkout_experimental_types.sh
    • Removed the script for checking out experimental types.
  • scripts/gen_proto.sh
    • Added a new script for generating Protobuf code and OpenAPI spec, including renaming and import fixing.
  • scripts/gen_proto_compat.sh
    • Added a new script for generating and fixing legacy v0.3 compatibility Protobuf code.
  • scripts/generate_types.sh
    • Removed the script for generating types.
  • scripts/grpc_gen_post_processor.py
    • Removed the gRPC generation post-processor script.
  • scripts/lint.sh
    • Added a new linting script that runs Ruff, MyPy, and Pyright.
  • src/a2a/a2a_db_cli.py
    • Added a new CLI tool for managing A2A database migrations using Alembic.
  • src/a2a/alembic.ini
    • Added a new Alembic configuration file for database migrations.
  • src/a2a/client/init.py
    • Removed imports for deprecated legacy client classes and specific HTTP/JSON error types.
    • Updated imports for ClientCallContext and ClientCallInterceptor to new locations.
    • Added AgentCardResolutionError to __all__.
  • src/a2a/client/auth/credentials.py
    • Updated the import path for ClientCallContext.
  • src/a2a/client/auth/interceptor.py
    • Refactored the intercept method into before and after methods to align with the new interceptor pattern.
    • Updated type handling for security schemes to use Protobuf messages instead of Pydantic models.
    • Removed imports for specific Pydantic security scheme types.
  • src/a2a/client/base_client.py
    • Removed Self import and __aenter__/__aexit__ methods.
    • Changed middleware parameter to interceptors in the constructor.
    • Updated method signatures to use Protobuf types for requests and responses.
    • Introduced _execute_with_interceptors and _execute_stream_with_interceptors for consistent interceptor application.
    • Refactored send_message to handle non-streaming responses by converting them to StreamResponse.
    • Updated _process_stream to handle StreamResponse and apply interceptors.
    • Renamed resubscribe to subscribe and get_card to get_extended_agent_card.
  • src/a2a/client/card_resolver.py
    • Replaced Pydantic ValidationError with Protobuf ParseError for agent card validation.
    • Updated error handling to raise AgentCardResolutionError instead of A2AClientHTTPError or A2AClientJSONError.
    • Added parse_agent_card helper function for backward compatibility.
    • Adjusted target_url construction to handle empty relative_card_path correctly.
  • src/a2a/client/client.py
    • Replaced Pydantic models with Protobuf types for various request and response objects.
    • Removed __aenter__/__aexit__ methods from the abstract Client class.
    • Introduced ClientCallContext as a Pydantic model for call-specific configuration.
    • Renamed supported_transports to supported_protocol_bindings in ClientConfig.
    • Updated ClientEvent type alias to reflect Protobuf StreamResponse.
    • Changed middleware parameter to interceptors in Client constructor and add_interceptor method.
    • Updated abstract method signatures to use Protobuf types for all client operations.
  • src/a2a/client/client_factory.py
    • Updated TransportProducer signature to remove interceptors parameter.
    • Added logic to _register_defaults to detect legacy protocol versions and use compatible transports.
    • Introduced _is_legacy_version and _find_best_interface static methods for protocol version negotiation.
    • Removed extensions parameter from connect and create methods.
    • Updated minimal_agent_card to use the new AgentCard structure with supported_interfaces and capabilities.
  • src/a2a/client/client_task_manager.py
    • Updated error types to use A2AClientError instead of A2AClientInvalidArgsError and A2AClientInvalidStateError.
    • Changed the process method to accept StreamResponse Protobuf messages.
    • Updated internal logic to handle Protobuf messages for task status and artifact updates.
    • Modified update_with_message to correctly handle Protobuf TaskStatus messages.
  • src/a2a/client/errors.py
    • Simplified the error hierarchy by removing specific HTTP, JSON, and JSON-RPC client errors.
    • Introduced AgentCardResolutionError for issues related to fetching agent cards.
  • src/a2a/client/helpers.py
    • Added parse_agent_card and related compatibility functions (_handle_extended_card_compatibility, _handle_connection_fields_compatibility, _map_legacy_security, _handle_security_compatibility) to handle legacy v0.3 AgentCard structures.
    • Updated create_text_message_object to directly use Protobuf Part types.
  • src/a2a/client/interceptors.py
    • Added new file defining BeforeArgs, AfterArgs, and ClientCallInterceptor classes for client-side request/response interception.
  • src/a2a/client/legacy.py
    • Removed the deprecated A2AClient class.
  • src/a2a/client/legacy_grpc.py
    • Removed the deprecated A2AGrpcClient class.
  • src/a2a/client/middleware.py
    • Removed the ClientCallContext and ClientCallInterceptor classes, which have been moved and refactored.
  • src/a2a/client/optionals.py
    • Updated the type ignore comment for grpc.aio.Channel to reportMissingModuleSource.
  • src/a2a/client/service_parameters.py
    • Added new file defining ServiceParameters, ServiceParametersUpdate, ServiceParametersFactory, and with_a2a_extensions for managing service-specific parameters.
  • src/a2a/client/transports/base.py
    • Updated all abstract method signatures to use Protobuf types for requests and responses, replacing Pydantic models.
  • src/a2a/client/transports/grpc.py
    • Refactored gRPC error handling with _map_grpc_error and _handle_grpc_exception/_handle_grpc_stream_exception decorators.
    • Updated method signatures to use Protobuf types for all gRPC operations.
    • Removed manual extension metadata handling and _needs_extended_card logic.
    • Introduced _call_grpc and _call_grpc_stream helper methods for consistent gRPC call execution.
    • Added grpcio-status to the import error message.
  • src/a2a/client/transports/http_helpers.py
    • Added new file containing common HTTP client helper functions like handle_http_exceptions, get_http_args, send_http_request, and send_http_stream_request.
  • src/a2a/client/transports/jsonrpc.py
    • Refactored to use http_helpers for common HTTP operations.
    • Migrated to Protobuf types for all request and response payloads.
    • Integrated jsonrpc.jsonrpc2 library for JSON-RPC message construction and parsing.
    • Removed manual interceptor application, now handled by BaseClient.
    • Updated error handling to use _create_jsonrpc_error for mapping JSON-RPC errors to A2A exceptions.
  • src/a2a/client/transports/rest.py
    • Refactored to use http_helpers for common HTTP operations.
    • Migrated to Protobuf types for all request and response payloads.
    • Updated error handling with _handle_http_error to map HTTP errors to A2A exceptions.
    • Removed manual interceptor application, now handled by BaseClient.
    • Introduced _get_path and _execute_request helper methods for consistent REST call execution.
  • src/a2a/client/transports/tenant_decorator.py
    • Added a new file defining TenantTransportDecorator to automatically attach tenant information to requests.
  • src/a2a/compat/init.py
    • Renamed from src/a2a/grpc/__init__.py.
  • src/a2a/compat/v0_3/README.md
    • Added a README file explaining the purpose and structure of the v0.3 backward compatibility layer.
  • src/a2a/compat/v0_3/a2a_v0_3.proto
    • Added the Protocol Buffer definition for the A2A v0.3 protocol.
  • src/a2a/compat/v0_3/a2a_v0_3_pb2.py
    • Added the Python Protobuf generated code for the A2A v0.3 protocol.
  • src/a2a/compat/v0_3/a2a_v0_3_pb2.pyi
    • Renamed from src/a2a/grpc/a2a_pb2.pyi and updated to reflect v0.3 Protobuf types.
  • src/a2a/compat/v0_3/a2a_v0_3_pb2_grpc.py
    • Renamed from src/a2a/grpc/a2a_pb2_grpc.py and updated to reflect v0.3 gRPC service definitions.
  • src/a2a/compat/v0_3/buf.lock
    • Added a new Buf lock file for v0.3 compatibility Protobuf definitions.
  • src/a2a/compat/v0_3/buf.yaml
    • Added a new Buf configuration file for v0.3 compatibility Protobuf definitions.
  • src/a2a/compat/v0_3/conversions.py
    • Added a new file containing conversion functions between v0.3 Pydantic models and v1.0 Protobuf messages for various A2A types.
  • src/a2a/compat/v0_3/grpc_handler.py
    • Added a new file defining CompatGrpcHandler for handling v0.3 gRPC requests and converting them to v1.0 internal types.
  • src/a2a/compat/v0_3/grpc_transport.py
    • Added a new file defining CompatGrpcTransport for making v0.3 gRPC client calls and converting responses to v1.0 internal types.
  • src/a2a/compat/v0_3/jsonrpc_adapter.py
    • Added a new file defining JSONRPC03Adapter for handling v0.3 JSON-RPC requests and converting them to v1.0 internal types.
  • src/a2a/compat/v0_3/jsonrpc_transport.py
    • Added a new file defining CompatJsonRpcTransport for making v0.3 JSON-RPC client calls and converting responses to v1.0 internal types.
  • src/a2a/compat/v0_3/proto_utils.py
    • Added a new file containing utility functions for converting between v0.3 Pydantic models and v0.3 Protobuf messages.
  • src/a2a/compat/v0_3/request_handler.py
    • Added a new file defining RequestHandler03 to adapt v0.3 requests to the v1.0 RequestHandler.
  • src/a2a/compat/v0_3/rest_adapter.py
    • Added a new file defining REST03Adapter for handling v0.3 REST requests and converting them to v1.0 internal types.
  • src/a2a/compat/v0_3/rest_handler.py
    • Added a new file defining REST03Handler to process v0.3 REST requests and format responses for v0.3 compatibility.
  • src/a2a/compat/v0_3/rest_transport.py
    • Added a new file defining CompatRestTransport for making v0.3 REST client calls and converting responses to v1.0 internal types.
  • src/a2a/compat/v0_3/types.py
    • Renamed from src/a2a/types.py and updated to define Pydantic models for the A2A v0.3 protocol.
  • src/a2a/contrib/tasks/vertex_task_converter.py
    • Updated imports to use a2a.compat.v0_3.types for legacy Pydantic models.
  • src/a2a/contrib/tasks/vertex_task_store.py
    • Updated imports for Task to use Protobuf Task and added conversion functions from a2a.compat.v0_3.conversions.
    • Updated method signatures and internal logic to handle Protobuf Task objects and conversions.
  • src/a2a/extensions/common.py
    • Updated imports for AgentCard and AgentExtension to use Protobuf types.
    • Removed the update_extension_header function.
  • src/a2a/grpc/a2a_pb2.py
    • Removed the Python Protobuf generated code for the A2A v1.0 protocol, which is now located in src/a2a/types/a2a_pb2.py.
  • src/a2a/server/agent_execution/agent_executor.py
    • Updated references to TaskState.canceled to TaskState.TASK_STATE_CANCELED.
  • src/a2a/server/agent_execution/context.py
    • Updated imports for Message, SendMessageConfiguration, SendMessageRequest, and Task to use Protobuf types.
    • Removed ServerError import and replaced its usage with InvalidParamsError directly.
    • Updated configuration property to return SendMessageConfiguration.
  • src/a2a/server/agent_execution/request_context_builder.py
    • Updated import for SendMessageRequest to use the Protobuf type.
  • src/a2a/server/agent_execution/simple_request_context_builder.py
    • Updated import for SendMessageRequest to use the Protobuf type.
  • src/a2a/server/apps/jsonrpc/fastapi_app.py
    • Removed the custom A2AFastAPI class and its OpenAPI schema modification logic.
    • Removed EXTENDED_AGENT_CARD_PATH and PREV_AGENT_CARD_WELL_KNOWN_PATH constants.
    • Added enable_v0_3_compat parameter to the constructor and removed extended_agent_card_url from add_routes_to_app and build methods.
  • src/a2a/server/apps/jsonrpc/jsonrpc_app.py
    • Added JSONRPC03Adapter import for v0.3 compatibility.
    • Updated METHOD_TO_MODEL to explicitly map Protobuf types to method names.
    • Refactored error handling to use _build_error_response and _build_success_response helpers.
    • Added enable_v0_3_compat parameter and logic to conditionally use the v0.3 adapter.
    • Updated _process_streaming_request and _process_non_streaming_request to handle Protobuf messages directly.
  • src/a2a/server/apps/jsonrpc/starlette_app.py
    • Removed EXTENDED_AGENT_CARD_PATH and PREV_AGENT_CARD_WELL_KNOWN_PATH constants.
    • Added enable_v0_3_compat parameter to the constructor and removed extended_agent_card_url from routes and add_routes_to_app methods.
  • src/a2a/server/apps/rest/fastapi_app.py
    • Added REST03Adapter import for v0.3 compatibility.
    • Introduced _HTTP_TO_GRPC_STATUS_MAP for mapping HTTP status codes to gRPC status codes.
    • Added enable_v0_3_compat parameter to the constructor and logic to mount v0.3 compatible endpoints.
    • Implemented a custom exception handler for StarletteHTTPException to format errors into A2A standard.
  • src/a2a/server/apps/rest/rest_adapter.py
    • Introduced RESTAdapterInterface as an abstract base class.
    • Refactored handle_authenticated_agent_card to _handle_authenticated_agent_card.
    • Updated routes method to generate paths for both root and tenant-prefixed URLs.
    • Added _build_call_context to extract tenant from path parameters.
    • Updated handle_get_agent_card and _handle_authenticated_agent_card to use MessageToDict for Protobuf serialization.
  • src/a2a/server/context.py
    • Added a tenant field to ServerCallContext for multi-tenancy support.
  • src/a2a/server/events/event_consumer.py
    • Updated TaskState references to use Protobuf enum values (e.g., TaskState.TASK_STATE_AUTH_REQUIRED).
    • Removed ServerError import and replaced its usage with InternalError directly.
  • src/a2a/server/events/event_queue.py
    • Updated imports for Message, Task, TaskArtifactUpdateEvent, and TaskStatusUpdateEvent to use Protobuf types.
  • src/a2a/server/jsonrpc_models.py
    • Added a new file defining Pydantic models for standard JSON-RPC 2.0 error structures.
  • src/a2a/server/models.py
    • Removed PydanticType and PydanticListType classes.
    • Updated TaskMixin and PushNotificationConfigMixin to use JSON type for status, artifacts, and history fields.
    • Added owner, last_updated, and protocol_version fields to TaskMixin and PushNotificationConfigMixin.
    • Added Index definitions to TaskMixin and PushNotificationConfigMixin for owner and last_updated fields.
  • src/a2a/server/owner_resolver.py
    • Added a new file defining OwnerResolver and a default resolve_user_scope function for multi-tenancy.
  • src/a2a/server/request_handlers/default_request_handler.py
    • Updated imports for various request types and TaskState to use Protobuf types.
    • Removed ServerError import and replaced its usage with specific A2A error types.
    • Updated TERMINAL_TASK_STATES to use Protobuf TaskState enum values.
    • Refactored on_get_task, on_list_tasks, on_cancel_task, _setup_message_execution, _send_push_notification_if_needed, on_message_send, on_message_send_stream, on_create_task_push_notification_config, on_get_task_push_notification_config, on_subscribe_to_task, on_list_task_push_notification_configs, and on_delete_task_push_notification_config to handle Protobuf messages and new owner resolution logic.
  • src/a2a/server/request_handlers/grpc_handler.py
    • Updated imports for grpc, grpc.aio, rpc_status, any_pb2, empty_pb2, message, error_details_pb2, status_pb2, a2a_grpc, a2a_pb2, AgentCard, A2A_ERROR_REASONS, A2AError, and TaskNotFoundError.
    • Removed ServerError import and replaced its usage with A2AError.
    • Added _ERROR_CODE_MAP for mapping A2A errors to gRPC status codes.
    • Refactored SendMessage, SendStreamingMessage, CancelTask, SubscribeToTask, GetTaskPushNotificationConfig, CreateTaskPushNotificationConfig, ListTaskPushNotificationConfigs, DeleteTaskPushNotificationConfig, GetExtendedAgentCard, and abort_context to handle Protobuf messages and rich error details.
    • Introduced _build_call_context to extract tenant information.
  • src/a2a/server/request_handlers/jsonrpc_handler.py
    • Updated imports for MessageToDict, JSONRPC20Response, JSONRPCInternalError, JSONRPCError, proto_utils, JSON_RPC_ERROR_CODE_MAP, A2AError, and various specific A2A error types.
    • Removed ServerError import and replaced its usage with specific A2A error types.
    • Refactored _build_success_response and _build_error_response helpers.
    • Updated on_message_send, on_message_send_stream, on_cancel_task, on_subscribe_to_task, get_push_notification_config, set_push_notification_config, on_get_task, list_tasks, list_push_notification_configs, delete_push_notification_config, and get_authenticated_extended_card to handle Protobuf messages and new error structures.
  • src/a2a/server/request_handlers/request_handler.py
    • Updated imports for various request types to use Protobuf types.
    • Removed ServerError import.
    • Added abstract method on_list_tasks for retrieving multiple tasks.
  • src/a2a/server/request_handlers/response_helpers.py
    • Updated imports for MessageToDict, ProtoMessage, JSONRPC20Response, to_compat_agent_card, JSONRPCInternalError, JSONRPCError, JSON_RPC_ERROR_CODE_MAP, A2AError, and various specific A2A error types.
    • Refactored agent_card_to_dict to merge Protobuf and legacy Pydantic agent card data.
    • Updated build_error_response and prepare_response_object to handle Protobuf messages and new error structures.
  • src/a2a/server/request_handlers/rest_handler.py
    • Updated imports for MessageToDict, Parse, CancelTaskRequest, GetTaskPushNotificationConfigRequest, SubscribeToTaskRequest to use Protobuf types.
    • Removed ServerError import and replaced its usage with TaskNotFoundError directly.
    • Refactored on_message_send, on_message_send_stream, on_cancel_task, on_subscribe_to_task, get_push_notification, set_push_notification, on_get_task, delete_push_notification, list_tasks, and list_push_notifications to handle Protobuf messages and new request/response structures.
  • src/a2a/server/tasks/base_push_notification_sender.py
    • Updated imports for MessageToDict, ServerCallContext, PushNotificationEvent, TaskPushNotificationConfig, and to_stream_response.
    • Refactored send_notification and _dispatch_notification to handle PushNotificationEvent and use ServerCallContext.
  • src/a2a/server/tasks/database_push_notification_config_store.py
    • Updated imports for Table, and_, delete, select, MessageToJson, Parse, Callable, compat_push_notification_config_model_to_core, ServerCallContext, OwnerResolver, resolve_user_scope, and TaskPushNotificationConfig.
    • Refactored __init__, _to_orm, _from_orm, set_info, get_info, delete_info, and _parse_config to incorporate owner resolution, protocol versioning, and compatibility conversions.
  • src/a2a/server/tasks/database_task_store.py
    • Updated imports for Table, and_, delete, func, or_, select, datetime, timezone, Callable, MessageToDict, ParseDict, compat_task_model_to_core, OwnerResolver, resolve_user_scope, a2a_pb2, Task, DEFAULT_LIST_TASKS_PAGE_SIZE, InvalidParamsError, decode_page_token, and encode_page_token.
    • Refactored __init__, _to_orm, _from_orm, save, get, list, and delete to incorporate owner resolution, protocol versioning, and compatibility conversions, and added pagination logic for list.
  • src/a2a/server/tasks/inmemory_push_notification_config_store.py
    • Updated imports for ServerCallContext, OwnerResolver, resolve_user_scope, and TaskPushNotificationConfig.
    • Refactored __init__, _get_owner_push_notification_infos, set_info, get_info, and delete_info to incorporate owner resolution and multi-tenancy.
  • src/a2a/server/tasks/inmemory_task_store.py
    • Updated imports for ServerCallContext, OwnerResolver, resolve_user_scope, a2a_pb2, Task, DEFAULT_LIST_TASKS_PAGE_SIZE, InvalidParamsError, decode_page_token, and encode_page_token.
    • Refactored __init__, _get_owner_tasks, save, get, list, and delete to incorporate owner resolution, multi-tenancy, and pagination logic for list.
  • src/a2a/server/tasks/push_notification_sender.py
    • Updated imports for Task, TaskArtifactUpdateEvent, and TaskStatusUpdateEvent to use Protobuf types.
    • Introduced PushNotificationEvent type alias.
    • Updated abstract method send_notification to accept task_id and PushNotificationEvent.
  • src/a2a/server/tasks/result_aggregator.py
    • Updated imports for Message, Task, TaskState, and TaskStatusUpdateEvent to use Protobuf types.
    • Updated consume_and_break_on_interrupt and _continue_consuming to pass Event objects to the event_callback.
  • src/a2a/server/tasks/task_manager.py
    • Updated imports for Message, Task, TaskArtifactUpdateEvent, and TaskStatusUpdateEvent to use Protobuf types.
    • Removed ServerError import and replaced its usage with InvalidParamsError directly.
    • Refactored save_task_event, _init_task_obj, and update_with_message to handle Protobuf messages.
  • src/a2a/server/tasks/task_store.py
    • Updated imports for ListTasksRequest, ListTasksResponse, and Task to use Protobuf types.
    • Added an abstract list method for retrieving multiple tasks.
  • src/a2a/server/tasks/task_updater.py
    • Updated imports for Timestamp, Artifact, Message, Part, Role, TaskState, TaskStatus, and TaskStatusUpdateEvent to use Protobuf types.
    • Refactored update_status to use Protobuf Timestamp and remove the final parameter.
    • Updated complete, failed, reject, submit, start_work, cancel, requires_input, requires_auth, and new_agent_message to use Protobuf TaskState and Role enum values.
  • src/a2a/types/init.py
    • Added a new __init__.py file to the src/a2a/types package, importing all proto-generated types and SDK-specific error types.
  • src/a2a/types/a2a_pb2.py
    • Added the Python Protobuf generated code for the A2A v1.0 protocol.
  • src/a2a/types/a2a_pb2_grpc.py
    • Renamed from src/a2a/grpc/a2a_pb2_grpc.py and updated to reflect v1.0 gRPC service definitions.
  • src/a2a/utils/constants.py
    • Removed EXTENDED_AGENT_CARD_PATH and PREV_AGENT_CARD_WELL_KNOWN_PATH.
    • Added PROTOCOL_VERSION_0_3, PROTOCOL_VERSION_1_0, PROTOCOL_VERSION_CURRENT, VERSION_HEADER, and DEFAULT_LIST_TASKS_PAGE_SIZE.
  • src/a2a/utils/errors.py
    • Added new A2A error types, A2AError as the base exception, JSON_RPC_ERROR_CODE_MAP for JSON-RPC error codes, and A2A_ERROR_REASONS for gRPC error reasons.
  • src/a2a/utils/helpers.py
    • Updated get_message_text to handle Protobuf Part types.
  • src/a2a/utils/proto_utils.py
    • Added a new file containing utility functions for converting between internal SDK types and Protobuf messages.
  • src/a2a/utils/task.py
    • Updated apply_history_length to use Protobuf types.
    • Added validate_history_length, validate_page_size, encode_page_token, and decode_page_token for task listing functionality.
Ignored Files
  • Ignored by pattern: .github/workflows/** (4)
    • .github/workflows/linter.yaml
    • .github/workflows/release-please.yml
    • .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.

Copy link
Copy Markdown
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 refactors the JSON-RPC FastAPI application by removing the generation and usage of the custom a2a.json OpenAPI specification. The changes are logical as the OpenAPI file was not compatible with the JSON-RPC protocol implementation. The modifications include removing the OpenAPI generation plugin from buf.gen.yaml, deleting the custom A2AFastAPI class that loaded the schema, and removing the a2a.json file itself. My review has identified one high-severity issue where a dangling reference in the OpenAPI configuration will break schema generation. I've also included a low-severity suggestion for a follow-up cleanup in a related script.

I am having trouble creating individual review comments. Click here to see my feedback.

src/a2a/server/apps/jsonrpc/fastapi_app.py (144)

high

Using FastAPI directly is the right direction after removing the custom A2AFastAPI class. However, this change has a side effect. The custom openapi() method that loaded a2a.json is now gone, but add_routes_to_app still sets openapi_extra on the RPC endpoint with a $ref to #/components/schemas/A2ARequest. Since a2a.json is removed, this reference is now dangling and will break the generated OpenAPI schema.

To resolve this, the openapi_extra argument in add_routes_to_app should be removed. Since that part of the file is not in this diff, you might need to include it in this PR to fix the issue completely. Alternatively, you could exclude the endpoint from the schema by adding include_in_schema=False to the app.post() call.

buf.gen.yaml (32-35)

low

This change correctly removes the OpenAPI v2 JSON generation. As a follow-up, you might want to clean up the scripts/gen_proto.sh script, which contains logic to find and rename the generated *.swagger.json file. That part of the script is now obsolete and will print a warning on every run.

@guglielmo-san guglielmo-san deleted the guglielmoc/remote_a2a_json branch March 17, 2026 13:43
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.

2 participants