You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: update proto2pydantic to v0.5.2 with proper type annotations
- Enum fields default to zero value (e.g., TaskState.TASK_STATE_UNSPECIFIED)
- Message fields properly annotated as | None
- Fixes all mypy and pyright type errors in generated code
Copy file name to clipboardExpand all lines: src/a2a/types/a2a_pydantic.py
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ class TaskPushNotificationConfig(A2ABaseModel):
56
56
task_id: str=Field(default='', description='The ID of the task this configuration is associated with.')
57
57
url: str=Field(..., description='The URL where the notification should be sent.')
58
58
token: str=Field(default='', description='A token unique for this task or session.')
59
-
authentication: AuthenticationInfo=Field(default=None, description='Authentication information required to send the notification.')
59
+
authentication: AuthenticationInfo|None=Field(default=None, description='Authentication information required to send the notification.')
60
60
61
61
defto_proto_json(self) ->dict:
62
62
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -68,7 +68,7 @@ class SendMessageConfiguration(A2ABaseModel):
68
68
"""Configuration of a send message request."""
69
69
70
70
accepted_output_modes: list[str] |None=Field(default=None, description='A list of media types the client is prepared to accept for response parts. Agents SHOULD use this to tailor their output.')
71
-
task_push_notification_config: TaskPushNotificationConfig=Field(default=None, description='Configuration for the agent to send push notifications for task updates. Task id should be empty when sending this configuration in a `SendMessage` request.')
71
+
task_push_notification_config: TaskPushNotificationConfig|None=Field(default=None, description='Configuration for the agent to send push notifications for task updates. Task id should be empty when sending this configuration in a `SendMessage` request.')
72
72
history_length: int|None=Field(default=None, description="The maximum number of most recent messages from the task's history to retrieve in the response. An unset value means the client does not impose any limit. A value of zero is a request to not include any messages. The server MUST NOT return more messages than the provided value, but MAY apply a lower limit.")
73
73
return_immediately: bool=Field(default=False, description='If `true`, the operation returns immediately after creating the task, even if processing is still in progress. If `false` (default), the operation MUST wait until the task reaches a terminal (`COMPLETED`, `FAILED`, `CANCELED`, `REJECTED`) or interrupted (`INPUT_REQUIRED`, `AUTH_REQUIRED`) state before returning.')
"""`Part` represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON)."""
83
83
84
-
metadata: dict[str, Any] =Field(default=None, description='Optional. metadata associated with this part.')
84
+
metadata: dict[str, Any] |None=Field(default=None, description='Optional. metadata associated with this part.')
85
85
filename: str=Field(default='', description='An optional `filename` for the file (e.g., "document.pdf").')
86
86
media_type: str=Field(default='', description='The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png"). This field is available for all part types.')
87
87
content: str|bytes|Any|None=None
@@ -101,7 +101,7 @@ class Message(A2ABaseModel):
101
101
task_id: str=Field(default='', description='Optional. The task id of the message. If set, the message will be associated with the given task.')
102
102
role: Role=Field(..., description='Identifies the sender of the message.')
103
103
parts: list[Part] =Field(..., description='Parts is the container of the message content.')
104
-
metadata: dict[str, Any] =Field(default=None, description='Optional. Any metadata to provide along with the message.')
104
+
metadata: dict[str, Any] |None=Field(default=None, description='Optional. Any metadata to provide along with the message.')
105
105
extensions: list[str] |None=Field(default=None, description='The URIs of extensions that are present or contributed to this Message.')
106
106
reference_task_ids: list[str] |None=Field(default=None, description='A list of task IDs that this message references for additional context.')
107
107
@@ -115,8 +115,8 @@ class TaskStatus(A2ABaseModel):
115
115
"""A container for the status of a task."""
116
116
117
117
state: TaskState=Field(..., description='The current state of this task.')
118
-
message: Message=Field(default=None, description='A message associated with the status.')
119
-
timestamp: datetime=Field(default=None, description='ISO 8601 Timestamp when the status was recorded. Example: "2023-10-27T10:00:00Z"')
118
+
message: Message|None=Field(default=None, description='A message associated with the status.')
119
+
timestamp: datetime|None=Field(default=None, description='ISO 8601 Timestamp when the status was recorded. Example: "2023-10-27T10:00:00Z"')
120
120
121
121
defto_proto_json(self) ->dict:
122
122
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -140,7 +140,7 @@ class Task(A2ABaseModel):
140
140
status: TaskStatus=Field(..., description='The current status of a `Task`, including `state` and a `message`.')
141
141
artifacts: list[Artifact] |None=Field(default=None, description='A set of output artifacts for a `Task`.')
142
142
history: list[Message] |None=Field(default=None, description='protolint:disable REPEATED_FIELD_NAMES_PLURALIZED The history of interactions from a `Task`.')
143
-
metadata: dict[str, Any] =Field(default=None, description='protolint:enable REPEATED_FIELD_NAMES_PLURALIZED A key/value object to store custom metadata about a task.')
143
+
metadata: dict[str, Any] |None=Field(default=None, description='protolint:enable REPEATED_FIELD_NAMES_PLURALIZED A key/value object to store custom metadata about a task.')
144
144
145
145
defto_proto_json(self) ->dict:
146
146
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -155,7 +155,7 @@ class Artifact(A2ABaseModel):
155
155
name: str=Field(default='', description='A human readable name for the artifact.')
156
156
description: str=Field(default='', description='Optional. A human readable description of the artifact.')
157
157
parts: list[Part] =Field(..., description='The content of the artifact. Must contain at least one part.')
158
-
metadata: dict[str, Any] =Field(default=None, description='Optional. Metadata included with the artifact.')
158
+
metadata: dict[str, Any] |None=Field(default=None, description='Optional. Metadata included with the artifact.')
159
159
extensions: list[str] |None=Field(default=None, description='The URIs of extensions that are present or contributed to this Artifact.')
160
160
161
161
defto_proto_json(self) ->dict:
@@ -170,7 +170,7 @@ class TaskStatusUpdateEvent(A2ABaseModel):
170
170
task_id: str=Field(..., description='The ID of the task that has changed.')
171
171
context_id: str=Field(..., description='The ID of the context that the task belongs to.')
172
172
status: TaskStatus=Field(..., description='The new status of the task.')
173
-
metadata: dict[str, Any] =Field(default=None, description='Optional. Metadata associated with the task update.')
173
+
metadata: dict[str, Any] |None=Field(default=None, description='Optional. Metadata associated with the task update.')
174
174
175
175
defto_proto_json(self) ->dict:
176
176
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -186,7 +186,7 @@ class TaskArtifactUpdateEvent(A2ABaseModel):
186
186
artifact: Artifact=Field(..., description='The artifact that was generated or updated.')
187
187
append: bool=Field(default=False, description='If true, the content of this artifact should be appended to a previously sent artifact with the same ID.')
188
188
last_chunk: bool=Field(default=False, description='If true, this is the final chunk of the artifact.')
189
-
metadata: dict[str, Any] =Field(default=None, description='Optional. Metadata associated with the artifact update.')
189
+
metadata: dict[str, Any] |None=Field(default=None, description='Optional. Metadata associated with the artifact update.')
190
190
191
191
defto_proto_json(self) ->dict:
192
192
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -258,7 +258,7 @@ class AgentCard(A2ABaseModel):
258
258
name: str=Field(..., description='A human readable name for the agent. Example: "Recipe Agent"')
259
259
description: str=Field(..., description='A human-readable description of the agent, assisting users and other agents in understanding its purpose. Example: "Agent that helps users with recipes and cooking."')
260
260
supported_interfaces: list[AgentInterface] =Field(..., description='Ordered list of supported interfaces. The first entry is preferred.')
261
-
provider: AgentProvider=Field(default=None, description='The service provider of the agent.')
261
+
provider: AgentProvider|None=Field(default=None, description='The service provider of the agent.')
262
262
version: str=Field(..., description='The version of the agent. Example: "1.0.0"')
263
263
documentation_url: str|None=Field(default=None, description='A URL providing additional documentation about the agent.')
264
264
capabilities: AgentCapabilities=Field(..., description='A2A Capability set supported by the agent.')
@@ -282,7 +282,7 @@ class AgentExtension(A2ABaseModel):
282
282
uri: str=Field(default='', description='The unique URI identifying the extension.')
283
283
description: str=Field(default='', description='A human-readable description of how this agent uses the extension.')
284
284
required: bool=Field(default=False, description="If true, the client must understand and comply with the extension's requirements.")
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -295,7 +295,7 @@ class AgentCardSignature(A2ABaseModel):
295
295
296
296
protected: str=Field(..., description='(-- api-linter: core::0140::reserved-words=disabled aip.dev/not-precedent: Backwards compatibility --) Required. The protected JWS header for the signature. This is always a base64url-encoded JSON object.')
297
297
signature: str=Field(..., description='Required. The computed signature, base64url-encoded.')
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -484,8 +484,8 @@ class SendMessageRequest(A2ABaseModel):
484
484
485
485
tenant: str=Field(default='', description='Optional. Tenant ID, provided as a path parameter.')
486
486
message: Message=Field(..., description='The message to send to the agent.')
487
-
configuration: SendMessageConfiguration=Field(default=None, description='Configuration for the send request.')
488
-
metadata: dict[str, Any] =Field(default=None, description='A flexible key-value map for passing additional context or parameters.')
487
+
configuration: SendMessageConfiguration|None=Field(default=None, description='Configuration for the send request.')
488
+
metadata: dict[str, Any] |None=Field(default=None, description='A flexible key-value map for passing additional context or parameters.')
489
489
490
490
defto_proto_json(self) ->dict:
491
491
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -511,11 +511,11 @@ class ListTasksRequest(A2ABaseModel):
511
511
512
512
tenant: str=Field(default='', description='Tenant ID, provided as a path parameter.')
513
513
context_id: str=Field(default='', description='Filter tasks by context ID to get tasks from a specific conversation or session.')
514
-
status: TaskState=Field(default=None, description='Filter tasks by their current status state.')
514
+
status: TaskState=Field(default=TaskState.TASK_STATE_UNSPECIFIED, description='Filter tasks by their current status state.')
515
515
page_size: int|None=Field(default=None, description='The maximum number of tasks to return. The service may return fewer than this value. If unspecified, at most 50 tasks will be returned. The minimum value is 1. The maximum value is 100.')
516
516
page_token: str=Field(default='', description='A page token, received from a previous `ListTasks` call. `ListTasksResponse.next_page_token`. Provide this to retrieve the subsequent page.')
517
517
history_length: int|None=Field(default=None, description="The maximum number of messages to include in each task's history.")
518
-
status_timestamp_after: datetime=Field(default=None, description='Filter tasks which have a status updated after the provided timestamp in ISO 8601 format (e.g., "2023-10-27T10:00:00Z"). Only tasks with a status timestamp time greater than or equal to this value will be returned.')
518
+
status_timestamp_after: datetime|None=Field(default=None, description='Filter tasks which have a status updated after the provided timestamp in ISO 8601 format (e.g., "2023-10-27T10:00:00Z"). Only tasks with a status timestamp time greater than or equal to this value will be returned.')
519
519
include_artifacts: bool|None=Field(default=None, description='Whether to include artifacts in the returned tasks. Defaults to false to reduce payload size.')
520
520
521
521
defto_proto_json(self) ->dict:
@@ -551,7 +551,7 @@ class CancelTaskRequest(A2ABaseModel):
551
551
552
552
tenant: str=Field(default='', description='Optional. Tenant ID, provided as a path parameter.')
553
553
id: str=Field(..., description='The resource ID of the task to cancel.')
554
-
metadata: dict[str, Any] =Field(default=None, description='A flexible key-value map for passing additional context or parameters.')
554
+
metadata: dict[str, Any] |None=Field(default=None, description='A flexible key-value map for passing additional context or parameters.')
555
555
556
556
defto_proto_json(self) ->dict:
557
557
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
0 commit comments