Skip to content

Commit 18506a4

Browse files
a2a-botholtskinner
andauthored
feat: Update A2A types from specification 🤖 (#319)
This PR updates `src/a2a/types.py` based on the latest `specification/json/a2a.json` from [a2aproject/A2A](a2aproject/A2A@6f1d17b). --------- Co-authored-by: Holt Skinner <holtskinner@google.com>
1 parent 5b98c32 commit 18506a4

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

src/a2a/types.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ class AgentSkill(A2ABaseModel):
133133
"""
134134
Supported media types for output.
135135
"""
136-
tags: list[str] = Field(
137-
..., examples=[['cooking', 'customer support', 'billing']]
138-
)
136+
tags: list[str] = Field(..., examples=[['cooking', 'customer support', 'billing']])
139137
"""
140138
Set of tagwords describing classes of capabilities for this specific skill.
141139
"""
@@ -1147,7 +1145,7 @@ class MessageSendConfiguration(A2ABaseModel):
11471145
Configuration for the send message request.
11481146
"""
11491147

1150-
acceptedOutputModes: list[str]
1148+
acceptedOutputModes: list[str] | None = None
11511149
"""
11521150
Accepted output modalities by the client.
11531151
"""
@@ -1273,9 +1271,7 @@ class Artifact(A2ABaseModel):
12731271

12741272

12751273
class DeleteTaskPushNotificationConfigResponse(
1276-
RootModel[
1277-
JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse
1278-
]
1274+
RootModel[JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse]
12791275
):
12801276
root: JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse
12811277
"""
@@ -1284,9 +1280,7 @@ class DeleteTaskPushNotificationConfigResponse(
12841280

12851281

12861282
class GetTaskPushNotificationConfigResponse(
1287-
RootModel[
1288-
JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse
1289-
]
1283+
RootModel[JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse]
12901284
):
12911285
root: JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse
12921286
"""
@@ -1295,9 +1289,7 @@ class GetTaskPushNotificationConfigResponse(
12951289

12961290

12971291
class ListTaskPushNotificationConfigResponse(
1298-
RootModel[
1299-
JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse
1300-
]
1292+
RootModel[JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse]
13011293
):
13021294
root: JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse
13031295
"""
@@ -1452,9 +1444,7 @@ class SendStreamingMessageRequest(A2ABaseModel):
14521444

14531445

14541446
class SetTaskPushNotificationConfigResponse(
1455-
RootModel[
1456-
JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse
1457-
]
1447+
RootModel[JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse]
14581448
):
14591449
root: JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse
14601450
"""
@@ -1507,9 +1497,7 @@ class TaskStatus(A2ABaseModel):
15071497
Additional status updates for client
15081498
"""
15091499
state: TaskState
1510-
timestamp: str | None = Field(
1511-
default=None, examples=['2023-10-27T10:00:00Z']
1512-
)
1500+
timestamp: str | None = Field(default=None, examples=['2023-10-27T10:00:00Z'])
15131501
"""
15141502
ISO 8601 datetime string when the status was recorded.
15151503
"""
@@ -1769,9 +1757,7 @@ class SendStreamingMessageSuccessResponse(A2ABaseModel):
17691757
"""
17701758

17711759

1772-
class CancelTaskResponse(
1773-
RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]
1774-
):
1760+
class CancelTaskResponse(RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]):
17751761
root: JSONRPCErrorResponse | CancelTaskSuccessResponse
17761762
"""
17771763
JSON-RPC response for the 'tasks/cancel' method.
@@ -1814,9 +1800,7 @@ class JSONRPCResponse(
18141800
"""
18151801

18161802

1817-
class SendMessageResponse(
1818-
RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]
1819-
):
1803+
class SendMessageResponse(RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]):
18201804
root: JSONRPCErrorResponse | SendMessageSuccessResponse
18211805
"""
18221806
JSON-RPC response model for the 'message/send' method.

src/a2a/utils/proto_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def message_send_configuration(
187187
if not config:
188188
return a2a_pb2.SendMessageConfiguration()
189189
return a2a_pb2.SendMessageConfiguration(
190-
accepted_output_modes=list(config.acceptedOutputModes),
190+
accepted_output_modes=config.acceptedOutputModes,
191191
push_notification=ToProto.push_notification_config(
192192
config.pushNotificationConfig
193193
)

0 commit comments

Comments
 (0)