a2a 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.agent-docs/ROADMAP.md +423 -0
  3. data/.agent-docs/index.md +124 -0
  4. data/.agent-docs/llms.txt +318 -0
  5. data/.agent-docs/specification/json.json +2575 -0
  6. data/.agent-docs/specification.md +1924 -0
  7. data/.agent-docs/topics/a2a-and-mcp.md +132 -0
  8. data/.agent-docs/topics/agent-discovery.md +96 -0
  9. data/.agent-docs/topics/enterprise-ready.md +139 -0
  10. data/.agent-docs/topics/extensions.md +260 -0
  11. data/.agent-docs/topics/key-concepts.md +99 -0
  12. data/.agent-docs/topics/life-of-a-task.md +255 -0
  13. data/.agent-docs/topics/streaming-and-async.md +111 -0
  14. data/.agent-docs/topics/what-is-a2a.md +218 -0
  15. data/.agent-docs/tutorials/index.md +31 -0
  16. data/.agent-docs/tutorials/python/1-introduction.md +32 -0
  17. data/.agent-docs/tutorials/python/2-setup.md +55 -0
  18. data/.agent-docs/tutorials/python/3-agent-skills-and-card.md +48 -0
  19. data/.agent-docs/tutorials/python/4-agent-executor.md +57 -0
  20. data/.agent-docs/tutorials/python/5-start-server.md +55 -0
  21. data/.agent-docs/tutorials/python/6-interact-with-server.md +95 -0
  22. data/.agent-docs/tutorials/python/7-streaming-and-multiturn.md +97 -0
  23. data/.agent-docs/tutorials/python/8-next-steps.md +40 -0
  24. data/.agent-docs/types.ts +1544 -0
  25. data/.agent-docs/types_mapping.md +196 -0
  26. data/.claude/commands/gemfile/update.md +52 -0
  27. data/.claude/settings.local.json +23 -0
  28. data/.tool-versions +1 -1
  29. data/CHANGELOG.md +68 -1
  30. data/CLAUDE.md +98 -0
  31. data/README.md +20 -14
  32. data/Rakefile +1 -3
  33. data/WARP.md +115 -0
  34. data/lib/a2a/extensions/json_deserialization.rb +1 -3
  35. data/lib/a2a/types/agent_capabilities.rb +3 -0
  36. data/lib/a2a/types/agent_card.rb +49 -17
  37. data/lib/a2a/types/agent_card_signature.rb +17 -0
  38. data/lib/a2a/types/agent_extension.rb +19 -0
  39. data/lib/a2a/types/agent_interface.rb +13 -0
  40. data/lib/a2a/types/agent_provider.rb +2 -2
  41. data/lib/a2a/types/agent_skill.rb +11 -4
  42. data/lib/a2a/types/api_key_security_scheme.rb +15 -0
  43. data/lib/a2a/types/artifact.rb +10 -15
  44. data/lib/a2a/types/authenticated_extended_card_not_configured_error.rb +43 -0
  45. data/lib/a2a/types/authorization_code_oauth_flow.rb +22 -0
  46. data/lib/a2a/types/cancel_task_request.rb +5 -2
  47. data/lib/a2a/types/cancel_task_response.rb +3 -3
  48. data/lib/a2a/types/client_credentials_oauth_flow.rb +16 -0
  49. data/lib/a2a/types/content_type_not_supported_error.rb +42 -0
  50. data/lib/a2a/types/data_part.rb +5 -8
  51. data/lib/a2a/types/delete_task_push_notification_config_params.rb +9 -0
  52. data/lib/a2a/types/delete_task_push_notification_config_request.rb +18 -0
  53. data/lib/a2a/types/delete_task_push_notification_config_response.rb +13 -0
  54. data/lib/a2a/types/error.rb +19 -0
  55. data/lib/a2a/types/error_codes.rb +6 -0
  56. data/lib/a2a/types/file_base.rb +12 -0
  57. data/lib/a2a/types/file_part.rb +7 -9
  58. data/lib/a2a/types/file_with_bytes.rb +9 -0
  59. data/lib/a2a/types/file_with_uri.rb +9 -0
  60. data/lib/a2a/types/get_authenticated_extended_card_request.rb +15 -0
  61. data/lib/a2a/types/get_authenticated_extended_card_response.rb +13 -0
  62. data/lib/a2a/types/get_task_push_notification_config_params.rb +9 -0
  63. data/lib/a2a/types/get_task_push_notification_config_request.rb +21 -0
  64. data/lib/a2a/types/get_task_push_notification_request.rb +5 -2
  65. data/lib/a2a/types/get_task_push_notification_response.rb +4 -4
  66. data/lib/a2a/types/get_task_request.rb +5 -2
  67. data/lib/a2a/types/get_task_response.rb +3 -3
  68. data/lib/a2a/types/http_auth_security_scheme.rb +18 -0
  69. data/lib/a2a/types/implicit_oauth_flow.rb +16 -0
  70. data/lib/a2a/types/invalid_agent_response_error.rb +41 -0
  71. data/lib/a2a/types/list_task_push_notification_config_params.rb +8 -0
  72. data/lib/a2a/types/list_task_push_notification_config_request.rb +18 -0
  73. data/lib/a2a/types/list_task_push_notification_config_response.rb +13 -0
  74. data/lib/a2a/types/message.rb +24 -4
  75. data/lib/a2a/types/message_send_configuration.rb +20 -0
  76. data/lib/a2a/types/message_send_params.rb +16 -0
  77. data/lib/a2a/types/mutual_tls_security_scheme.rb +9 -0
  78. data/lib/a2a/types/oauth2_security_scheme.rb +16 -0
  79. data/lib/a2a/types/oauth_flows.rb +20 -0
  80. data/lib/a2a/types/openid_connect_security_scheme.rb +12 -0
  81. data/lib/a2a/types/part.rb +2 -1
  82. data/lib/a2a/types/part_base.rb +9 -0
  83. data/lib/a2a/types/password_oauth_flow.rb +16 -0
  84. data/lib/a2a/types/push_notification_authentication_info.rb +12 -0
  85. data/lib/a2a/types/push_notification_config.rb +11 -6
  86. data/lib/a2a/types/push_notification_not_supported_error.rb +37 -10
  87. data/lib/a2a/types/request.rb +15 -0
  88. data/lib/a2a/types/security_scheme.rb +11 -0
  89. data/lib/a2a/types/security_scheme_base.rb +9 -0
  90. data/lib/a2a/types/send_message_request.rb +18 -0
  91. data/lib/a2a/types/send_message_response.rb +13 -0
  92. data/lib/a2a/types/send_streaming_message_request.rb +18 -0
  93. data/lib/a2a/types/send_streaming_message_response.rb +15 -0
  94. data/lib/a2a/types/set_task_push_notification_config_request.rb +18 -0
  95. data/lib/a2a/types/set_task_push_notification_request.rb +5 -2
  96. data/lib/a2a/types/set_task_push_notification_response.rb +4 -4
  97. data/lib/a2a/types/task.rb +15 -11
  98. data/lib/a2a/types/task_artifact_update_event.rb +18 -7
  99. data/lib/a2a/types/task_not_cancelable_error.rb +37 -10
  100. data/lib/a2a/types/task_not_found_error.rb +37 -10
  101. data/lib/a2a/types/task_resubscription_request.rb +5 -2
  102. data/lib/a2a/types/task_state.rb +2 -1
  103. data/lib/a2a/types/task_status_update_event.rb +13 -6
  104. data/lib/a2a/types/text_part.rb +5 -8
  105. data/lib/a2a/types/transport_protocol.rb +6 -0
  106. data/lib/a2a/types/unsupported_operation_error.rb +37 -10
  107. data/lib/a2a/types.rb +13 -0
  108. data/lib/a2a/version.rb +1 -1
  109. data/lib/a2a.rb +15 -5
  110. metadata +101 -19
  111. data/lib/a2a/types/agent_authentication.rb +0 -13
  112. data/lib/a2a/types/authentication_info.rb +0 -9
  113. data/lib/a2a/types/file_content.rb +0 -18
  114. data/lib/a2a/types/internal_error.rb +0 -15
  115. data/lib/a2a/types/invalid_params_error.rb +0 -15
  116. data/lib/a2a/types/invalid_request_error.rb +0 -15
  117. data/lib/a2a/types/json_parse_error.rb +0 -15
  118. data/lib/a2a/types/jsonrpc_error.rb +0 -15
  119. data/lib/a2a/types/jsonrpc_message.rb +0 -12
  120. data/lib/a2a/types/jsonrpc_request.rb +0 -15
  121. data/lib/a2a/types/jsonrpc_response.rb +0 -12
  122. data/lib/a2a/types/method_not_found_error.rb +0 -15
  123. data/lib/a2a/types/send_task_request.rb +0 -15
  124. data/lib/a2a/types/send_task_response.rb +0 -13
  125. data/lib/a2a/types/send_task_streaming_request.rb +0 -15
  126. data/lib/a2a/types/send_task_streaming_response.rb +0 -15
  127. data/lib/a2a/types/task_send_params.rb +0 -26
