Conversation
## 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>
| _sym_db = _symbol_database.Default() | ||
|
|
||
|
|
||
| from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 |
|
|
||
|
|
||
| from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 | ||
| from google.api import client_pb2 as google_dot_api_dot_client__pb2 |
|
|
||
| from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 | ||
| from google.api import client_pb2 as google_dot_api_dot_client__pb2 | ||
| from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 |
| from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 | ||
| from google.api import client_pb2 as google_dot_api_dot_client__pb2 | ||
| from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 | ||
| from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 |
| from google.api import client_pb2 as google_dot_api_dot_client__pb2 | ||
| from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 | ||
| from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 | ||
| from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 |
| from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 | ||
| from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 | ||
| from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 | ||
| from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 |
| import logging | ||
|
|
||
| from datetime import datetime, timezone | ||
| from typing import Any, cast |
|
|
||
| from fastapi import FastAPI, HTTPException, Path, Request | ||
| from pydantic import BaseModel, ValidationError | ||
| from pydantic import BaseModel, ConfigDict, ValidationError |
| # Attempt to import the optional module | ||
| try: | ||
| from grpc.aio import Channel # pyright: ignore[reportAssignmentType] | ||
| from grpc.aio import Channel # type: ignore[reportMissingModuleSource] |
| from a2a.utils.constants import ( | ||
| TRANSPORT_HTTP_JSON, | ||
| TRANSPORT_GRPC, | ||
| TRANSPORT_JSONRPC, | ||
| ) |
Summary of ChangesHello @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 introduces a significant refactoring of the A2A SDK to standardize on Protocol Buffers for defining and handling core data types. This migration simplifies the codebase, improves type safety, and lays the groundwork for better cross-language compatibility. The changes span client and server components, updating data models, API signatures, and the build pipeline to align with the new Protobuf-centric architecture. Additionally, a new API for listing tasks has been added, and the AgentCard structure has been modernized. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a major and well-executed refactoring, migrating the project's data models from Pydantic to Protobuf. The changes are extensive, touching nearly every part of the codebase, including client/server logic, transports, and utility functions. This move establishes Protobuf as the single source of truth for types, which is a significant improvement for maintainability, consistency, and multi-language support. The overall implementation appears solid and consistent with the goals of the refactoring. My main concern, detailed in a specific comment, is the removal of the pre-commit configuration, which impacts the project's automated code quality checks.
I am having trouble creating individual review comments. Click here to see my feedback.
.pre-commit-config.yaml (1-82)
The complete removal of the .pre-commit-config.yaml file is a significant change, as it disables all automated pre-commit hooks for linting, formatting, and security checks. This could negatively impact code quality and consistency across the project. Was this removal intentional? If so, could you please provide some context on the new strategy for code quality enforcement? If this was an accident, the file should be restored.
Description
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.bash scripts/format.shfrom the repository root to format)Fixes #<issue_number_goes_here> 🦕