diff --git a/src/a2a/types.py b/src/a2a/types.py index 675ed832..52731b1e 100644 --- a/src/a2a/types.py +++ b/src/a2a/types.py @@ -1,7 +1,5 @@ # generated by datamodel-codegen: -# filename: spec.json - -"""Data models representing the A2A protocol.""" +# filename: https://raw.githubusercontent.com/google/A2A/refs/heads/main/specification/json/a2a.json from __future__ import annotations @@ -12,13 +10,13 @@ class A2A(RootModel[Any]): - """Root model for the A2A specification.""" - root: Any class In(Enum): - """The location of the API key. Valid values are "query", "header", or "cookie".""" + """ + The location of the API key. Valid values are "query", "header", or "cookie". + """ cookie = 'cookie' header = 'header' @@ -26,377 +24,719 @@ class In(Enum): class APIKeySecurityScheme(BaseModel): - """API Key security scheme.""" + """ + API Key security scheme. + """ description: str | None = None - """Description of this security scheme.""" + """ + Description of this security scheme. + """ in_: In = Field(..., alias='in') - """The location of the API key. Valid values are "query", "header", or "cookie".""" + """ + The location of the API key. Valid values are "query", "header", or "cookie". + """ name: str - """The name of the header, query or cookie parameter to be used.""" + """ + The name of the header, query or cookie parameter to be used. + """ type: Literal['apiKey'] = 'apiKey' class AgentCapabilities(BaseModel): - """Defines optional capabilities supported by an agent.""" + """ + Defines optional capabilities supported by an agent. + """ pushNotifications: bool | None = None - """True if the agent can notify updates to client.""" + """ + true if the agent can notify updates to client. + """ stateTransitionHistory: bool | None = None - """True if the agent exposes status change history for tasks.""" + """ + true if the agent exposes status change history for tasks. + """ streaming: bool | None = None - """True if the agent supports SSE.""" + """ + true if the agent supports SSE. + """ class AgentProvider(BaseModel): - """Represents the service provider of an agent.""" + """ + Represents the service provider of an agent. + """ organization: str - """Agent provider's organization name.""" + """ + Agent provider's organization name. + """ url: str - """Agent provider's url.""" + """ + Agent provider's URL. + """ class AgentSkill(BaseModel): - """Represents a unit of capability that an agent can perform.""" + """ + Represents a unit of capability that an agent can perform. + """ description: str - """Description of the skill - will be used by the client or a human as a hint to understand what the skill does.""" + """ + Description of the skill - will be used by the client or a human + as a hint to understand what the skill does. + """ examples: list[str] | None = None - """The set of example scenarios that the skill can perform. Will be used by the client as a hint to understand how the skill can be used.""" + """ + The set of example scenarios that the skill can perform. + Will be used by the client as a hint to understand how the skill can be + used. + """ id: str - """Unique identifier for the agent's skill.""" + """ + Unique identifier for the agent's skill. + """ inputModes: list[str] | None = None - """The set of interaction modes that the skill supports (if different than the default). Supported mime types for input.""" + """ + The set of interaction modes that the skill supports + (if different than the default). + Supported mime types for input. + """ name: str - """Human readable name of the skill.""" + """ + Human readable name of the skill. + """ outputModes: list[str] | None = None - """Supported mime types for output.""" + """ + Supported mime types for output. + """ tags: list[str] - """Set of tagwords describing classes of capabilities for this specific skill.""" + """ + Set of tagwords describing classes of capabilities for this specific + skill. + """ class AuthorizationCodeOAuthFlow(BaseModel): - """Configuration details for a supported OAuth Flow.""" + """ + Configuration details for a supported OAuth Flow + """ authorizationUrl: str - """The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 + standard requires the use of TLS + """ refreshUrl: str | None = None - """The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 + standard requires the use of 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. The map MAY be empty.""" + """ + The available scopes for the OAuth2 security scheme. A map between the scope name and a short + description for it. The map MAY be empty. + """ tokenUrl: str - """The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard + requires the use of TLS. + """ class ClientCredentialsOAuthFlow(BaseModel): - """Configuration details for a supported OAuth Flow.""" + """ + Configuration details for a supported OAuth Flow + """ refreshUrl: str | None = None - """The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 + standard requires the use of 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. The map MAY be empty.""" + """ + The available scopes for the OAuth2 security scheme. A map between the scope name and a short + description for it. The map MAY be empty. + """ tokenUrl: str - """The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard + requires the use of TLS. + """ class ContentTypeNotSupportedError(BaseModel): - """A2A specific error indicating incompatible content types between request and agent capabilities.""" + """ + A2A specific error indicating incompatible content types between request and agent capabilities. + """ code: Literal[-32005] = -32005 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Incompatible content types' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class DataPart(BaseModel): - """Represents a structured data segment within a message part.""" + """ + Represents a structured data segment within a message part. + """ data: dict[str, Any] - """Structured data content.""" + """ + Structured data content + """ kind: Literal['data'] = 'data' - """Part type - data for DataParts.""" + """ + Part type - data for DataParts + """ metadata: dict[str, Any] | None = None - """Optional metadata associated with the part.""" + """ + Optional metadata associated with the part. + """ class FileBase(BaseModel): - """Represents the base entity for FileParts.""" + """ + Represents the base entity for FileParts + """ mimeType: str | None = None - """Optional mimeType for the file.""" + """ + Optional mimeType for the file + """ name: str | None = None - """Optional name for the file.""" + """ + Optional name for the file + """ -class FileWithBytes(FileBase): - """Define the variant where 'bytes' is present and 'uri' is absent.""" +class FileWithBytes(BaseModel): + """ + Define the variant where 'bytes' is present and 'uri' is absent + """ bytes: str - """Base64 encoded content of the file.""" + """ + base64 encoded content of the file + """ + mimeType: str | None = None + """ + Optional mimeType for the file + """ + name: str | None = None + """ + Optional name for the file + """ -class FileWithUri(FileBase): - """Define the variant where 'uri' is present and 'bytes' is absent.""" +class FileWithUri(BaseModel): + """ + Define the variant where 'uri' is present and 'bytes' is absent + """ + mimeType: str | None = None + """ + Optional mimeType for the file + """ + name: str | None = None + """ + Optional name for the file + """ uri: str + """ + URL for the File content + """ class HTTPAuthSecurityScheme(BaseModel): - """HTTP Authentication security scheme.""" + """ + HTTP Authentication security scheme. + """ bearerFormat: str | None = None - """A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.""" + """ + A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually + generated by an authorization server, so this information is primarily for documentation + purposes. + """ description: str | None = None - """Description of this security scheme.""" + """ + Description of this security scheme. + """ scheme: str - """The name of the HTTP Authentication scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry. The value is case-insensitive, as defined in RFC7235.""" + """ + The name of the HTTP Authentication scheme to be used in the Authorization header as defined + in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry. + The value is case-insensitive, as defined in RFC7235. + """ type: Literal['http'] = 'http' class ImplicitOAuthFlow(BaseModel): - """Configuration details for a supported OAuth Flow.""" + """ + Configuration details for a supported OAuth Flow + """ authorizationUrl: str - """The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 + standard requires the use of TLS + """ refreshUrl: str | None = None - """The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 + standard requires the use of 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. The map MAY be empty.""" + """ + The available scopes for the OAuth2 security scheme. A map between the scope name and a short + description for it. The map MAY be empty. + """ class InternalError(BaseModel): - """JSON-RPC error indicating an internal JSON-RPC error on the server.""" + """ + JSON-RPC error indicating an internal JSON-RPC error on the server. + """ code: Literal[-32603] = -32603 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Internal error' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class InvalidAgentResponseError(BaseModel): - """A2A specific error indicating agent returned invalid response for the current method.""" + """ + A2A specific error indicating agent returned invalid response for the current method + """ code: Literal[-32006] = -32006 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Invalid agent response' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class InvalidParamsError(BaseModel): - """JSON-RPC error indicating invalid method parameter(s).""" + """ + JSON-RPC error indicating invalid method parameter(s). + """ code: Literal[-32602] = -32602 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Invalid parameters' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class InvalidRequestError(BaseModel): - """JSON-RPC error indicating the JSON sent is not a valid Request object.""" + """ + JSON-RPC error indicating the JSON sent is not a valid Request object. + """ code: Literal[-32600] = -32600 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Request payload validation error' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class JSONParseError(BaseModel): - """JSON-RPC error indicating invalid JSON was received by the server.""" + """ + JSON-RPC error indicating invalid JSON was received by the server. + """ code: Literal[-32700] = -32700 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Invalid JSON payload' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class JSONRPCError(BaseModel): - """Represents a JSON-RPC 2.0 Error object.""" + """ + Represents a JSON-RPC 2.0 Error object. + This is typically included in a JSONRPCErrorResponse when an error occurs. + """ code: int - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class JSONRPCMessage(BaseModel): - """Base interface for any JSON-RPC 2.0 request or response.""" + """ + Base interface for any JSON-RPC 2.0 request or response. + """ id: str | int | None = None - """An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.""" + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ jsonrpc: Literal['2.0'] = '2.0' - """Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".""" + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ -class JSONRPCRequest(JSONRPCMessage): - """Represents a JSON-RPC 2.0 Request object.""" +class JSONRPCRequest(BaseModel): + """ + Represents a JSON-RPC 2.0 Request object. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies 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.""" + """ + A String containing the name of the method to be invoked. + """ params: dict[str, Any] | None = None - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ -class JSONRPCResult(JSONRPCMessage): - """Represents a JSON-RPC 2.0 Result object.""" +class JSONRPCResult(BaseModel): + """ + Represents a JSON-RPC 2.0 Result object. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: Any - """The result object on success.""" + """ + The result object on success + """ class Role(Enum): - """Message sender's role.""" + """ + Message sender's role + """ agent = 'agent' user = 'user' class MethodNotFoundError(BaseModel): - """JSON-RPC error indicating the method does not exist or is not available.""" + """ + JSON-RPC error indicating the method does not exist or is not available. + """ code: Literal[-32601] = -32601 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Method not found' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class OpenIdConnectSecurityScheme(BaseModel): - """OpenID Connect security scheme configuration.""" + """ + OpenID Connect security scheme configuration. + """ description: str | None = None - """Description of this security scheme.""" + """ + Description of this security scheme. + """ openIdConnectUrl: str - """Well-known URL to discover the [[OpenID-Connect-Discovery]] provider metadata.""" + """ + Well-known URL to discover the [[OpenID-Connect-Discovery]] provider metadata. + """ type: Literal['openIdConnect'] = 'openIdConnect' class PartBase(BaseModel): - """Base properties common to all message parts.""" + """ + Base properties common to all message parts. + """ metadata: dict[str, Any] | None = None - """Optional metadata associated with the part.""" + """ + Optional metadata associated with the part. + """ class PasswordOAuthFlow(BaseModel): - """Configuration details for a supported OAuth Flow.""" + """ + Configuration details for a supported OAuth Flow + """ refreshUrl: str | None = None - """The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 + standard requires the use of 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. The map MAY be empty.""" + """ + The available scopes for the OAuth2 security scheme. A map between the scope name and a short + description for it. The map MAY be empty. + """ tokenUrl: str - """The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.""" + """ + The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard + requires the use of TLS. + """ class PushNotificationAuthenticationInfo(BaseModel): - """Defines authentication details for push notifications.""" + """ + Defines authentication details for push notifications. + """ credentials: str | None = None - """Optional credentials.""" + """ + Optional credentials + """ schemes: list[str] - """Supported authentication schemes - e.g. Basic, Bearer.""" + """ + Supported authentication schemes - e.g. Basic, Bearer + """ class PushNotificationConfig(BaseModel): - """Configuration for setting up push notifications for task updates.""" + """ + Configuration for setting up push notifications for task updates. + """ authentication: PushNotificationAuthenticationInfo | None = None token: str | None = None - """Token unique to this task/session.""" + """ + Token unique to this task/session. + """ url: str - """URL for sending the push notifications.""" + """ + URL for sending the push notifications. + """ class PushNotificationNotSupportedError(BaseModel): - """A2A specific error indicating the agent does not support push notifications.""" + """ + A2A specific error indicating the agent does not support push notifications. + """ code: Literal[-32003] = -32003 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Push Notification is not supported' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class SecuritySchemeBase(BaseModel): - """Base properties shared by all security schemes.""" + """ + Base properties shared by all security schemes. + """ description: str | None = None - """Description of this security scheme.""" + """ + Description of this security scheme. + """ class TaskIdParams(BaseModel): - """Parameters containing only a task ID, used for simple task operations.""" + """ + Parameters containing only a task ID, used for simple task operations. + """ id: str - """Task id.""" + """ + Task id. + """ metadata: dict[str, Any] | None = None class TaskNotCancelableError(BaseModel): - """A2A specific error indicating the task is in a state where it cannot be canceled.""" + """ + A2A specific error indicating the task is in a state where it cannot be canceled. + """ code: Literal[-32002] = -32002 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Task cannot be canceled' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class TaskNotFoundError(BaseModel): - """A2A specific error indicating the requested task ID was not found.""" + """ + A2A specific error indicating the requested task ID was not found. + """ code: Literal[-32001] = -32001 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'Task not found' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class TaskPushNotificationConfig(BaseModel): - """Parameters for setting or getting push notification configuration for a task.""" + """ + Parameters for setting or getting push notification configuration for a task + """ pushNotificationConfig: PushNotificationConfig + """ + Push notification configuration. + """ taskId: str - """Task id.""" + """ + Task id. + """ -class TaskQueryParams(TaskIdParams): - """Parameters for querying a task, including optional history length.""" +class TaskQueryParams(BaseModel): + """ + Parameters for querying a task, including optional history length. + """ historyLength: int | None = None - """Number of recent messages to be retrieved.""" + """ + Number of recent messages to be retrieved. + """ + id: str + """ + Task id. + """ + metadata: dict[str, Any] | None = None -class TaskResubscriptionRequest(JSONRPCRequest): - """JSON-RPC request model for the 'tasks/resubscribe' method.""" +class TaskResubscriptionRequest(BaseModel): + """ + JSON-RPC request model for the 'tasks/resubscribe' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['tasks/resubscribe'] = 'tasks/resubscribe' - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: TaskIdParams - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ class TaskState(Enum): - """Represents the possible states of a Task.""" + """ + Represents the possible states of a Task. + """ submitted = 'submitted' working = 'working' @@ -409,24 +749,43 @@ class TaskState(Enum): unknown = 'unknown' -class TextPart(PartBase): - """Represents a text segment within parts.""" +class TextPart(BaseModel): + """ + Represents a text segment within parts. + """ kind: Literal['text'] = 'text' - """Part type - text for TextParts.""" + """ + Part type - text for TextParts + """ + metadata: dict[str, Any] | None = None + """ + Optional metadata associated with the part. + """ text: str - """Text content.""" + """ + Text content + """ class UnsupportedOperationError(BaseModel): - """A2A specific error indicating the requested operation is not supported by the agent.""" + """ + A2A specific error indicating the requested operation is not supported by the agent. + """ code: Literal[-32004] = -32004 - """A Number that indicates the error type that occurred.""" + """ + A Number that indicates the error type that occurred. + """ data: Any | None = None - """A Primitive or Structured value that contains additional information about the error. This may be omitted.""" + """ + A Primitive or Structured value that contains additional information about the error. + This may be omitted. + """ message: str | None = 'This operation is not supported' - """A String providing a short description of the error.""" + """ + A String providing a short description of the error. + """ class A2AError( @@ -444,8 +803,6 @@ class A2AError( | InvalidAgentResponseError ] ): - """Represents A2A specific JSON-RPC error responses.""" - root: ( JSONParseError | InvalidRequestError @@ -461,53 +818,123 @@ class A2AError( ) -class CancelTaskRequest(JSONRPCRequest): - """JSON-RPC request model for the 'tasks/cancel' method.""" +class CancelTaskRequest(BaseModel): + """ + JSON-RPC request model for the 'tasks/cancel' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['tasks/cancel'] = 'tasks/cancel' - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: TaskIdParams - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ -class FilePart(PartBase): - """Represents a File segment within parts.""" +class FilePart(BaseModel): + """ + Represents a File segment within parts. + """ file: FileWithBytes | FileWithUri - """File content either as url or bytes.""" + """ + File content either as url or bytes + """ kind: Literal['file'] = 'file' - """Part type - file for FileParts.""" + """ + Part type - file for FileParts + """ + metadata: dict[str, Any] | None = None + """ + Optional metadata associated with the part. + """ -class GetTaskPushNotificationConfigRequest(JSONRPCRequest): - """JSON-RPC request model for the 'tasks/pushNotificationConfig/get' method.""" +class GetTaskPushNotificationConfigRequest(BaseModel): + """ + JSON-RPC request model for the 'tasks/pushNotificationConfig/get' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['tasks/pushNotificationConfig/get'] = ( 'tasks/pushNotificationConfig/get' ) - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: TaskIdParams - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ -class GetTaskPushNotificationConfigSuccessResponse(JSONRPCResult): - """JSON-RPC success response model for the 'tasks/pushNotificationConfig/get' method.""" +class GetTaskPushNotificationConfigSuccessResponse(BaseModel): + """ + JSON-RPC success response model for the 'tasks/pushNotificationConfig/get' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: TaskPushNotificationConfig - """The result object on success.""" + """ + The result object on success. + """ -class GetTaskRequest(JSONRPCRequest): - """JSON-RPC request model for the 'tasks/get' method.""" +class GetTaskRequest(BaseModel): + """ + JSON-RPC request model for the 'tasks/get' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['tasks/get'] = 'tasks/get' - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: TaskQueryParams - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ -class JSONRPCErrorResponse(JSONRPCMessage): - """Represents a JSON-RPC 2.0 Error Response object.""" +class JSONRPCErrorResponse(BaseModel): + """ + Represents a JSON-RPC 2.0 Error Response object. + """ error: ( JSONRPCError @@ -523,126 +950,223 @@ class JSONRPCErrorResponse(JSONRPCMessage): | ContentTypeNotSupportedError | InvalidAgentResponseError ) + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ class MessageSendConfiguration(BaseModel): - """Configuration for the send message request.""" + """ + Configuration for the send message request. + """ acceptedOutputModes: list[str] - """Accepted output modalities by the client.""" + """ + Accepted output modalities by the client. + """ blocking: bool | None = None - """If the server should treat the client as a blocking request.""" + """ + If the server should treat the client as a blocking request. + """ historyLength: int | None = None - """Number of recent messages to be retrieved.""" + """ + Number of recent messages to be retrieved. + """ pushNotificationConfig: PushNotificationConfig | None = None - """Where the server should send notifications when disconnected.""" + """ + Where the server should send notifications when disconnected. + """ class OAuthFlows(BaseModel): - """Allows configuration of the supported OAuth Flows.""" + """ + Allows configuration of the supported OAuth Flows + """ authorizationCode: AuthorizationCodeOAuthFlow | None = None - """Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.""" + """ + Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. + """ clientCredentials: ClientCredentialsOAuthFlow | None = None - """Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.""" + """ + Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0 + """ implicit: ImplicitOAuthFlow | None = None - """Configuration for the OAuth Implicit flow.""" + """ + Configuration for the OAuth Implicit flow + """ password: PasswordOAuthFlow | None = None - """Configuration for the OAuth Resource Owner Password flow.""" + """ + Configuration for the OAuth Resource Owner Password flow + """ class Part(RootModel[TextPart | FilePart | DataPart]): - """Represents a part of a message, which can be text, a file, or structured data.""" - root: TextPart | FilePart | DataPart + """ + Represents a part of a message, which can be text, a file, or structured data. + """ -class SetTaskPushNotificationConfigRequest(JSONRPCRequest): - """JSON-RPC request model for the 'tasks/pushNotificationConfig/set' method.""" +class SetTaskPushNotificationConfigRequest(BaseModel): + """ + JSON-RPC request model for the 'tasks/pushNotificationConfig/set' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['tasks/pushNotificationConfig/set'] = ( 'tasks/pushNotificationConfig/set' ) - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: TaskPushNotificationConfig - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ -class SetTaskPushNotificationConfigSuccessResponse(JSONRPCResult): - """JSON-RPC success response model for the 'tasks/pushNotificationConfig/set' method.""" +class SetTaskPushNotificationConfigSuccessResponse(BaseModel): + """ + JSON-RPC success response model for the 'tasks/pushNotificationConfig/set' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: TaskPushNotificationConfig - """The result object on success.""" + """ + The result object on success. + """ class Artifact(BaseModel): - """Represents an artifact generated for a task task.""" + """ + Represents an artifact generated for a task task. + """ artifactId: str - """Unique identifier for the artifact.""" + """ + Unique identifier for the artifact. + """ description: str | None = None - """Optional description for the artifact.""" + """ + Optional description for the artifact. + """ metadata: dict[str, Any] | None = None - """Extension metadata.""" + """ + Extension metadata. + """ name: str | None = None - """Optional name for the artifact.""" + """ + Optional name for the artifact. + """ parts: list[Part] - """Artifact parts.""" + """ + Artifact parts. + """ class GetTaskPushNotificationConfigResponse( - RootModel[ - JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse - ] + RootModel[JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse] ): - """JSON-RPC response for the 'tasks/pushNotificationConfig/get' method.""" - root: JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse + """ + JSON-RPC response for the 'tasks/pushNotificationConfig/set' method. + """ class Message(BaseModel): - """Represents a single message exchanged between user and agent.""" + """ + Represents a single message exchanged between user and agent. + """ contextId: str | None = None - """The context the message is associated with.""" + """ + The context the message is associated with + """ kind: Literal['message'] = 'message' - """Event type.""" + """ + Event type + """ messageId: str - """Identifier created by the message creator.""" + """ + Identifier created by the message creator + """ metadata: dict[str, Any] | None = None - """Extension metadata.""" + """ + Extension metadata. + """ parts: list[Part] - """Message content.""" + """ + Message content + """ referenceTaskIds: list[str] | None = None """ list of tasks referenced as context by this message. """ role: Role - """Message sender's role.""" + """ + Message sender's role + """ taskId: str | None = None - """Identifier of task the message is related to.""" - final: bool | None = None - """Indicates if this is the final message in a stream.""" + """ + Identifier of task the message is related to + """ class MessageSendParams(BaseModel): - """Sent by the client to the agent as a request. May create, continue or restart a task.""" + """ + Sent by the client to the agent as a request. May create, continue or restart a task. + """ configuration: MessageSendConfiguration | None = None - """Send message configuration.""" + """ + Send message configuration. + """ message: Message - """The message being sent to the server.""" + """ + The message being sent to the server. + """ metadata: dict[str, Any] | None = None - """Extension metadata.""" + """ + Extension metadata. + """ class OAuth2SecurityScheme(BaseModel): - """OAuth2.0 security scheme configuration.""" + """ + OAuth2.0 security scheme configuration. + """ description: str | None = None - """Description of this security scheme.""" + """ + Description of this security scheme. + """ flows: OAuthFlows - """An object containing configuration information for the flow types supported.""" + """ + An object containing configuration information for the flow types supported. + """ type: Literal['oauth2'] = 'oauth2' @@ -654,88 +1178,155 @@ class SecurityScheme( | OpenIdConnectSecurityScheme ] ): - """Mirrors the OpenAPI Security Scheme Object (https://swagger.io/specification/#security-scheme-object).""" - root: ( APIKeySecurityScheme | HTTPAuthSecurityScheme | OAuth2SecurityScheme | OpenIdConnectSecurityScheme ) + """ + Mirrors the OpenAPI Security Scheme Object + (https://swagger.io/specification/#security-scheme-object) + """ -class SendMessageRequest(JSONRPCRequest): - """JSON-RPC request model for the 'message/send' method.""" +class SendMessageRequest(BaseModel): + """ + JSON-RPC request model for the 'message/send' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['message/send'] = 'message/send' - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: MessageSendParams - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ -class SendStreamingMessageRequest(JSONRPCRequest): - """JSON-RPC request model for the 'message/stream' method.""" +class SendStreamingMessageRequest(BaseModel): + """ + JSON-RPC request model for the 'message/stream' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ method: Literal['message/stream'] = 'message/stream' - """A String containing the name of the method to be invoked.""" + """ + A String containing the name of the method to be invoked. + """ params: MessageSendParams - """A Structured value that holds the parameter values to be used during the invocation of the method.""" + """ + A Structured value that holds the parameter values to be used during the invocation of the method. + """ class SetTaskPushNotificationConfigResponse( - RootModel[ - JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse - ] + RootModel[JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse] ): - """JSON-RPC response for the 'tasks/pushNotificationConfig/set' method.""" - root: JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse + """ + JSON-RPC response for the 'tasks/pushNotificationConfig/set' method. + """ class TaskArtifactUpdateEvent(BaseModel): - """Event sent by server during sendStream or subscribe requests indicating an artifact update.""" + """ + sent by server during sendStream or subscribe requests + """ append: bool | None = None - """Indicates if this artifact appends to a previous one.""" + """ + Indicates if this artifact appends to a previous one + """ artifact: Artifact - """Generated artifact.""" + """ + Generated artifact + """ contextId: str - """The context the task is associated with.""" + """ + The context the task is associated with + """ kind: Literal['artifact-update'] = 'artifact-update' - """Event type.""" + """ + Event type + """ lastChunk: bool | None = None - """Indicates if this is the last chunk of the artifact.""" + """ + Indicates if this is the last chunk of the artifact + """ metadata: dict[str, Any] | None = None - """Extension metadata.""" + """ + Extension metadata. + """ taskId: str - """Task id.""" + """ + Task id + """ class TaskStatus(BaseModel): - """TaskState and accompanying message.""" + """ + TaskState and accompanying message. + """ message: Message | None = None - """Additional status updates for client.""" + """ + Additional status updates for client + """ state: TaskState timestamp: str | None = None - """ISO 8601 datetime string when the status was recorded.""" + """ + ISO 8601 datetime string when the status was recorded. + """ class TaskStatusUpdateEvent(BaseModel): - """Event sent by server during sendStream or subscribe requests indicating a status update.""" + """ + sent by server during sendStream or subscribe requests + """ contextId: str - """The context the task is associated with.""" + """ + The context the task is associated with + """ final: bool - """Indicates the end of the event stream for this task (implies the task is finished or failed).""" + """ + Indicates the end of the event stream + """ kind: Literal['status-update'] = 'status-update' - """Event type.""" + """ + Event type + """ metadata: dict[str, Any] | None = None - """Extension metadata.""" + """ + Extension metadata. + """ status: TaskStatus - """Current status of the task.""" + """ + Current status of the task + """ taskId: str - """Task id.""" + """ + Task id + """ class A2ARequest( @@ -749,8 +1340,6 @@ class A2ARequest( | TaskResubscriptionRequest ] ): - """A2A supported request types.""" - root: ( SendMessageRequest | SendStreamingMessageRequest @@ -760,12 +1349,14 @@ class A2ARequest( | GetTaskPushNotificationConfigRequest | TaskResubscriptionRequest ) + """ + A2A supported request types + """ class AgentCard(BaseModel): - """An AgentCard conveys key information about an agent. - - Includes: + """ + An AgentCard conveys key information: - Overall details (version, name, description, uses) - Skills: A set of capabilities the agent can perform - Default modalities/content types supported by the agent. @@ -773,90 +1364,178 @@ class AgentCard(BaseModel): """ capabilities: AgentCapabilities - """Optional capabilities supported by the agent.""" + """ + Optional capabilities supported by the agent. + """ defaultInputModes: list[str] - """The set of interaction modes that the agent supports across all skills. This can be overridden per-skill. Supported mime types for input.""" + """ + The set of interaction modes that the agent + supports across all skills. This can be overridden per-skill. + Supported mime types for input. + """ defaultOutputModes: list[str] - """Supported mime types for output.""" + """ + Supported mime types for output. + """ description: str - """A human-readable description of the agent. Used to assist users and other agents in understanding what the agent can do.""" + """ + A human-readable description of the agent. Used to assist users and + other agents in understanding what the agent can do. + """ documentationUrl: str | None = None - """A URL to documentation for the agent.""" + """ + A URL to documentation for the agent. + """ name: str - """Human readable name of the agent.""" + """ + Human readable name of the agent. + """ provider: AgentProvider | None = None - """The service provider of the agent.""" + """ + The service provider of the agent + """ security: list[dict[str, list[str]]] | None = None - """Security requirements for contacting the agent.""" + """ + Security requirements for contacting the agent. + """ securitySchemes: dict[str, SecurityScheme] | None = None - """Security scheme details used for authenticating with this agent.""" + """ + Security scheme details used for authenticating with this agent. + """ skills: list[AgentSkill] - """Skills are a unit of capability that an agent can perform.""" + """ + Skills are a unit of capability that an agent can perform. + """ url: str - """A URL to the address the agent is hosted at.""" + """ + A URL to the address the agent is hosted at. + """ version: str - """The version of the agent - format is up to the provider.""" + """ + The version of the agent - format is up to the provider. + """ class Task(BaseModel): - """Represents a task managed by the agent.""" - artifacts: list[Artifact] | None = None - """Collection of artifacts created by the agent.""" + """ + Collection of artifacts created by the agent. + """ contextId: str - """Server-generated id for contextual alignment across interactions.""" + """ + Server-generated id for contextual alignment across interactions + """ history: list[Message] | None = None - """History of messages associated with the task.""" id: str - """Unique identifier for the task.""" + """ + Unique identifier for the task + """ kind: Literal['task'] = 'task' - """Event type.""" + """ + Event type + """ metadata: dict[str, Any] | None = None - """Extension metadata.""" + """ + Extension metadata. + """ status: TaskStatus - """Current status of the task.""" + """ + Current status of the task + """ -class CancelTaskSuccessResponse(JSONRPCResult): - """JSON-RPC success response model for the 'tasks/cancel' method.""" +class CancelTaskSuccessResponse(BaseModel): + """ + JSON-RPC success response model for the 'tasks/cancel' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: Task - """The result object on success.""" + """ + The result object on success. + """ -class GetTaskSuccessResponse(JSONRPCResult): - """JSON-RPC success response for the 'tasks/get' method.""" +class GetTaskSuccessResponse(BaseModel): + """ + JSON-RPC success response for the 'tasks/get' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: Task - """The result object on success.""" + """ + The result object on success. + """ -class SendMessageSuccessResponse(JSONRPCResult): - """JSON-RPC success response model for the 'message/send' method.""" +class SendMessageSuccessResponse(BaseModel): + """ + JSON-RPC success response model for the 'message/send' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: Task | Message - """The result object on success.""" + """ + The result object on success + """ -class SendStreamingMessageSuccessResponse(JSONRPCResult): - """JSON-RPC success response model for the 'message/stream' method.""" +class SendStreamingMessageSuccessResponse(BaseModel): + """ + JSON-RPC success response model for the 'message/stream' method. + """ + id: str | int | None = None + """ + An identifier established by the Client that MUST contain a String, Number + Numbers SHOULD NOT contain fractional parts. + """ + jsonrpc: Literal['2.0'] = '2.0' + """ + Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0". + """ result: Task | Message | TaskStatusUpdateEvent | TaskArtifactUpdateEvent - """The result object on success.""" - + """ + The result object on success + """ -class CancelTaskResponse( - RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse] -): - """JSON-RPC response for the 'tasks/cancel' method.""" +class CancelTaskResponse(RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]): root: JSONRPCErrorResponse | CancelTaskSuccessResponse + """ + JSON-RPC response for the 'tasks/cancel' method. + """ class GetTaskResponse(RootModel[JSONRPCErrorResponse | GetTaskSuccessResponse]): - """JSON-RPC success response for the 'tasks/get' method.""" - root: JSONRPCErrorResponse | GetTaskSuccessResponse + """ + JSON-RPC success response for the 'tasks/get' method. + """ class JSONRPCResponse( @@ -870,8 +1549,6 @@ class JSONRPCResponse( | GetTaskPushNotificationConfigSuccessResponse ] ): - """Represents a JSON-RPC 2.0 Response object.""" - root: ( JSONRPCErrorResponse | SendMessageSuccessResponse @@ -881,19 +1558,22 @@ class JSONRPCResponse( | SetTaskPushNotificationConfigSuccessResponse | GetTaskPushNotificationConfigSuccessResponse ) + """ + Represents a JSON-RPC 2.0 Response object. + """ -class SendMessageResponse( - RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse] -): - """JSON-RPC response model for the 'message/send' method.""" - +class SendMessageResponse(RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]): root: JSONRPCErrorResponse | SendMessageSuccessResponse + """ + JSON-RPC response model for the 'message/send' method. + """ class SendStreamingMessageResponse( RootModel[JSONRPCErrorResponse | SendStreamingMessageSuccessResponse] ): - """JSON-RPC response model for the 'message/stream' method.""" - root: JSONRPCErrorResponse | SendStreamingMessageSuccessResponse + """ + JSON-RPC response model for the 'message/stream' method. + """