@@ -0,0 +1,1544 @@
1
+ /**
2
+ * @title A2A (Agent2Agent) Protocol
3
+ * @description This file defines the interfaces and types for the Agent2Agent (A2A) specification.
4
+ * The A2A specification facilitates interoperability between AI agents and clients.
5
+ */
6
+
7
+ // --8<-- [start:AgentProvider]
8
+ /**
9
+ * Represents the service provider of an agent.
10
+ *
11
+ * @TJS-examples [{ "organization": "Google", "url": "https://ai.google.dev" }]
12
+ */
13
+ export interface AgentProvider {
14
+ /** The name of the agent provider's organization. */
15
+ organization: string;
16
+ /** A URL for the agent provider's website or relevant documentation. */
17
+ url: string;
18
+ }
19
+ // --8<-- [end:AgentProvider]
20
+
21
+ // --8<-- [start:AgentCapabilities]
22
+ /**
23
+ * Defines optional capabilities supported by an agent.
24
+ */
25
+ export interface AgentCapabilities {
26
+ /** Indicates if the agent supports Server-Sent Events (SSE) for streaming responses. */
27
+ streaming?: boolean;
28
+ /** Indicates if the agent supports sending push notifications for asynchronous task updates. */
29
+ pushNotifications?: boolean;
30
+ /** Indicates if the agent provides a history of state transitions for a task. */
31
+ stateTransitionHistory?: boolean;
32
+ /** A list of protocol extensions supported by the agent. */
33
+ extensions?: AgentExtension[];
34
+ }
35
+ // --8<-- [end:AgentCapabilities]
36
+
37
+ // --8<-- [start:AgentExtension]
38
+ /**
39
+ * A declaration of a protocol extension supported by an Agent.
40
+ *
41
+ * @TJS-examples [{"uri": "https://developers.google.com/identity/protocols/oauth2", "description": "Google OAuth 2.0 authentication", "required": false}]
42
+ */
43
+ export interface AgentExtension {
44
+ /** The unique URI identifying the extension. */
45
+ uri: string;
46
+ /** A human-readable description of how this agent uses the extension. */
47
+ description?: string;
48
+ /**
49
+ * If true, the client must understand and comply with the extension's requirements
50
+ * to interact with the agent.
51
+ */
52
+ required?: boolean;
53
+ /** Optional, extension-specific configuration parameters. */
54
+ params?: { [key: string]: any };
55
+ }
56
+ // --8<-- [end:AgentExtension]
57
+
58
+ // --8<-- [start:SecurityScheme]
59
+ /**
60
+ * Defines a security scheme that can be used to secure an agent's endpoints.
61
+ * This is a discriminated union type based on the OpenAPI 3.0 Security Scheme Object.
62
+ *
63
+ * @see {@link https://swagger.io/specification/#security-scheme-object}
64
+ */
65
+ export type SecurityScheme =
66
+ | APIKeySecurityScheme
67
+ | HTTPAuthSecurityScheme
68
+ | OAuth2SecurityScheme
69
+ | OpenIdConnectSecurityScheme
70
+ | MutualTLSSecurityScheme;
71
+ // --8<-- [end:SecurityScheme]
72
+
73
+ // --8<-- [start:SecuritySchemeBase]
74
+ /**
75
+ * Defines base properties shared by all security scheme objects.
76
+ */
77
+ export interface SecuritySchemeBase {
78
+ /** An optional description for the security scheme. */
79
+ description?: string;
80
+ }
81
+ // --8<-- [end:SecuritySchemeBase]
82
+
83
+ // --8<-- [start:APIKeySecurityScheme]
84
+ /**
85
+ * Defines a security scheme using an API key.
86
+ */
87
+ export interface APIKeySecurityScheme extends SecuritySchemeBase {
88
+ /** The type of the security scheme. Must be 'apiKey'. */
89
+ readonly type: "apiKey";
90
+ /** The location of the API key. */
91
+ readonly in: "query" | "header" | "cookie";
92
+ /** The name of the header, query, or cookie parameter to be used. */
93
+ name: string;
94
+ }
95
+ // --8<-- [end:APIKeySecurityScheme]
96
+
97
+ // --8<-- [start:HTTPAuthSecurityScheme]
98
+ /**
99
+ * Defines a security scheme using HTTP authentication.
100
+ */
101
+ export interface HTTPAuthSecurityScheme extends SecuritySchemeBase {
102
+ /** The type of the security scheme. Must be 'http'. */
103
+ readonly type: "http";
104
+ /**
105
+ * The name of the HTTP Authentication scheme to be used in the Authorization header,
106
+ * as defined in RFC7235 (e.g., "Bearer").
107
+ * This value should be registered in the IANA Authentication Scheme registry.
108
+ */
109
+ scheme: string;
110
+ /**
111
+ * A hint to the client to identify how the bearer token is formatted (e.g., "JWT").
112
+ * This is primarily for documentation purposes.
113
+ */
114
+ bearerFormat?: string;
115
+ }
116
+ // --8<-- [end:HTTPAuthSecurityScheme]
117
+
118
+ // --8<-- [start:MutualTLSSecurityScheme]
119
+ /**
120
+ * Defines a security scheme using mTLS authentication.
121
+ */
122
+ export interface MutualTLSSecurityScheme extends SecuritySchemeBase {
123
+ /** The type of the security scheme. Must be 'mutualTLS'. */
124
+ readonly type: "mutualTLS";
125
+ }
126
+ // --8<-- [end:MutualTLSSecurityScheme]
127
+
128
+ // --8<-- [start:OAuth2SecurityScheme]
129
+ /**
130
+ * Defines a security scheme using OAuth 2.0.
131
+ */
132
+ export interface OAuth2SecurityScheme extends SecuritySchemeBase {
133
+ /** The type of the security scheme. Must be 'oauth2'. */
134
+ readonly type: "oauth2";
135
+ /** An object containing configuration information for the supported OAuth 2.0 flows. */
136
+ flows: OAuthFlows;
137
+ /**
138
+ * URL to the oauth2 authorization server metadata
139
+ * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
140
+ */
141
+ oauth2MetadataUrl?: string;
142
+ }
143
+ // --8<-- [end:OAuth2SecurityScheme]
144
+
145
+ // --8<-- [start:OpenIdConnectSecurityScheme]
146
+ /**
147
+ * Defines a security scheme using OpenID Connect.
148
+ */
149
+ export interface OpenIdConnectSecurityScheme extends SecuritySchemeBase {
150
+ /** The type of the security scheme. Must be 'openIdConnect'. */
151
+ readonly type: "openIdConnect";
152
+ /**
153
+ * The OpenID Connect Discovery URL for the OIDC provider's metadata.
154
+ * @see {@link https://openid.net/specs/openid-connect-discovery-1_0.html}
155
+ */
156
+ openIdConnectUrl: string;
157
+ }
158
+ // --8<-- [end:OpenIdConnectSecurityScheme]
159
+
160
+ // --8<-- [start:OAuthFlows]
161
+ /**
162
+ * Defines the configuration for the supported OAuth 2.0 flows.
163
+ */
164
+ export interface OAuthFlows {
165
+ /** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. */
166
+ authorizationCode?: AuthorizationCodeOAuthFlow;
167
+ /** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. */
168
+ clientCredentials?: ClientCredentialsOAuthFlow;
169
+ /** Configuration for the OAuth Implicit flow. */
170
+ implicit?: ImplicitOAuthFlow;
171
+ /** Configuration for the OAuth Resource Owner Password flow. */
172
+ password?: PasswordOAuthFlow;
173
+ }
174
+ // --8<-- [end:OAuthFlows]
175
+
176
+ // --8<-- [start:AuthorizationCodeOAuthFlow]
177
+ /**
178
+ * Defines configuration details for the OAuth 2.0 Authorization Code flow.
179
+ */
180
+ export interface AuthorizationCodeOAuthFlow {
181
+ /**
182
+ * The authorization URL to be used for this flow.
183
+ * This MUST be a URL and use TLS.
184
+ */
185
+ authorizationUrl: string;
186
+ /**
187
+ * The token URL to be used for this flow.
188
+ * This MUST be a URL and use TLS.
189
+ */
190
+ tokenUrl: string;
191
+ /**
192
+ * The URL to be used for obtaining refresh tokens.
193
+ * This MUST be a URL and use TLS.
194
+ */
195
+ refreshUrl?: string;
196
+ /**
197
+ * The available scopes for the OAuth2 security scheme. A map between the scope
198
+ * name and a short description for it.
199
+ */
200
+ scopes: { [name: string]: string };
201
+ }
202
+ // --8<-- [end:AuthorizationCodeOAuthFlow]
203
+
204
+ // --8<-- [start:ClientCredentialsOAuthFlow]
205
+ /**
206
+ * Defines configuration details for the OAuth 2.0 Client Credentials flow.
207
+ */
208
+ export interface ClientCredentialsOAuthFlow {
209
+ /**
210
+ * The token URL to be used for this flow. This MUST be a URL.
211
+ */
212
+ tokenUrl: string;
213
+ /**
214
+ * The URL to be used for obtaining refresh tokens. This MUST be a URL.
215
+ */
216
+ refreshUrl?: string;
217
+ /**
218
+ * The available scopes for the OAuth2 security scheme. A map between the scope
219
+ * name and a short description for it.
220
+ */
221
+ scopes: { [name: string]: string };
222
+ }
223
+ // --8<-- [end:ClientCredentialsOAuthFlow]
224
+
225
+ // --8<-- [start:ImplicitOAuthFlow]
226
+ /**
227
+ * Defines configuration details for the OAuth 2.0 Implicit flow.
228
+ */
229
+ export interface ImplicitOAuthFlow {
230
+ /**
231
+ * The authorization URL to be used for this flow. This MUST be a URL.
232
+ */
233
+ authorizationUrl: string;
234
+ /**
235
+ * The URL to be used for obtaining refresh tokens. This MUST be a URL.
236
+ */
237
+ refreshUrl?: string;
238
+ /**
239
+ * The available scopes for the OAuth2 security scheme. A map between the scope
240
+ * name and a short description for it.
241
+ */
242
+ scopes: { [name: string]: string };
243
+ }
244
+ // --8<-- [end:ImplicitOAuthFlow]
245
+
246
+ // --8<-- [start:PasswordOAuthFlow]
247
+ /**
248
+ * Defines configuration details for the OAuth 2.0 Resource Owner Password flow.
249
+ */
250
+ export interface PasswordOAuthFlow {
251
+ /**
252
+ * The token URL to be used for this flow. This MUST be a URL.
253
+ */
254
+ tokenUrl: string;
255
+ /**
256
+ * The URL to be used for obtaining refresh tokens. This MUST be a URL.
257
+ */
258
+ refreshUrl?: string;
259
+ /**
260
+ * The available scopes for the OAuth2 security scheme. A map between the scope
261
+ * name and a short description for it.
262
+ */
263
+ scopes: { [name: string]: string };
264
+ }
265
+ // --8<-- [end:PasswordOAuthFlow]
266
+
267
+ // --8<-- [start:AgentSkill]
268
+ /**
269
+ * Represents a distinct capability or function that an agent can perform.
270
+ */
271
+ export interface AgentSkill {
272
+ /** A unique identifier for the agent's skill. */
273
+ id: string;
274
+ /** A human-readable name for the skill. */
275
+ name: string;
276
+ /**
277
+ * A detailed description of the skill, intended to help clients or users
278
+ * understand its purpose and functionality.
279
+ */
280
+ description: string;
281
+ /**
282
+ * A set of keywords describing the skill's capabilities.
283
+ *
284
+ * @TJS-examples [["cooking", "customer support", "billing"]]
285
+ */
286
+ tags: string[];
287
+ /**
288
+ * Example prompts or scenarios that this skill can handle. Provides a hint to
289
+ * the client on how to use the skill.
290
+ *
291
+ * @TJS-examples [["I need a recipe for bread"]]
292
+ */
293
+ examples?: string[];
294
+ /**
295
+ * The set of supported input MIME types for this skill, overriding the agent's defaults.
296
+ */
297
+ inputModes?: string[];
298
+ /**
299
+ * The set of supported output MIME types for this skill, overriding the agent's defaults.
300
+ */
301
+ outputModes?: string[];
302
+ /**
303
+ * Security schemes necessary for the agent to leverage this skill.
304
+ * As in the overall AgentCard.security, this list represents a logical OR of security
305
+ * requirement objects. Each object is a set of security schemes that must be used together
306
+ * (a logical AND).
307
+ *
308
+ * @TJS-examples [[{"google": ["oidc"]}]]
309
+ */
310
+ security?: { [scheme: string]: string[] }[];
311
+ }
312
+ // --8<-- [end:AgentSkill]
313
+
314
+ // --8<-- [start:TransportProtocol]
315
+ /**
316
+ * Supported A2A transport protocols.
317
+ */
318
+ export enum TransportProtocol {
319
+ JSONRPC = "JSONRPC", // JSON-RPC 2.0 over HTTP (mandatory)
320
+ GRPC = "GRPC", // gRPC over HTTP/2 (optional)
321
+ HTTP_JSON = "HTTP+JSON", // REST-style HTTP with JSON (optional)
322
+ }
323
+ // --8<-- [end:TransportProtocol]
324
+
325
+ // --8<-- [start:AgentInterface]
326
+ /**
327
+ * Declares a combination of a target URL and a transport protocol for interacting with the agent.
328
+ * This allows agents to expose the same functionality over multiple transport mechanisms.
329
+ */
330
+ export interface AgentInterface {
331
+ /**
332
+ * The URL where this interface is available. Must be a valid absolute HTTPS URL in production.
333
+ * @TJS-examples ["https://api.example.com/a2a/v1", "https://grpc.example.com/a2a", "https://rest.example.com/v1"]
334
+ */
335
+ url: string;
336
+ /**
337
+ * The transport protocol supported at this URL.
338
+ *
339
+ * @TJS-examples ["JSONRPC", "GRPC", "HTTP+JSON"]
340
+ */
341
+ transport: TransportProtocol | string;
342
+ }
343
+ // --8<-- [end:AgentInterface]
344
+
345
+ // --8<-- [start:AgentCardSignature]
346
+ /**
347
+ * AgentCardSignature represents a JWS signature of an AgentCard.
348
+ * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
349
+ */
350
+ export interface AgentCardSignature {
351
+ /**
352
+ * The protected JWS header for the signature. This is a Base64url-encoded
353
+ * JSON object, as per RFC 7515.
354
+ */
355
+ protected: string;
356
+ /** The computed signature, Base64url-encoded. */
357
+ signature: string;
358
+ /** The unprotected JWS header values. */
359
+ header?: { [key: string]: any };
360
+ }
361
+ // --8<-- [end:AgentCardSignature]
362
+
363
+ // --8<-- [start:AgentCard]
364
+ /**
365
+ * The AgentCard is a self-describing manifest for an agent. It provides essential
366
+ * metadata including the agent's identity, capabilities, skills, supported
367
+ * communication methods, and security requirements.
368
+ */
369
+ export interface AgentCard {
370
+ /**
371
+ * The version of the A2A protocol this agent supports.
372
+ * @default "0.3.0"
373
+ */
374
+ protocolVersion: string;
375
+ /**
376
+ * A human-readable name for the agent.
377
+ *
378
+ * @TJS-examples ["Recipe Agent"]
379
+ */
380
+ name: string;
381
+ /**
382
+ * A human-readable description of the agent, assisting users and other agents
383
+ * in understanding its purpose.
384
+ *
385
+ * @TJS-examples ["Agent that helps users with recipes and cooking."]
386
+ */
387
+ description: string;
388
+ /**
389
+ * The preferred endpoint URL for interacting with the agent.
390
+ * This URL MUST support the transport specified by 'preferredTransport'.
391
+ *
392
+ * @TJS-examples ["https://api.example.com/a2a/v1"]
393
+ */
394
+ url: string;
395
+ /**
396
+ * The transport protocol for the preferred endpoint (the main 'url' field).
397
+ * If not specified, defaults to 'JSONRPC'.
398
+ *
399
+ * IMPORTANT: The transport specified here MUST be available at the main 'url'.
400
+ * This creates a binding between the main URL and its supported transport protocol.
401
+ * Clients should prefer this transport and URL combination when both are supported.
402
+ *
403
+ * @default "JSONRPC"
404
+ * @TJS-examples ["JSONRPC", "GRPC", "HTTP+JSON"]
405
+ */
406
+ preferredTransport?: TransportProtocol | string;
407
+ /**
408
+ * A list of additional supported interfaces (transport and URL combinations).
409
+ * This allows agents to expose multiple transports, potentially at different URLs.
410
+ *
411
+ * Best practices:
412
+ * - SHOULD include all supported transports for completeness
413
+ * - SHOULD include an entry matching the main 'url' and 'preferredTransport'
414
+ * - MAY reuse URLs if multiple transports are available at the same endpoint
415
+ * - MUST accurately declare the transport available at each URL
416
+ *
417
+ * Clients can select any interface from this list based on their transport capabilities
418
+ * and preferences. This enables transport negotiation and fallback scenarios.
419
+ */
420
+ additionalInterfaces?: AgentInterface[];
421
+ /** An optional URL to an icon for the agent. */
422
+ iconUrl?: string;
423
+ /** Information about the agent's service provider. */
424
+ provider?: AgentProvider;
425
+ /**
426
+ * The agent's own version number. The format is defined by the provider.
427
+ *
428
+ * @TJS-examples ["1.0.0"]
429
+ */
430
+ version: string;
431
+ /** An optional URL to the agent's documentation. */
432
+ documentationUrl?: string;
433
+ /** A declaration of optional capabilities supported by the agent. */
434
+ capabilities: AgentCapabilities;
435
+ /**
436
+ * A declaration of the security schemes available to authorize requests. The key is the
437
+ * scheme name. Follows the OpenAPI 3.0 Security Scheme Object.
438
+ */
439
+ securitySchemes?: { [scheme: string]: SecurityScheme };
440
+ /**
441
+ * A list of security requirement objects that apply to all agent interactions. Each object
442
+ * lists security schemes that can be used. Follows the OpenAPI 3.0 Security Requirement Object.
443
+ * This list can be seen as an OR of ANDs. Each object in the list describes one possible
444
+ * set of security requirements that must be present on a request. This allows specifying,
445
+ * for example, "callers must either use OAuth OR an API Key AND mTLS."
446
+ *
447
+ * @TJS-examples [[{"oauth": ["read"]}, {"api-key": [], "mtls": []}]]
448
+ */
449
+ security?: { [scheme: string]: string[] }[];
450
+ /**
451
+ * Default set of supported input MIME types for all skills, which can be
452
+ * overridden on a per-skill basis.
453
+ */
454
+ defaultInputModes: string[];
455
+ /**
456
+ * Default set of supported output MIME types for all skills, which can be
457
+ * overridden on a per-skill basis.
458
+ */
459
+ defaultOutputModes: string[];
460
+ /** The set of skills, or distinct capabilities, that the agent can perform. */
461
+ skills: AgentSkill[];
462
+ /**
463
+ * If true, the agent can provide an extended agent card with additional details
464
+ * to authenticated users. Defaults to false.
465
+ */
466
+ supportsAuthenticatedExtendedCard?: boolean;
467
+ /** JSON Web Signatures computed for this AgentCard. */
468
+ signatures?: AgentCardSignature[];
469
+ }
470
+ // --8<-- [end:AgentCard]
471
+
472
+ // --8<-- [start:Task]
473
+ /**
474
+ * Represents a single, stateful operation or conversation between a client and an agent.
475
+ */
476
+ export interface Task {
477
+ /** A unique identifier (e.g. UUID) for the task, generated by the server for a new task. */
478
+ id: string;
479
+ /**
480
+ * A server-generated unique identifier (e.g. UUID) for maintaining context across multiple related tasks or interactions.
481
+ */
482
+ contextId: string;
483
+ /** The current status of the task, including its state and a descriptive message. */
484
+ status: TaskStatus;
485
+ /** An array of messages exchanged during the task, representing the conversation history. */
486
+ history?: Message[];
487
+ /** A collection of artifacts generated by the agent during the execution of the task. */
488
+ artifacts?: Artifact[];
489
+ /** Optional metadata for extensions. The key is an extension-specific identifier. */
490
+ metadata?: {
491
+ [key: string]: any;
492
+ };
493
+ /** The type of this object, used as a discriminator. Always 'task' for a Task. */
494
+ readonly kind: "task";
495
+ }
496
+ // --8<-- [end:Task]
497
+
498
+ // --8<-- [start:TaskStatus]
499
+ /**
500
+ * Represents the status of a task at a specific point in time.
501
+ */
502
+ export interface TaskStatus {
503
+ /** The current state of the task's lifecycle. */
504
+ state: TaskState;
505
+ /** An optional, human-readable message providing more details about the current status. */
506
+ message?: Message;
507
+ /**
508
+ * An ISO 8601 datetime string indicating when this status was recorded.
509
+ *
510
+ * @TJS-examples ["2023-10-27T10:00:00Z"]
511
+ */
512
+ timestamp?: string;
513
+ }
514
+ // --8<-- [end:TaskStatus]
515
+
516
+ // --8<-- [start:TaskStatusUpdateEvent]
517
+ /**
518
+ * An event sent by the agent to notify the client of a change in a task's status.
519
+ * This is typically used in streaming or subscription models.
520
+ */
521
+ export interface TaskStatusUpdateEvent {
522
+ /**
523
+ * The ID of the task that was updated.
524
+ */
525
+ taskId: string;
526
+ /**
527
+ * The context ID associated with the task.
528
+ */
529
+ contextId: string;
530
+ /** The type of this event, used as a discriminator. Always 'status-update'. */
531
+ readonly kind: "status-update";
532
+ /** The new status of the task. */
533
+ status: TaskStatus;
534
+ /** If true, this is the final event in the stream for this interaction. */
535
+ final: boolean;
536
+ /** Optional metadata for extensions. */
537
+ metadata?: {
538
+ [key: string]: any;
539
+ };
540
+ }
541
+ // --8<-- [end:TaskStatusUpdateEvent]
542
+
543
+ // --8<-- [start:TaskArtifactUpdateEvent]
544
+ /**
545
+ * An event sent by the agent to notify the client that an artifact has been
546
+ * generated or updated. This is typically used in streaming models.
547
+ */
548
+ export interface TaskArtifactUpdateEvent {
549
+ /**
550
+ * The ID of the task this artifact belongs to.
551
+ */
552
+ taskId: string;
553
+ /**
554
+ * The context ID associated with the task.
555
+ */
556
+ contextId: string;
557
+ /** The type of this event, used as a discriminator. Always 'artifact-update'. */
558
+ readonly kind: "artifact-update";
559
+ /** The artifact that was generated or updated. */
560
+ artifact: Artifact;
561
+ /** If true, the content of this artifact should be appended to a previously sent artifact with the same ID. */
562
+ append?: boolean;
563
+ /** If true, this is the final chunk of the artifact. */
564
+ lastChunk?: boolean;
565
+ /** Optional metadata for extensions. */
566
+ metadata?: {
567
+ [key: string]: any;
568
+ };
569
+ }
570
+ // --8<-- [end:TaskArtifactUpdateEvent]
571
+
572
+ // --8<-- [start:TaskIdParams]
573
+ /**
574
+ * Defines parameters containing a task ID, used for simple task operations.
575
+ */
576
+ export interface TaskIdParams {
577
+ /**
578
+ * The unique identifier (e.g. UUID) of the task.
579
+ */
580
+ id: string;
581
+ /** Optional metadata associated with the request. */
582
+ metadata?: {
583
+ [key: string]: any;
584
+ };
585
+ }
586
+ // --8<-- [end:TaskIdParams]
587
+
588
+ // --8<-- [start:TaskQueryParams]
589
+ /**
590
+ * Defines parameters for querying a task, with an option to limit history length.
591
+ */
592
+ export interface TaskQueryParams extends TaskIdParams {
593
+ /** The number of most recent messages from the task's history to retrieve. */
594
+ historyLength?: number;
595
+ }
596
+ // --8<-- [end:TaskQueryParams]
597
+
598
+ // --8<-- [start:GetTaskPushNotificationConfigParams]
599
+ /**
600
+ * Defines parameters for fetching a specific push notification configuration for a task.
601
+ */
602
+ export interface GetTaskPushNotificationConfigParams extends TaskIdParams {
603
+ /**
604
+ * The ID of the push notification configuration to retrieve.
605
+ */
606
+ pushNotificationConfigId?: string;
607
+ }
608
+ // --8<-- [end:GetTaskPushNotificationConfigParams]
609
+
610
+ // --8<-- [start:ListTaskPushNotificationConfigParams]
611
+ /**
612
+ * Defines parameters for listing all push notification configurations associated with a task.
613
+ */
614
+ export interface ListTaskPushNotificationConfigParams extends TaskIdParams {}
615
+ // --8<-- [end:ListTaskPushNotificationConfigParams]
616
+
617
+ // --8<-- [start:DeleteTaskPushNotificationConfigParams]
618
+ /**
619
+ * Defines parameters for deleting a specific push notification configuration for a task.
620
+ */
621
+ export interface DeleteTaskPushNotificationConfigParams extends TaskIdParams {
622
+ /**
623
+ * The ID of the push notification configuration to delete.
624
+ */
625
+ pushNotificationConfigId: string;
626
+ }
627
+ // --8<-- [end:DeleteTaskPushNotificationConfigParams]
628
+
629
+ // --8<-- [start:MessageSendConfiguration]
630
+ /**
631
+ * Defines configuration options for a `message/send` or `message/stream` request.
632
+ */
633
+ export interface MessageSendConfiguration {
634
+ /** A list of output MIME types the client is prepared to accept in the response. */
635
+ acceptedOutputModes?: string[];
636
+ /** The number of most recent messages from the task's history to retrieve in the response. */
637
+ historyLength?: number;
638
+ /** Configuration for the agent to send push notifications for updates after the initial response. */
639
+ pushNotificationConfig?: PushNotificationConfig;
640
+ /** If true, the client will wait for the task to complete. The server may reject this if the task is long-running. */
641
+ blocking?: boolean;
642
+ }
643
+ // --8<-- [end:MessageSendConfiguration]
644
+
645
+ // --8<-- [start:MessageSendParams]
646
+ /**
647
+ * Defines the parameters for a request to send a message to an agent. This can be used
648
+ * to create a new task, continue an existing one, or restart a task.
649
+ */
650
+ export interface MessageSendParams {
651
+ /** The message object being sent to the agent. */
652
+ message: Message;
653
+ /** Optional configuration for the send request. */
654
+ configuration?: MessageSendConfiguration;
655
+ /** Optional metadata for extensions. */
656
+ metadata?: {
657
+ [key: string]: any;
658
+ };
659
+ }
660
+ // --8<-- [end:MessageSendParams]
661
+
662
+ // --8<-- [start:TaskState]
663
+ /**
664
+ * Defines the lifecycle states of a Task.
665
+ */
666
+ export enum TaskState {
667
+ /** The task has been submitted and is awaiting execution. */
668
+ Submitted = "submitted",
669
+ /** The agent is actively working on the task. */
670
+ Working = "working",
671
+ /** The task is paused and waiting for input from the user. */
672
+ InputRequired = "input-required",
673
+ /** The task has been successfully completed. */
674
+ Completed = "completed",
675
+ /** The task has been canceled by the user. */
676
+ Canceled = "canceled",
677
+ /** The task failed due to an error during execution. */
678
+ Failed = "failed",
679
+ /** The task was rejected by the agent and was not started. */
680
+ Rejected = "rejected",
681
+ /** The task requires authentication to proceed. */
682
+ AuthRequired = "auth-required",
683
+ /** The task is in an unknown or indeterminate state. */
684
+ Unknown = "unknown",
685
+ }
686
+ // --8<-- [end:TaskState]
687
+
688
+ // --8<-- [start:Artifact]
689
+ /**
690
+ * Represents a file, data structure, or other resource generated by an agent during a task.
691
+ */
692
+ export interface Artifact {
693
+ /**
694
+ * A unique identifier (e.g. UUID) for the artifact within the scope of the task.
695
+ */
696
+ artifactId: string;
697
+ /** An optional, human-readable name for the artifact. */
698
+ name?: string;
699
+ /** An optional, human-readable description of the artifact. */
700
+ description?: string;
701
+ /** An array of content parts that make up the artifact. */
702
+ parts: Part[];
703
+ /** Optional metadata for extensions. The key is an extension-specific identifier. */
704
+ metadata?: {
705
+ [key: string]: any;
706
+ };
707
+ /** The URIs of extensions that are relevant to this artifact. */
708
+ extensions?: string[];
709
+ }
710
+ // --8<-- [end:Artifact]
711
+
712
+ // --8<-- [start:Message]
713
+ /**
714
+ * Represents a single message in the conversation between a user and an agent.
715
+ */
716
+ export interface Message {
717
+ /** Identifies the sender of the message. `user` for the client, `agent` for the service. */
718
+ readonly role: "user" | "agent";
719
+ /**
720
+ * An array of content parts that form the message body. A message can be
721
+ * composed of multiple parts of different types (e.g., text and files).
722
+ */
723
+ parts: Part[];
724
+ /** Optional metadata for extensions. The key is an extension-specific identifier. */
725
+ metadata?: {
726
+ [key: string]: any;
727
+ };
728
+ /** The URIs of extensions that are relevant to this message. */
729
+ extensions?: string[];
730
+ /**
731
+ * A list of other task IDs that this message references for additional context.
732
+ */
733
+ referenceTaskIds?: string[];
734
+ /**
735
+ * A unique identifier for the message, typically a UUID, generated by the sender.
736
+ */
737
+ messageId: string;
738
+ /**
739
+ * The ID of the task this message is part of. Can be omitted for the first message of a new task.
740
+ */
741
+ taskId?: string;
742
+ /**
743
+ * The context ID for this message, used to group related interactions.
744
+ */
745
+ contextId?: string;
746
+ /** The type of this object, used as a discriminator. Always 'message' for a Message. */
747
+ readonly kind: "message";
748
+ }
749
+ // --8<-- [end:Message]
750
+
751
+ // --8<-- [start:PartBase]
752
+ /**
753
+ * Defines base properties common to all message or artifact parts.
754
+ */
755
+ export interface PartBase {
756
+ /** Optional metadata associated with this part. */
757
+ metadata?: {
758
+ [key: string]: any;
759
+ };
760
+ }
761
+ // --8<-- [end:PartBase]
762
+
763
+ // --8<-- [start:TextPart]
764
+ /**
765
+ * Represents a text segment within a message or artifact.
766
+ */
767
+ export interface TextPart extends PartBase {
768
+ /** The type of this part, used as a discriminator. Always 'text'. */
769
+ readonly kind: "text";
770
+ /** The string content of the text part. */
771
+ text: string;
772
+ }
773
+ // --8<-- [end:TextPart]
774
+
775
+ // --8<-- [start:FileBase]
776
+ /**
777
+ * Defines base properties for a file.
778
+ */
779
+ export interface FileBase {
780
+ /** An optional name for the file (e.g., "document.pdf"). */
781
+ name?: string;
782
+ /** The MIME type of the file (e.g., "application/pdf"). */
783
+ mimeType?: string;
784
+ }
785
+ // --8<-- [end:FileBase]
786
+
787
+ // --8<-- [start:FileWithBytes]
788
+ /**
789
+ * Represents a file with its content provided directly as a base64-encoded string.
790
+ */
791
+ export interface FileWithBytes extends FileBase {
792
+ /** The base64-encoded content of the file. */
793
+ bytes: string;
794
+ /** The `uri` property must be absent when `bytes` is present. */
795
+ uri?: never;
796
+ }
797
+ // --8<-- [end:FileWithBytes]
798
+
799
+ // --8<-- [start:FileWithUri]
800
+ /**
801
+ * Represents a file with its content located at a specific URI.
802
+ */
803
+ export interface FileWithUri extends FileBase {
804
+ /** A URL pointing to the file's content. */
805
+ uri: string;
806
+ /** The `bytes` property must be absent when `uri` is present. */
807
+ bytes?: never;
808
+ }
809
+ // --8<-- [end:FileWithUri]
810
+
811
+ // --8<-- [start:FilePart]
812
+ /**
813
+ * Represents a file segment within a message or artifact. The file content can be
814
+ * provided either directly as bytes or as a URI.
815
+ */
816
+ export interface FilePart extends PartBase {
817
+ /** The type of this part, used as a discriminator. Always 'file'. */
818
+ readonly kind: "file";
819
+ /** The file content, represented as either a URI or as base64-encoded bytes. */
820
+ file: FileWithBytes | FileWithUri;
821
+ }
822
+ // --8<-- [end:FilePart]
823
+
824
+ // --8<-- [start:DataPart]
825
+ /**
826
+ * Represents a structured data segment (e.g., JSON) within a message or artifact.
827
+ */
828
+ export interface DataPart extends PartBase {
829
+ /** The type of this part, used as a discriminator. Always 'data'. */
830
+ readonly kind: "data";
831
+ /** The structured data content. */
832
+ data: {
833
+ [key: string]: any;
834
+ };
835
+ }
836
+ // --8<-- [end:DataPart]
837
+
838
+ // --8<-- [start:Part]
839
+ /**
840
+ * A discriminated union representing a part of a message or artifact, which can
841
+ * be text, a file, or structured data.
842
+ */
843
+ export type Part = TextPart | FilePart | DataPart;
844
+ // --8<-- [end:Part]
845
+
846
+ // --8<-- [start:PushNotificationAuthenticationInfo]
847
+ /**
848
+ * Defines authentication details for a push notification endpoint.
849
+ */
850
+ export interface PushNotificationAuthenticationInfo {
851
+ /** A list of supported authentication schemes (e.g., 'Basic', 'Bearer'). */
852
+ schemes: string[];
853
+ /** Optional credentials required by the push notification endpoint. */
854
+ credentials?: string;
855
+ }
856
+ // --8<-- [end:PushNotificationAuthenticationInfo]
857
+
858
+ // --8<-- [start:PushNotificationConfig]
859
+ /**
860
+ * Defines the configuration for setting up push notifications for task updates.
861
+ */
862
+ export interface PushNotificationConfig {
863
+ /**
864
+ * A unique identifier (e.g. UUID) for the push notification configuration, set by the client
865
+ * to support multiple notification callbacks.
866
+ */
867
+ id?: string;
868
+ /** The callback URL where the agent should send push notifications. */
869
+ url: string;
870
+ /** A unique token for this task or session to validate incoming push notifications. */
871
+ token?: string;
872
+ /** Optional authentication details for the agent to use when calling the notification URL. */
873
+ authentication?: PushNotificationAuthenticationInfo;
874
+ }
875
+ // --8<-- [end:PushNotificationConfig]
876
+
877
+ // --8<-- [start:TaskPushNotificationConfig]
878
+ /**
879
+ * A container associating a push notification configuration with a specific task.
880
+ */
881
+ export interface TaskPushNotificationConfig {
882
+ /**
883
+ * The unique identifier (e.g. UUID) of the task.
884
+ */
885
+ taskId: string;
886
+ /** The push notification configuration for this task. */
887
+ pushNotificationConfig: PushNotificationConfig;
888
+ }
889
+ // --8<-- [end:TaskPushNotificationConfig]
890
+
891
+ // --8<-- [start:JSONRPCMessage]
892
+ /**
893
+ * Defines the base structure for any JSON-RPC 2.0 request, response, or notification.
894
+ */
895
+ export interface JSONRPCMessage {
896
+ /**
897
+ * The version of the JSON-RPC protocol. MUST be exactly "2.0".
898
+ */
899
+ readonly jsonrpc: "2.0";
900
+ /**
901
+ * A unique identifier established by the client. It must be a String, a Number, or null.
902
+ * The server must reply with the same value in the response. This property is omitted for notifications.
903
+ *
904
+ * @nullable
905
+ */
906
+ id?: number | string | null;
907
+ }
908
+ // --8<-- [end:JSONRPCMessage]
909
+
910
+ // --8<-- [start:JSONRPCRequest]
911
+ /**
912
+ * Represents a JSON-RPC 2.0 Request object.
913
+ */
914
+ export interface JSONRPCRequest extends JSONRPCMessage {
915
+ /**
916
+ * A string containing the name of the method to be invoked.
917
+ */
918
+ method: string;
919
+ /**
920
+ * A structured value holding the parameter values to be used during the method invocation.
921
+ */
922
+ params?: { [key: string]: any };
923
+ }
924
+ // --8<-- [end:JSONRPCRequest]
925
+
926
+ // --8<-- [start:JSONRPCError]
927
+ /**
928
+ * Represents a JSON-RPC 2.0 Error object, included in an error response.
929
+ */
930
+ export interface JSONRPCError {
931
+ /**
932
+ * A number that indicates the error type that occurred.
933
+ */
934
+ code: number;
935
+ /**
936
+ * A string providing a short description of the error.
937
+ */
938
+ message: string;
939
+ /**
940
+ * A primitive or structured value containing additional information about the error.
941
+ * This may be omitted.
942
+ */
943
+ data?: any;
944
+ }
945
+ // --8<-- [end:JSONRPCError]
946
+
947
+ // --8<-- [start:JSONRPCResult]
948
+ /**
949
+ * Represents a successful JSON-RPC 2.0 Response object.
950
+ */
951
+ export interface JSONRPCSuccessResponse extends JSONRPCMessage {
952
+ /**
953
+ * The identifier established by the client.
954
+ * @nullable
955
+ */
956
+ id: number | string | null;
957
+ /**
958
+ * The value of this member is determined by the method invoked on the Server.
959
+ */
960
+ result: any;
961
+ /**
962
+ * This field MUST NOT exist in a success response.
963
+ */
964
+ error?: never;
965
+ }
966
+ // --8<-- [end:JSONRPCResult]
967
+
968
+ // --8<-- [start:JSONRPCErrorResponse]
969
+ /**
970
+ * Represents a JSON-RPC 2.0 Error Response object.
971
+ */
972
+ export interface JSONRPCErrorResponse extends JSONRPCMessage {
973
+ /**
974
+ * The identifier established by the client.
975
+ * @nullable
976
+ */
977
+ id: number | string | null;
978
+ /**
979
+ * This field MUST NOT exist in an error response.
980
+ */
981
+ result?: never;
982
+ /**
983
+ * An object describing the error that occurred.
984
+ */
985
+ error: JSONRPCError | A2AError;
986
+ }
987
+ // --8<-- [end:JSONRPCErrorResponse]
988
+
989
+ // --8<-- [start:JSONRPCResponse]
990
+ /**
991
+ * A discriminated union representing all possible JSON-RPC 2.0 responses
992
+ * for the A2A specification methods.
993
+ */
994
+ export type JSONRPCResponse =
995
+ | SendMessageResponse
996
+ | SendStreamingMessageResponse
997
+ | GetTaskResponse
998
+ | CancelTaskResponse
999
+ | SetTaskPushNotificationConfigResponse
1000
+ | GetTaskPushNotificationConfigResponse
1001
+ | ListTaskPushNotificationConfigResponse
1002
+ | DeleteTaskPushNotificationConfigResponse
1003
+ | GetAuthenticatedExtendedCardResponse;
1004
+ // --8<-- [end:JSONRPCResponse]
1005
+
1006
+ // --8<-- [start:SendMessageRequest]
1007
+ /**
1008
+ * Represents a JSON-RPC request for the `message/send` method.
1009
+ */
1010
+ export interface SendMessageRequest extends JSONRPCRequest {
1011
+ /** The identifier for this request. */
1012
+ id: number | string;
1013
+ /** The method name. Must be 'message/send'. */
1014
+ readonly method: "message/send";
1015
+ /** The parameters for sending a message. */
1016
+ params: MessageSendParams;
1017
+ }
1018
+ // --8<-- [end:SendMessageRequest]
1019
+
1020
+ // --8<-- [start:SendMessageSuccessResponse]
1021
+ /**
1022
+ * Represents a successful JSON-RPC response for the `message/send` method.
1023
+ */
1024
+ export interface SendMessageSuccessResponse extends JSONRPCSuccessResponse {
1025
+ /** The result, which can be a direct reply Message or the initial Task object. */
1026
+ result: Message | Task;
1027
+ }
1028
+ // --8<-- [end:SendMessageSuccessResponse]
1029
+
1030
+ // --8<-- [start:SendMessageResponse]
1031
+ /**
1032
+ * Represents a JSON-RPC response for the `message/send` method.
1033
+ */
1034
+ export type SendMessageResponse =
1035
+ | SendMessageSuccessResponse
1036
+ | JSONRPCErrorResponse;
1037
+ // --8<-- [end:SendMessageResponse]
1038
+
1039
+ // --8<-- [start:SendStreamingMessageRequest]
1040
+ /**
1041
+ * Represents a JSON-RPC request for the `message/stream` method.
1042
+ */
1043
+ export interface SendStreamingMessageRequest extends JSONRPCRequest {
1044
+ /** The identifier for this request. */
1045
+ id: number | string;
1046
+ /** The method name. Must be 'message/stream'. */
1047
+ readonly method: "message/stream";
1048
+ /** The parameters for sending a message. */
1049
+ params: MessageSendParams;
1050
+ }
1051
+ // --8<-- [end:SendStreamingMessageRequest]
1052
+
1053
+ // --8<-- [start:SendStreamingMessageSuccessResponse]
1054
+ /**
1055
+ * Represents a successful JSON-RPC response for the `message/stream` method.
1056
+ * The server may send multiple response objects for a single request.
1057
+ */
1058
+ export interface SendStreamingMessageSuccessResponse
1059
+ extends JSONRPCSuccessResponse {
1060
+ /** The result, which can be a Message, Task, or a streaming update event. */
1061
+ result: Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
1062
+ }
1063
+ // --8<-- [end:SendStreamingMessageSuccessResponse]
1064
+
1065
+ // --8<-- [start:SendStreamingMessageResponse]
1066
+ /**
1067
+ * Represents a JSON-RPC response for the `message/stream` method.
1068
+ */
1069
+ export type SendStreamingMessageResponse =
1070
+ | SendStreamingMessageSuccessResponse
1071
+ | JSONRPCErrorResponse;
1072
+ // --8<-- [end:SendStreamingMessageResponse]
1073
+
1074
+ // --8<-- [start:GetTaskRequest]
1075
+ /**
1076
+ * Represents a JSON-RPC request for the `tasks/get` method.
1077
+ */
1078
+ export interface GetTaskRequest extends JSONRPCRequest {
1079
+ /** The identifier for this request. */
1080
+ id: number | string;
1081
+ /** The method name. Must be 'tasks/get'. */
1082
+ readonly method: "tasks/get";
1083
+ /** The parameters for querying a task. */
1084
+ params: TaskQueryParams;
1085
+ }
1086
+ // --8<-- [end:GetTaskRequest]
1087
+
1088
+ // --8<-- [start:GetTaskSuccessResponse]
1089
+ /**
1090
+ * Represents a successful JSON-RPC response for the `tasks/get` method.
1091
+ */
1092
+ export interface GetTaskSuccessResponse extends JSONRPCSuccessResponse {
1093
+ /** The result, containing the requested Task object. */
1094
+ result: Task;
1095
+ }
1096
+ // --8<-- [end:GetTaskSuccessResponse]
1097
+
1098
+ // --8<-- [start:GetTaskResponse]
1099
+ /**
1100
+ * Represents a JSON-RPC response for the `tasks/get` method.
1101
+ */
1102
+ export type GetTaskResponse = GetTaskSuccessResponse | JSONRPCErrorResponse;
1103
+ // --8<-- [end:GetTaskResponse]
1104
+
1105
+ // --8<-- [start:CancelTaskRequest]
1106
+ /**
1107
+ * Represents a JSON-RPC request for the `tasks/cancel` method.
1108
+ */
1109
+ export interface CancelTaskRequest extends JSONRPCRequest {
1110
+ /** The identifier for this request. */
1111
+ id: number | string;
1112
+ /** The method name. Must be 'tasks/cancel'. */
1113
+ readonly method: "tasks/cancel";
1114
+ /** The parameters identifying the task to cancel. */
1115
+ params: TaskIdParams;
1116
+ }
1117
+ // --8<-- [end:CancelTaskRequest]
1118
+
1119
+ // --8<-- [start:CancelTaskSuccessResponse]
1120
+ /**
1121
+ * Represents a successful JSON-RPC response for the `tasks/cancel` method.
1122
+ */
1123
+ export interface CancelTaskSuccessResponse extends JSONRPCSuccessResponse {
1124
+ /** The result, containing the final state of the canceled Task object. */
1125
+ result: Task;
1126
+ }
1127
+ // --8<-- [end:CancelTaskSuccessResponse]
1128
+
1129
+ // --8<-- [start:CancelTaskResponse]
1130
+ /**
1131
+ * Represents a JSON-RPC response for the `tasks/cancel` method.
1132
+ */
1133
+ export type CancelTaskResponse =
1134
+ | CancelTaskSuccessResponse
1135
+ | JSONRPCErrorResponse;
1136
+ // --8<-- [end:CancelTaskResponse]
1137
+
1138
+ // --8<-- [start:SetTaskPushNotificationConfigRequest]
1139
+ /**
1140
+ * Represents a JSON-RPC request for the `tasks/pushNotificationConfig/set` method.
1141
+ */
1142
+ export interface SetTaskPushNotificationConfigRequest extends JSONRPCRequest {
1143
+ /** The identifier for this request. */
1144
+ id: number | string;
1145
+ /** The method name. Must be 'tasks/pushNotificationConfig/set'. */
1146
+ readonly method: "tasks/pushNotificationConfig/set";
1147
+ /** The parameters for setting the push notification configuration. */
1148
+ params: TaskPushNotificationConfig;
1149
+ }
1150
+ // --8<-- [end:SetTaskPushNotificationConfigRequest]
1151
+
1152
+ // --8<-- [start:SetTaskPushNotificationConfigSuccessResponse]
1153
+ /**
1154
+ * Represents a successful JSON-RPC response for the `tasks/pushNotificationConfig/set` method.
1155
+ */
1156
+ export interface SetTaskPushNotificationConfigSuccessResponse
1157
+ extends JSONRPCSuccessResponse {
1158
+ /** The result, containing the configured push notification settings. */
1159
+ result: TaskPushNotificationConfig;
1160
+ }
1161
+ // --8<-- [end:SetTaskPushNotificationConfigSuccessResponse]
1162
+
1163
+ // --8<-- [start:SetTaskPushNotificationConfigResponse]
1164
+ /**
1165
+ * Represents a JSON-RPC response for the `tasks/pushNotificationConfig/set` method.
1166
+ */
1167
+ export type SetTaskPushNotificationConfigResponse =
1168
+ | SetTaskPushNotificationConfigSuccessResponse
1169
+ | JSONRPCErrorResponse;
1170
+ // --8<-- [end:SetTaskPushNotificationConfigResponse]
1171
+
1172
+ // --8<-- [start:GetTaskPushNotificationConfigRequest]
1173
+ /**
1174
+ * Represents a JSON-RPC request for the `tasks/pushNotificationConfig/get` method.
1175
+ */
1176
+ export interface GetTaskPushNotificationConfigRequest extends JSONRPCRequest {
1177
+ /** The identifier for this request. */
1178
+ id: number | string;
1179
+ /** The method name. Must be 'tasks/pushNotificationConfig/get'. */
1180
+ readonly method: "tasks/pushNotificationConfig/get";
1181
+ /**
1182
+ * The parameters for getting a push notification configuration.
1183
+ *
1184
+ * @deprecated The `TaskIdParams` type is deprecated for this method. Use `GetTaskPushNotificationConfigParams` instead.
1185
+ */
1186
+ params: GetTaskPushNotificationConfigParams | TaskIdParams;
1187
+ }
1188
+ // --8<-- [end:GetTaskPushNotificationConfigRequest]
1189
+
1190
+ // --8<-- [start:GetTaskPushNotificationConfigSuccessResponse]
1191
+ /**
1192
+ * Represents a successful JSON-RPC response for the `tasks/pushNotificationConfig/get` method.
1193
+ */
1194
+ export interface GetTaskPushNotificationConfigSuccessResponse
1195
+ extends JSONRPCSuccessResponse {
1196
+ /** The result, containing the requested push notification configuration. */
1197
+ result: TaskPushNotificationConfig;
1198
+ }
1199
+ // --8<-- [end:GetTaskPushNotificationConfigSuccessResponse]
1200
+
1201
+ // --8<-- [start:GetTaskPushNotificationConfigResponse]
1202
+ /**
1203
+ * Represents a JSON-RPC response for the `tasks/pushNotificationConfig/get` method.
1204
+ */
1205
+ export type GetTaskPushNotificationConfigResponse =
1206
+ | GetTaskPushNotificationConfigSuccessResponse
1207
+ | JSONRPCErrorResponse;
1208
+ // --8<-- [end:GetTaskPushNotificationConfigResponse]
1209
+
1210
+ // --8<-- [start:TaskResubscriptionRequest]
1211
+ /**
1212
+ * Represents a JSON-RPC request for the `tasks/resubscribe` method, used to resume a streaming connection.
1213
+ */
1214
+ export interface TaskResubscriptionRequest extends JSONRPCRequest {
1215
+ /** The identifier for this request. */
1216
+ id: number | string;
1217
+ /** The method name. Must be 'tasks/resubscribe'. */
1218
+ readonly method: "tasks/resubscribe";
1219
+ /** The parameters identifying the task to resubscribe to. */
1220
+ params: TaskIdParams;
1221
+ }
1222
+ // --8<-- [end:TaskResubscriptionRequest]
1223
+
1224
+ // --8<-- [start:ListTaskPushNotificationConfigRequest]
1225
+ /**
1226
+ * Represents a JSON-RPC request for the `tasks/pushNotificationConfig/list` method.
1227
+ */
1228
+ export interface ListTaskPushNotificationConfigRequest extends JSONRPCRequest {
1229
+ /** The identifier for this request. */
1230
+ id: number | string;
1231
+ /** The method name. Must be 'tasks/pushNotificationConfig/list'. */
1232
+ readonly method: "tasks/pushNotificationConfig/list";
1233
+ /** The parameters identifying the task whose configurations are to be listed. */
1234
+ params: ListTaskPushNotificationConfigParams;
1235
+ }
1236
+ // --8<-- [end:ListTaskPushNotificationConfigRequest]
1237
+
1238
+ // --8<-- [start:ListTaskPushNotificationConfigSuccessResponse]
1239
+ /**
1240
+ * Represents a successful JSON-RPC response for the `tasks/pushNotificationConfig/list` method.
1241
+ */
1242
+ export interface ListTaskPushNotificationConfigSuccessResponse
1243
+ extends JSONRPCSuccessResponse {
1244
+ /** The result, containing an array of all push notification configurations for the task. */
1245
+ result: TaskPushNotificationConfig[];
1246
+ }
1247
+ // --8<-- [end:ListTaskPushNotificationConfigSuccessResponse]
1248
+
1249
+ // --8<-- [start:ListTaskPushNotificationConfigResponse]
1250
+ /**
1251
+ * Represents a JSON-RPC response for the `tasks/pushNotificationConfig/list` method.
1252
+ */
1253
+ export type ListTaskPushNotificationConfigResponse =
1254
+ | ListTaskPushNotificationConfigSuccessResponse
1255
+ | JSONRPCErrorResponse;
1256
+ // --8<-- [end:ListTaskPushNotificationConfigResponse]
1257
+
1258
+ // --8<-- [start:DeleteTaskPushNotificationConfigRequest]
1259
+ /**
1260
+ * Represents a JSON-RPC request for the `tasks/pushNotificationConfig/delete` method.
1261
+ */
1262
+ export interface DeleteTaskPushNotificationConfigRequest
1263
+ extends JSONRPCRequest {
1264
+ /** The identifier for this request. */
1265
+ id: number | string;
1266
+ /** The method name. Must be 'tasks/pushNotificationConfig/delete'. */
1267
+ readonly method: "tasks/pushNotificationConfig/delete";
1268
+ /** The parameters identifying the push notification configuration to delete. */
1269
+ params: DeleteTaskPushNotificationConfigParams;
1270
+ }
1271
+ // --8<-- [end:DeleteTaskPushNotificationConfigRequest]
1272
+
1273
+ // --8<-- [start:DeleteTaskPushNotificationConfigSuccessResponse]
1274
+ /**
1275
+ * Represents a successful JSON-RPC response for the `tasks/pushNotificationConfig/delete` method.
1276
+ */
1277
+ export interface DeleteTaskPushNotificationConfigSuccessResponse
1278
+ extends JSONRPCSuccessResponse {
1279
+ /** The result is null on successful deletion. */
1280
+ result: null;
1281
+ }
1282
+ // --8<-- [end:DeleteTaskPushNotificationConfigSuccessResponse]
1283
+
1284
+ // --8<-- [start:DeleteTaskPushNotificationConfigResponse]
1285
+ /**
1286
+ * Represents a JSON-RPC response for the `tasks/pushNotificationConfig/delete` method.
1287
+ */
1288
+ export type DeleteTaskPushNotificationConfigResponse =
1289
+ | DeleteTaskPushNotificationConfigSuccessResponse
1290
+ | JSONRPCErrorResponse;
1291
+ // --8<-- [end:DeleteTaskPushNotificationConfigResponse]
1292
+
1293
+ // --8<-- [start:GetAuthenticatedExtendedCardRequest]
1294
+ /**
1295
+ * Represents a JSON-RPC request for the `agent/getAuthenticatedExtendedCard` method.
1296
+ */
1297
+ export interface GetAuthenticatedExtendedCardRequest extends JSONRPCRequest {
1298
+ /** The identifier for this request. */
1299
+ id: number | string;
1300
+ /** The method name. Must be 'agent/getAuthenticatedExtendedCard'. */
1301
+ readonly method: "agent/getAuthenticatedExtendedCard";
1302
+ /** This method does not accept parameters. */
1303
+ params?: never;
1304
+ }
1305
+ // --8<-- [end:GetAuthenticatedExtendedCardRequest]
1306
+
1307
+ // --8<-- [start:GetAuthenticatedExtendedCardSuccessResponse]
1308
+ /**
1309
+ * Represents a successful JSON-RPC response for the `agent/getAuthenticatedExtendedCard` method.
1310
+ */
1311
+ export interface GetAuthenticatedExtendedCardSuccessResponse
1312
+ extends JSONRPCSuccessResponse {
1313
+ /** The result is an Agent Card object. */
1314
+ result: AgentCard;
1315
+ }
1316
+ // --8<-- [end:GetAuthenticatedExtendedCardSuccessResponse]
1317
+
1318
+ // --8<-- [start:GetAuthenticatedExtendedCardResponse]
1319
+ /**
1320
+ * Represents a JSON-RPC response for the `agent/getAuthenticatedExtendedCard` method.
1321
+ */
1322
+ export type GetAuthenticatedExtendedCardResponse =
1323
+ | GetAuthenticatedExtendedCardSuccessResponse
1324
+ | JSONRPCErrorResponse;
1325
+ // --8<-- [end:GetAuthenticatedExtendedCardResponse]
1326
+
1327
+ // --8<-- [start:A2ARequest]
1328
+ /**
1329
+ * A discriminated union representing all possible JSON-RPC 2.0 requests supported by the A2A specification.
1330
+ */
1331
+ export type A2ARequest =
1332
+ | SendMessageRequest
1333
+ | SendStreamingMessageRequest
1334
+ | GetTaskRequest
1335
+ | CancelTaskRequest
1336
+ | SetTaskPushNotificationConfigRequest
1337
+ | GetTaskPushNotificationConfigRequest
1338
+ | TaskResubscriptionRequest
1339
+ | ListTaskPushNotificationConfigRequest
1340
+ | DeleteTaskPushNotificationConfigRequest
1341
+ | GetAuthenticatedExtendedCardRequest;
1342
+ // --8<-- [end:A2ARequest]
1343
+
1344
+ // --8<-- [start:JSONParseError]
1345
+ /**
1346
+ * An error indicating that the server received invalid JSON.
1347
+ */
1348
+ export interface JSONParseError extends JSONRPCError {
1349
+ /** The error code for a JSON parse error. */
1350
+ readonly code: -32700;
1351
+ /**
1352
+ * The error message.
1353
+ * @default "Invalid JSON payload"
1354
+ */
1355
+ message: string;
1356
+ }
1357
+ // --8<-- [end:JSONParseError]
1358
+
1359
+ // --8<-- [start:InvalidRequestError]
1360
+ /**
1361
+ * An error indicating that the JSON sent is not a valid Request object.
1362
+ */
1363
+ export interface InvalidRequestError extends JSONRPCError {
1364
+ /** The error code for an invalid request. */
1365
+ readonly code: -32600;
1366
+ /**
1367
+ * The error message.
1368
+ * @default "Request payload validation error"
1369
+ */
1370
+ message: string;
1371
+ }
1372
+ // --8<-- [end:InvalidRequestError]
1373
+
1374
+ // --8<-- [start:MethodNotFoundError]
1375
+ /**
1376
+ * An error indicating that the requested method does not exist or is not available.
1377
+ */
1378
+ export interface MethodNotFoundError extends JSONRPCError {
1379
+ /** The error code for a method not found error. */
1380
+ readonly code: -32601;
1381
+ /**
1382
+ * The error message.
1383
+ * @default "Method not found"
1384
+ */
1385
+ message: string;
1386
+ }
1387
+ // --8<-- [end:MethodNotFoundError]
1388
+
1389
+ // --8<-- [start:InvalidParamsError]
1390
+ /**
1391
+ * An error indicating that the method parameters are invalid.
1392
+ */
1393
+ export interface InvalidParamsError extends JSONRPCError {
1394
+ /** The error code for an invalid parameters error. */
1395
+ readonly code: -32602;
1396
+ /**
1397
+ * The error message.
1398
+ * @default "Invalid parameters"
1399
+ */
1400
+ message: string;
1401
+ }
1402
+ // --8<-- [end:InvalidParamsError]
1403
+
1404
+ // --8<-- [start:InternalError]
1405
+ /**
1406
+ * An error indicating an internal error on the server.
1407
+ */
1408
+ export interface InternalError extends JSONRPCError {
1409
+ /** The error code for an internal server error. */
1410
+ readonly code: -32603;
1411
+ /**
1412
+ * The error message.
1413
+ * @default "Internal error"
1414
+ */
1415
+ message: string;
1416
+ }
1417
+ // --8<-- [end:InternalError]
1418
+
1419
+ // --8<-- [start:TaskNotFoundError]
1420
+ /**
1421
+ * An A2A-specific error indicating that the requested task ID was not found.
1422
+ */
1423
+ export interface TaskNotFoundError extends JSONRPCError {
1424
+ /** The error code for a task not found error. */
1425
+ readonly code: -32001;
1426
+ /**
1427
+ * The error message.
1428
+ * @default "Task not found"
1429
+ */
1430
+ message: string;
1431
+ }
1432
+ // --8<-- [end:TaskNotFoundError]
1433
+
1434
+ // --8<-- [start:TaskNotCancelableError]
1435
+ /**
1436
+ * An A2A-specific error indicating that the task is in a state where it cannot be canceled.
1437
+ */
1438
+ export interface TaskNotCancelableError extends JSONRPCError {
1439
+ /** The error code for a task that cannot be canceled. */
1440
+ readonly code: -32002;
1441
+ /**
1442
+ * The error message.
1443
+ * @default "Task cannot be canceled"
1444
+ */
1445
+ message: string;
1446
+ }
1447
+ // --8<-- [end:TaskNotCancelableError]
1448
+
1449
+ // --8<-- [start:PushNotificationNotSupportedError]
1450
+ /**
1451
+ * An A2A-specific error indicating that the agent does not support push notifications.
1452
+ */
1453
+ export interface PushNotificationNotSupportedError extends JSONRPCError {
1454
+ /** The error code for when push notifications are not supported. */
1455
+ readonly code: -32003;
1456
+ /**
1457
+ * The error message.
1458
+ * @default "Push Notification is not supported"
1459
+ */
1460
+ message: string;
1461
+ }
1462
+ // --8<-- [end:PushNotificationNotSupportedError]
1463
+
1464
+ // --8<-- [start:UnsupportedOperationError]
1465
+ /**
1466
+ * An A2A-specific error indicating that the requested operation is not supported by the agent.
1467
+ */
1468
+ export interface UnsupportedOperationError extends JSONRPCError {
1469
+ /** The error code for an unsupported operation. */
1470
+ readonly code: -32004;
1471
+ /**
1472
+ * The error message.
1473
+ * @default "This operation is not supported"
1474
+ */
1475
+ message: string;
1476
+ }
1477
+ // --8<-- [end:UnsupportedOperationError]
1478
+
1479
+ // --8<-- [start:ContentTypeNotSupportedError]
1480
+ /**
1481
+ * An A2A-specific error indicating an incompatibility between the requested
1482
+ * content types and the agent's capabilities.
1483
+ */
1484
+ export interface ContentTypeNotSupportedError extends JSONRPCError {
1485
+ /** The error code for an unsupported content type. */
1486
+ readonly code: -32005;
1487
+ /**
1488
+ * The error message.
1489
+ * @default "Incompatible content types"
1490
+ */
1491
+ message: string;
1492
+ }
1493
+ // --8<-- [end:ContentTypeNotSupportedError]
1494
+
1495
+ // --8<-- [start:InvalidAgentResponseError]
1496
+ /**
1497
+ * An A2A-specific error indicating that the agent returned a response that
1498
+ * does not conform to the specification for the current method.
1499
+ */
1500
+ export interface InvalidAgentResponseError extends JSONRPCError {
1501
+ /** The error code for an invalid agent response. */
1502
+ readonly code: -32006;
1503
+ /**
1504
+ * The error message.
1505
+ * @default "Invalid agent response"
1506
+ */
1507
+ message: string;
1508
+ }
1509
+ // --8<-- [end:InvalidAgentResponseError]
1510
+
1511
+ // --8<-- [start:AuthenticatedExtendedCardNotConfiguredError]
1512
+ /**
1513
+ * An A2A-specific error indicating that the agent does not have an Authenticated Extended Card configured
1514
+ */
1515
+ export interface AuthenticatedExtendedCardNotConfiguredError
1516
+ extends JSONRPCError {
1517
+ /** The error code for when an authenticated extended card is not configured. */
1518
+ readonly code: -32007;
1519
+ /**
1520
+ * The error message.
1521
+ * @default "Authenticated Extended Card is not configured"
1522
+ */
1523
+ message: string;
1524
+ }
1525
+ // --8<-- [end:AuthenticatedExtendedCardNotConfiguredError]
1526
+
1527
+ // --8<-- [start:A2AError]
1528
+ /**
1529
+ * A discriminated union of all standard JSON-RPC and A2A-specific error types.
1530
+ */
1531
+ export type A2AError =
1532
+ | JSONParseError
1533
+ | InvalidRequestError
1534
+ | MethodNotFoundError
1535
+ | InvalidParamsError
1536
+ | InternalError
1537
+ | TaskNotFoundError
1538
+ | TaskNotCancelableError
1539
+ | PushNotificationNotSupportedError
1540
+ | UnsupportedOperationError
1541
+ | ContentTypeNotSupportedError
1542
+ | InvalidAgentResponseError
1543
+ | AuthenticatedExtendedCardNotConfiguredError;
1544
+ // --8<-- [end:A2AError]