Skip to content

feat: Update A2A types from specification 🤖 #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 9 additions & 25 deletions src/a2a/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ class AgentSkill(A2ABaseModel):
"""
Supported media types for output.
"""
tags: list[str] = Field(
..., examples=[['cooking', 'customer support', 'billing']]
)
tags: list[str] = Field(..., examples=[['cooking', 'customer support', 'billing']])
"""
Set of tagwords describing classes of capabilities for this specific skill.
"""
Expand Down Expand Up @@ -1147,7 +1145,7 @@ class MessageSendConfiguration(A2ABaseModel):
Configuration for the send message request.
"""

acceptedOutputModes: list[str]
acceptedOutputModes: list[str] | None = None
"""
Accepted output modalities by the client.
"""
Expand Down Expand Up @@ -1273,9 +1271,7 @@ class Artifact(A2ABaseModel):


class DeleteTaskPushNotificationConfigResponse(
RootModel[
JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse
]
RootModel[JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse]
):
root: JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse
"""
Expand All @@ -1284,9 +1280,7 @@ class DeleteTaskPushNotificationConfigResponse(


class GetTaskPushNotificationConfigResponse(
RootModel[
JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse
]
RootModel[JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse]
):
root: JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse
"""
Expand All @@ -1295,9 +1289,7 @@ class GetTaskPushNotificationConfigResponse(


class ListTaskPushNotificationConfigResponse(
RootModel[
JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse
]
RootModel[JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse]
):
root: JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse
"""
Expand Down Expand Up @@ -1452,9 +1444,7 @@ class SendStreamingMessageRequest(A2ABaseModel):


class SetTaskPushNotificationConfigResponse(
RootModel[
JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse
]
RootModel[JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse]
):
root: JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse
"""
Expand Down Expand Up @@ -1507,9 +1497,7 @@ class TaskStatus(A2ABaseModel):
Additional status updates for client
"""
state: TaskState
timestamp: str | None = Field(
default=None, examples=['2023-10-27T10:00:00Z']
)
timestamp: str | None = Field(default=None, examples=['2023-10-27T10:00:00Z'])
"""
ISO 8601 datetime string when the status was recorded.
"""
Expand Down Expand Up @@ -1769,9 +1757,7 @@ class SendStreamingMessageSuccessResponse(A2ABaseModel):
"""


class CancelTaskResponse(
RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]
):
class CancelTaskResponse(RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]):
root: JSONRPCErrorResponse | CancelTaskSuccessResponse
"""
JSON-RPC response for the 'tasks/cancel' method.
Expand Down Expand Up @@ -1814,9 +1800,7 @@ class JSONRPCResponse(
"""


class SendMessageResponse(
RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]
):
class SendMessageResponse(RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]):
root: JSONRPCErrorResponse | SendMessageSuccessResponse
"""
JSON-RPC response model for the 'message/send' method.
Expand Down
2 changes: 1 addition & 1 deletion src/a2a/utils/proto_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def message_send_configuration(
if not config:
return a2a_pb2.SendMessageConfiguration()
return a2a_pb2.SendMessageConfiguration(
accepted_output_modes=list(config.acceptedOutputModes),
accepted_output_modes=config.acceptedOutputModes,
push_notification=ToProto.push_notification_config(
config.pushNotificationConfig
)
Expand Down
Loading