-
Notifications
You must be signed in to change notification settings - Fork 407
Expand file tree
/
Copy pathtypes.py
More file actions
2041 lines (1761 loc) · 53.7 KB
/
types.py
File metadata and controls
2041 lines (1761 loc) · 53.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# generated by datamodel-codegen:
# filename: https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/specification/json/a2a.json
from __future__ import annotations
from enum import Enum
from typing import Any, Literal
from pydantic import Field, RootModel
from a2a._base import A2ABaseModel
class A2A(RootModel[Any]):
root: Any
class In(str, Enum):
"""
The location of the API key.
"""
cookie = 'cookie'
header = 'header'
query = 'query'
class APIKeySecurityScheme(A2ABaseModel):
"""
Defines a security scheme using an API key.
"""
description: str | None = None
"""
An optional description for the security scheme.
"""
in_: In
"""
The location of the API key.
"""
name: str
"""
The name of the header, query, or cookie parameter to be used.
"""
type: Literal['apiKey'] = 'apiKey'
"""
The type of the security scheme. Must be 'apiKey'.
"""
class AgentCardSignature(A2ABaseModel):
"""
AgentCardSignature represents a JWS signature of an AgentCard.
This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
"""
header: dict[str, Any] | None = None
"""
The unprotected JWS header values.
"""
protected: str
"""
The protected JWS header for the signature. This is a Base64url-encoded
JSON object, as per RFC 7515.
"""
signature: str
"""
The computed signature, Base64url-encoded.
"""
class AgentExtension(A2ABaseModel):
"""
A declaration of a protocol extension supported by an Agent.
"""
description: str | None = None
"""
A human-readable description of how this agent uses the extension.
"""
params: dict[str, Any] | None = None
"""
Optional, extension-specific configuration parameters.
"""
required: bool | None = None
"""
If true, the client must understand and comply with the extension's requirements
to interact with the agent.
"""
uri: str
"""
The unique URI identifying the extension.
"""
class AgentInterface(A2ABaseModel):
"""
Declares a combination of a target URL and a transport protocol for interacting with the agent.
This allows agents to expose the same functionality over multiple transport mechanisms.
"""
transport: str = Field(..., examples=['JSONRPC', 'GRPC', 'HTTP+JSON'])
"""
The transport protocol supported at this URL.
"""
url: str = Field(
...,
examples=[
'https://api.example.com/a2a/v1',
'https://grpc.example.com/a2a',
'https://rest.example.com/v1',
],
)
"""
The URL where this interface is available. Must be a valid absolute HTTPS URL in production.
"""
class AgentProvider(A2ABaseModel):
"""
Represents the service provider of an agent.
"""
organization: str
"""
The name of the agent provider's organization.
"""
url: str
"""
A URL for the agent provider's website or relevant documentation.
"""
class AgentSkill(A2ABaseModel):
"""
Represents a distinct capability or function that an agent can perform.
"""
description: str
"""
A detailed description of the skill, intended to help clients or users
understand its purpose and functionality.
"""
examples: list[str] | None = Field(
default=None, examples=[['I need a recipe for bread']]
)
"""
Example prompts or scenarios that this skill can handle. Provides a hint to
the client on how to use the skill.
"""
id: str
"""
A unique identifier for the agent's skill.
"""
input_modes: list[str] | None = None
"""
The set of supported input MIME types for this skill, overriding the agent's defaults.
"""
name: str
"""
A human-readable name for the skill.
"""
output_modes: list[str] | None = None
"""
The set of supported output MIME types for this skill, overriding the agent's defaults.
"""
security: list[dict[str, list[str]]] | None = Field(
default=None, examples=[[{'google': ['oidc']}]]
)
"""
Security schemes necessary for the agent to leverage this skill.
As in the overall AgentCard.security, this list represents a logical OR of security
requirement objects. Each object is a set of security schemes that must be used together
(a logical AND).
"""
tags: list[str] = Field(
..., examples=[['cooking', 'customer support', 'billing']]
)
"""
A set of keywords describing the skill's capabilities.
"""
class AuthenticatedExtendedCardNotConfiguredError(A2ABaseModel):
"""
An A2A-specific error indicating that the agent does not have an Authenticated Extended Card configured
"""
code: Literal[-32007] = -32007
"""
The error code for when an authenticated extended card is not configured.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Authenticated Extended Card is not configured'
"""
The error message.
"""
class AuthorizationCodeOAuthFlow(A2ABaseModel):
"""
Defines configuration details for the OAuth 2.0 Authorization Code flow.
"""
authorization_url: str
"""
The authorization URL to be used for this flow.
This MUST be a URL and use TLS.
"""
refresh_url: str | None = None
"""
The URL to be used for obtaining refresh tokens.
This MUST be a URL and use TLS.
"""
scopes: dict[str, str]
"""
The available scopes for the OAuth2 security scheme. A map between the scope
name and a short description for it.
"""
token_url: str
"""
The token URL to be used for this flow.
This MUST be a URL and use TLS.
"""
class ClientCredentialsOAuthFlow(A2ABaseModel):
"""
Defines configuration details for the OAuth 2.0 Client Credentials flow.
"""
refresh_url: str | None = None
"""
The URL to be used for obtaining refresh tokens. This MUST be a URL.
"""
scopes: dict[str, str]
"""
The available scopes for the OAuth2 security scheme. A map between the scope
name and a short description for it.
"""
token_url: str
"""
The token URL to be used for this flow. This MUST be a URL.
"""
class ContentTypeNotSupportedError(A2ABaseModel):
"""
An A2A-specific error indicating an incompatibility between the requested
content types and the agent's capabilities.
"""
code: Literal[-32005] = -32005
"""
The error code for an unsupported content type.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Incompatible content types'
"""
The error message.
"""
class DataPart(A2ABaseModel):
"""
Represents a structured data segment (e.g., JSON) within a message or artifact.
"""
data: dict[str, Any]
"""
The structured data content.
"""
kind: Literal['data'] = 'data'
"""
The type of this part, used as a discriminator. Always 'data'.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with this part.
"""
class DeleteTaskPushNotificationConfigParams(A2ABaseModel):
"""
Defines parameters for deleting a specific push notification configuration for a task.
"""
id: str
"""
The unique identifier (e.g. UUID) of the task.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with the request.
"""
push_notification_config_id: str
"""
The ID of the push notification configuration to delete.
"""
class DeleteTaskPushNotificationConfigRequest(A2ABaseModel):
"""
Represents a JSON-RPC request for the `tasks/pushNotificationConfig/delete` method.
"""
id: str | int
"""
The identifier for this request.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
method: Literal['tasks/pushNotificationConfig/delete'] = (
'tasks/pushNotificationConfig/delete'
)
"""
The method name. Must be 'tasks/pushNotificationConfig/delete'.
"""
params: DeleteTaskPushNotificationConfigParams
"""
The parameters identifying the push notification configuration to delete.
"""
class DeleteTaskPushNotificationConfigSuccessResponse(A2ABaseModel):
"""
Represents a successful JSON-RPC response for the `tasks/pushNotificationConfig/delete` method.
"""
id: str | int | None = None
"""
The identifier established by the client.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
result: None
"""
The result is null on successful deletion.
"""
class FileBase(A2ABaseModel):
"""
Defines base properties for a file.
"""
mime_type: str | None = None
"""
The MIME type of the file (e.g., "application/pdf").
"""
name: str | None = None
"""
An optional name for the file (e.g., "document.pdf").
"""
class FileWithBytes(A2ABaseModel):
"""
Represents a file with its content provided directly as a base64-encoded string.
"""
bytes: str
"""
The base64-encoded content of the file.
"""
mime_type: str | None = None
"""
The MIME type of the file (e.g., "application/pdf").
"""
name: str | None = None
"""
An optional name for the file (e.g., "document.pdf").
"""
class FileWithUri(A2ABaseModel):
"""
Represents a file with its content located at a specific URI.
"""
mime_type: str | None = None
"""
The MIME type of the file (e.g., "application/pdf").
"""
name: str | None = None
"""
An optional name for the file (e.g., "document.pdf").
"""
uri: str
"""
A URL pointing to the file's content.
"""
class GetAuthenticatedExtendedCardRequest(A2ABaseModel):
"""
Represents a JSON-RPC request for the `agent/getAuthenticatedExtendedCard` method.
"""
id: str | int
"""
The identifier for this request.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
method: Literal['agent/getAuthenticatedExtendedCard'] = (
'agent/getAuthenticatedExtendedCard'
)
"""
The method name. Must be 'agent/getAuthenticatedExtendedCard'.
"""
class GetTaskPushNotificationConfigParams(A2ABaseModel):
"""
Defines parameters for fetching a specific push notification configuration for a task.
"""
id: str
"""
The unique identifier (e.g. UUID) of the task.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with the request.
"""
push_notification_config_id: str | None = None
"""
The ID of the push notification configuration to retrieve.
"""
class HTTPAuthSecurityScheme(A2ABaseModel):
"""
Defines a security scheme using HTTP authentication.
"""
bearer_format: str | None = None
"""
A hint to the client to identify how the bearer token is formatted (e.g., "JWT").
This is primarily for documentation purposes.
"""
description: str | None = None
"""
An optional description for the security scheme.
"""
scheme: str
"""
The name of the HTTP Authentication scheme to be used in the Authorization header,
as defined in RFC7235 (e.g., "Bearer").
This value should be registered in the IANA Authentication Scheme registry.
"""
type: Literal['http'] = 'http'
"""
The type of the security scheme. Must be 'http'.
"""
class ImplicitOAuthFlow(A2ABaseModel):
"""
Defines configuration details for the OAuth 2.0 Implicit flow.
"""
authorization_url: str
"""
The authorization URL to be used for this flow. This MUST be a URL.
"""
refresh_url: str | None = None
"""
The URL to be used for obtaining refresh tokens. This MUST be a URL.
"""
scopes: dict[str, str]
"""
The available scopes for the OAuth2 security scheme. A map between the scope
name and a short description for it.
"""
class InternalError(A2ABaseModel):
"""
An error indicating an internal error on the server.
"""
code: Literal[-32603] = -32603
"""
The error code for an internal server error.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Internal error'
"""
The error message.
"""
class InvalidAgentResponseError(A2ABaseModel):
"""
An A2A-specific error indicating that the agent returned a response that
does not conform to the specification for the current method.
"""
code: Literal[-32006] = -32006
"""
The error code for an invalid agent response.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Invalid agent response'
"""
The error message.
"""
class InvalidParamsError(A2ABaseModel):
"""
An error indicating that the method parameters are invalid.
"""
code: Literal[-32602] = -32602
"""
The error code for an invalid parameters error.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Invalid parameters'
"""
The error message.
"""
class InvalidRequestError(A2ABaseModel):
"""
An error indicating that the JSON sent is not a valid Request object.
"""
code: Literal[-32600] = -32600
"""
The error code for an invalid request.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Request payload validation error'
"""
The error message.
"""
class JSONParseError(A2ABaseModel):
"""
An error indicating that the server received invalid JSON.
"""
code: Literal[-32700] = -32700
"""
The error code for a JSON parse error.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Invalid JSON payload'
"""
The error message.
"""
class JSONRPCError(A2ABaseModel):
"""
Represents a JSON-RPC 2.0 Error object, included in an error response.
"""
code: int
"""
A number that indicates the error type that occurred.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str
"""
A string providing a short description of the error.
"""
class JSONRPCMessage(A2ABaseModel):
"""
Defines the base structure for any JSON-RPC 2.0 request, response, or notification.
"""
id: str | int | None = None
"""
A unique identifier established by the client. It must be a String, a Number, or null.
The server must reply with the same value in the response. This property is omitted for notifications.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
class JSONRPCRequest(A2ABaseModel):
"""
Represents a JSON-RPC 2.0 Request object.
"""
id: str | int | None = None
"""
A unique identifier established by the client. It must be a String, a Number, or null.
The server must reply with the same value in the response. This property is omitted for notifications.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
method: str
"""
A string containing the name of the method to be invoked.
"""
params: dict[str, Any] | None = None
"""
A structured value holding the parameter values to be used during the method invocation.
"""
class JSONRPCSuccessResponse(A2ABaseModel):
"""
Represents a successful JSON-RPC 2.0 Response object.
"""
id: str | int | None = None
"""
The identifier established by the client.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
result: Any
"""
The value of this member is determined by the method invoked on the Server.
"""
class ListTaskPushNotificationConfigParams(A2ABaseModel):
"""
Defines parameters for listing all push notification configurations associated with a task.
"""
id: str
"""
The unique identifier (e.g. UUID) of the task.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with the request.
"""
class ListTaskPushNotificationConfigRequest(A2ABaseModel):
"""
Represents a JSON-RPC request for the `tasks/pushNotificationConfig/list` method.
"""
id: str | int
"""
The identifier for this request.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
method: Literal['tasks/pushNotificationConfig/list'] = (
'tasks/pushNotificationConfig/list'
)
"""
The method name. Must be 'tasks/pushNotificationConfig/list'.
"""
params: ListTaskPushNotificationConfigParams
"""
The parameters identifying the task whose configurations are to be listed.
"""
class Role(str, Enum):
"""
Identifies the sender of the message. `user` for the client, `agent` for the service.
"""
agent = 'agent'
user = 'user'
class MethodNotFoundError(A2ABaseModel):
"""
An error indicating that the requested method does not exist or is not available.
"""
code: Literal[-32601] = -32601
"""
The error code for a method not found error.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Method not found'
"""
The error message.
"""
class MutualTLSSecurityScheme(A2ABaseModel):
"""
Defines a security scheme using mTLS authentication.
"""
description: str | None = None
"""
An optional description for the security scheme.
"""
type: Literal['mutualTLS'] = 'mutualTLS'
"""
The type of the security scheme. Must be 'mutualTLS'.
"""
class OpenIdConnectSecurityScheme(A2ABaseModel):
"""
Defines a security scheme using OpenID Connect.
"""
description: str | None = None
"""
An optional description for the security scheme.
"""
open_id_connect_url: str
"""
The OpenID Connect Discovery URL for the OIDC provider's metadata.
"""
type: Literal['openIdConnect'] = 'openIdConnect'
"""
The type of the security scheme. Must be 'openIdConnect'.
"""
class PartBase(A2ABaseModel):
"""
Defines base properties common to all message or artifact parts.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with this part.
"""
class PasswordOAuthFlow(A2ABaseModel):
"""
Defines configuration details for the OAuth 2.0 Resource Owner Password flow.
"""
refresh_url: str | None = None
"""
The URL to be used for obtaining refresh tokens. This MUST be a URL.
"""
scopes: dict[str, str]
"""
The available scopes for the OAuth2 security scheme. A map between the scope
name and a short description for it.
"""
token_url: str
"""
The token URL to be used for this flow. This MUST be a URL.
"""
class PushNotificationAuthenticationInfo(A2ABaseModel):
"""
Defines authentication details for a push notification endpoint.
"""
credentials: str | None = None
"""
Optional credentials required by the push notification endpoint.
"""
schemes: list[str]
"""
A list of supported authentication schemes (e.g., 'Basic', 'Bearer').
"""
class PushNotificationConfig(A2ABaseModel):
"""
Defines the configuration for setting up push notifications for task updates.
"""
authentication: PushNotificationAuthenticationInfo | None = None
"""
Optional authentication details for the agent to use when calling the notification URL.
"""
id: str | None = None
"""
A unique identifier (e.g. UUID) for the push notification configuration, set by the client
to support multiple notification callbacks.
"""
token: str | None = None
"""
A unique token for this task or session to validate incoming push notifications.
"""
url: str
"""
The callback URL where the agent should send push notifications.
"""
class PushNotificationNotSupportedError(A2ABaseModel):
"""
An A2A-specific error indicating that the agent does not support push notifications.
"""
code: Literal[-32003] = -32003
"""
The error code for when push notifications are not supported.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Push Notification is not supported'
"""
The error message.
"""
class SecuritySchemeBase(A2ABaseModel):
"""
Defines base properties shared by all security scheme objects.
"""
description: str | None = None
"""
An optional description for the security scheme.
"""
class TaskIdParams(A2ABaseModel):
"""
Defines parameters containing a task ID, used for simple task operations.
"""
id: str
"""
The unique identifier (e.g. UUID) of the task.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with the request.
"""
class TaskNotCancelableError(A2ABaseModel):
"""
An A2A-specific error indicating that the task is in a state where it cannot be canceled.
"""
code: Literal[-32002] = -32002
"""
The error code for a task that cannot be canceled.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Task cannot be canceled'
"""
The error message.
"""
class TaskNotFoundError(A2ABaseModel):
"""
An A2A-specific error indicating that the requested task ID was not found.
"""
code: Literal[-32001] = -32001
"""
The error code for a task not found error.
"""
data: Any | None = None
"""
A primitive or structured value containing additional information about the error.
This may be omitted.
"""
message: str | None = 'Task not found'
"""
The error message.
"""
class TaskPushNotificationConfig(A2ABaseModel):
"""
A container associating a push notification configuration with a specific task.
"""
push_notification_config: PushNotificationConfig
"""
The push notification configuration for this task.
"""
task_id: str
"""
The unique identifier (e.g. UUID) of the task.
"""
class TaskQueryParams(A2ABaseModel):
"""
Defines parameters for querying a task, with an option to limit history length.
"""
history_length: int | None = None
"""
The number of most recent messages from the task's history to retrieve.
"""
id: str
"""
The unique identifier (e.g. UUID) of the task.
"""
metadata: dict[str, Any] | None = None
"""
Optional metadata associated with the request.
"""
class TaskResubscriptionRequest(A2ABaseModel):
"""
Represents a JSON-RPC request for the `tasks/resubscribe` method, used to resume a streaming connection.
"""
id: str | int
"""
The identifier for this request.
"""
jsonrpc: Literal['2.0'] = '2.0'
"""
The version of the JSON-RPC protocol. MUST be exactly "2.0".
"""
method: Literal['tasks/resubscribe'] = 'tasks/resubscribe'
"""
The method name. Must be 'tasks/resubscribe'.
"""
params: TaskIdParams
"""
The parameters identifying the task to resubscribe to.
"""
class TaskState(str, Enum):
"""
Defines the lifecycle states of a Task.
"""
submitted = 'submitted'
working = 'working'
input_required = 'input-required'
completed = 'completed'
canceled = 'canceled'
failed = 'failed'
rejected = 'rejected'