refactor: Migrate to the latest A2A proto schema#129
Merged
Conversation
Signed-off-by: Eden Reich <eden.reich@gmail.com>
…ypes to types.go Those types are deprecated due to latest A2A project schema, so I'm keeping them to avoid breaking changes and I'll be using the generated types gradually. Signed-off-by: Eden Reich <eden.reich@gmail.com>
Signed-off-by: Eden Reich <eden.reich@gmail.com>
…ial) - Fix agent_streamable_test.go to use message ID prefix check instead of Kind field - Replace map[string]any Parts with types.CreateTextPart in some tests - Fix AgentCard.URL field to use *string (pointer) type - Add helper functions for creating pointers (stringPtr, boolPtr) - Fix TaskState type conversions to use string() casting - Create shared test_helpers_test.go for common test utilities Co-authored-by: Eden Reich <edenreich@users.noreply.github.com>
- Replace all map[string]any Parts with types.CreateTextPart - Fix all TaskState assignments to use string() casting - Fix Part type assertions to use struct field access instead of map Co-authored-by: Eden Reich <edenreich@users.noreply.github.com>
- Convert all TaskState enum assignments to use string() casting - Fix TaskState comparisons in assertions Co-authored-by: Eden Reich <edenreich@users.noreply.github.com>
Signed-off-by: Eden Reich <eden.reich@gmail.com>
Signed-off-by: Eden Reich <eden.reich@gmail.com>
Contributor
Author
|
I think those are way too many changes for review and the changes are not breaking too much, they actually consolidate the implementation, so I'll just merge and worst case will fix whatever requires a fix. I've went through all the examples and everything seem to work as expected. Future changes would be more easy to sync directly from A2A project proto file. |
ig-semantic-release-bot bot
added a commit
that referenced
this pull request
Dec 30, 2025
## [0.17.0](v0.16.2...v0.17.0) (2025-12-30) ### ✨ Features * **metadata:** Add token usage and execution metrics to A2A task responses ([#127](#127)) ([1f49f97](1f49f97)), closes [#126](#126) ### ♻️ Improvements * Migrate to the latest A2A proto schema ([#129](#129)) ([02c2bc1](02c2bc1)) ### 👷 CI * Bump generator tool to 0.2.2 ([fc58ab9](fc58ab9)) ### 🔧 Miscellaneous * **deps:** Bump claude-code 2.0.65 to 2.0.76 ([47f0a79](47f0a79)) * **deps:** Bump generator tool ([659aec4](659aec4)) * **deps:** Update dependencies and infer configuration ([#128](#128)) ([0fa9d33](0fa9d33)) * **deps:** Update infer config ([76589af](76589af))
Contributor
|
🎉 This PR is included in version 0.17.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR completes the migration of the Agent Development Kit (ADK) to the A2A (Agent-to-Agent) Protocol Schema v0.3.0. The migration addresses breaking changes in the protocol specification, including the new Part type system, typed role constants, and state-based task management.
Breaking Changes
1. Part Type System Migration
Before (Interface-based discriminated union):
After (Struct with optional fields and helper functions):
2. Role Type System
Before (String literals):
After (Typed constants):
Note: A2A protocol has NO
ROLE_SYSTEM- system prompts are agent configuration, not messages.3. Input-Required State Management
Before (Checking non-existent
Kindfield):After (State-based checking):
4. Message Converter Role Mapping
Established proper bidirectional mapping between A2A protocol (typed roles) and OpenAI SDK (string roles):
A2A → SDK:
types.RoleUser→sdk.Usertypes.RoleAgent→sdk.Assistant(orsdk.Tooliftool_call_idpresent)types.RoleUnspecified→sdk.UserSDK → A2A:
"user"→types.RoleUser"assistant","tool","system"→types.RoleAgentFiles Changed
Core SDK Files
server/utils/message_converter.go: Updated role mapping between A2A and OpenAI SDK formats, removed legacy string literal supportExample Files (30+ files updated)
AI-Powered Examples:
examples/ai-powered/client/main.goexamples/ai-powered/server/main.goexamples/ai-powered-streaming/client/main.goexamples/ai-powered-streaming/server/main.goInput-Required Examples:
examples/input-required/non-streaming/client/main.goexamples/input-required/non-streaming/server/main.goexamples/input-required/streaming/client/main.goexamples/input-required/streaming/server/main.goArtifact Examples:
examples/artifacts-autonomous-tool/server/main.goexamples/artifacts-filesystem/server/main.goexamples/artifacts-minio/server/main.goexamples/artifacts-with-default-handlers/server/main.goOther Examples:
examples/callbacks/server/main.goexamples/default-handlers/server/main.goexamples/minimal/server/main.goexamples/queue-storage/in-memory/server/main.goexamples/queue-storage/redis/server/main.goexamples/static-agent-card/server/main.goexamples/streaming/client/main.goexamples/streaming/server/main.goexamples/tls-server/server/main.goConfiguration:
.markdownlint-cli2.jsonc: Updated line length from 80 to 140 charactersKey Fixes
1. Part Construction
types.CreateTextPart(text)types.CreateDataPart(data, mimeType)types.CreateFilePart(file)2. Part Access Patterns
if part.Text != nil { *part.Text }if part.File != nil { part.File.Name }if part.Data != nil { part.Data.MimeType }3. Role Usage
4. Input-Required Flow
task.Status.Message5. Streaming Event Processing
task.Status.Message != nilinstead oftask.Kind == "task"statusUpdate.TaskID != ""instead ofstatusUpdate.Kind != "status-update"Testing
All verification steps completed successfully:
✅ Code Quality:
✅ Tests:
✅ Examples:
Migration Guide
For users upgrading to A2A v0.3.0:
Update Part construction:
Update Role usage:
Update Part access:
Update input-required handling:
TODOs