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
Copy file name to clipboardExpand all lines: src/a2a/types/a2a_pydantic.py
+72-64Lines changed: 72 additions & 64 deletions
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,17 @@
2
2
3
3
from __future__ importannotations
4
4
5
-
fromdatetimeimportdatetime
6
5
fromenumimportEnum
6
+
fromtypingimportTYPE_CHECKING, Any
7
7
8
-
fromtypingimportAny
9
8
10
-
froma2a._baseimportA2ABaseModel
9
+
ifTYPE_CHECKING:
10
+
fromdatetimeimportdatetime
11
+
11
12
frompydanticimportField, field_serializer
12
13
14
+
froma2a._baseimportA2ABaseModel
15
+
13
16
14
17
classTaskState(str, Enum):
15
18
"""Defines the possible lifecycle states of a `Task`."""
@@ -66,7 +69,7 @@ class SendMessageConfiguration(A2ABaseModel):
66
69
67
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.')
68
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.')
69
-
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.')
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.")
70
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.')
71
74
72
75
defto_proto_json(self) ->dict:
@@ -81,7 +84,7 @@ class Part(A2ABaseModel):
81
84
metadata: dict[str, Any] =Field(default=None, description='Optional. metadata associated with this part.')
82
85
filename: str=Field(default='', description='An optional `filename` for the file (e.g., "document.pdf").')
83
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.')
"""Represents a distinct capability or function that an agent can perform."""
236
239
237
-
id: str=Field(..., description='A unique identifier for the agent\'s skill.')
240
+
id: str=Field(..., description="A unique identifier for the agent's skill.")
238
241
name: str=Field(..., description='A human-readable name for the skill.')
239
242
description: str=Field(..., description='A detailed description of the skill.')
240
-
tags: list[str] =Field(..., description='A set of keywords describing the skill\'s capabilities.')
243
+
tags: list[str] =Field(..., description="A set of keywords describing the skill's capabilities.")
241
244
examples: list[str] |None=Field(default=None, description='Example prompts or scenarios that this skill can handle.')
242
-
input_modes: list[str] |None=Field(default=None, description='The set of supported input media types for this skill, overriding the agent\'s defaults.')
243
-
output_modes: list[str] |None=Field(default=None, description='The set of supported output media types for this skill, overriding the agent\'s defaults.')
245
+
input_modes: list[str] |None=Field(default=None, description="The set of supported input media types for this skill, overriding the agent's defaults.")
246
+
output_modes: list[str] |None=Field(default=None, description="The set of supported output media types for this skill, overriding the agent's defaults.")
244
247
security_requirements: list[SecurityRequirement] |None=Field(default=None, description='Security schemes necessary for this skill.')
"""A self-describing manifest for an agent. It provides essential metadata including the agent's identity, capabilities, skills, supported communication methods, and security requirements. Next ID: 20"""
256
+
"""A self-describing manifest for an agent. It provides essential metadata including the agent's identity, capabilities, skills, supported communication methods, and security requirements. Next ID: 20."""
254
257
255
258
name: str=Field(..., description='A human readable name for the agent. Example: "Recipe Agent"')
256
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."')
@@ -278,7 +281,7 @@ class AgentExtension(A2ABaseModel):
278
281
279
282
uri: str=Field(default='', description='The unique URI identifying the extension.')
280
283
description: str=Field(default='', description='A human-readable description of how this agent uses the extension.')
281
-
required: bool=Field(default=False, description='If true, the client must understand and comply with the extension\'s requirements.')
284
+
required: bool=Field(default=False, description="If true, the client must understand and comply with the extension's requirements.")
"""Defines a security scheme that can be used to secure an agent's endpoints. This is a discriminated union type based on the OpenAPI 3.2 Security Scheme Object. See: https://spec.openapis.org/oas/v3.2.0.html#security-scheme-object"""
329
+
"""Defines a security scheme that can be used to secure an agent's endpoints. This is a discriminated union type based on the OpenAPI 3.2 Security Scheme Object. See: https://spec.openapis.org/oas/v3.2.0.html#security-scheme-object."""
@@ -389,7 +392,7 @@ class OpenIdConnectSecurityScheme(A2ABaseModel):
389
392
"""Defines a security scheme using OpenID Connect."""
390
393
391
394
description: str=Field(default='', description='An optional description for the security scheme.')
392
-
open_id_connect_url: str=Field(..., description='The [OpenID Connect Discovery URL](https://openid.net/specs/openid-connect-discovery-1_0.html) for the OIDC provider\'s metadata.')
395
+
open_id_connect_url: str=Field(..., description="The [OpenID Connect Discovery URL](https://openid.net/specs/openid-connect-discovery-1_0.html) for the OIDC provider's metadata.")
393
396
394
397
defto_proto_json(self) ->dict:
395
398
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -495,7 +498,7 @@ class GetTaskRequest(A2ABaseModel):
495
498
496
499
tenant: str=Field(default='', description='Optional. Tenant ID, provided as a path parameter.')
497
500
id: str=Field(..., description='The resource ID of the task to retrieve.')
498
-
history_length: int|None=Field(default=None, description='The maximum number of most recent messages from the task\'s history to retrieve. 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.')
501
+
history_length: int|None=Field(default=None, description="The maximum number of most recent messages from the task's history to retrieve. 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.")
499
502
500
503
defto_proto_json(self) ->dict:
501
504
"""Serialize to a ProtoJSON-compatible dict (camelCase keys, no None values)."""
@@ -511,7 +514,7 @@ class ListTasksRequest(A2ABaseModel):
511
514
status: TaskState=Field(default=None, description='Filter tasks by their current status state.')
512
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.')
513
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.')
514
-
history_length: int|None=Field(default=None, description='The maximum number of messages to include in each task\'s history.')
517
+
history_length: int|None=Field(default=None, description="The maximum number of messages to include in each task's history.")
515
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.')
516
519
include_artifacts: bool|None=Field(default=None, description='Whether to include artifacts in the returned tasks. Defaults to false to reduce payload size.')
0 commit comments