Python SDK Reference¶
This page contains SDK documentation for the a2a-sdk
Python package.
Client¶
Client-side components for interacting with an A2A agent.
A2ACardResolver
¶
Agent Card resolver.
agent_card_path = agent_card_path.lstrip('/')
instance-attribute
¶
base_url = base_url.rstrip('/')
instance-attribute
¶
httpx_client = httpx_client
instance-attribute
¶
get_agent_card(relative_card_path=None, http_kwargs=None)
async
¶
Fetches an agent card from a specified path relative to the base_url.
If relative_card_path is None, it defaults to the resolver's configured agent_card_path (for the public agent card).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relative_card_path
|
str | None
|
Optional path to the agent card endpoint, relative to the base URL. If None, uses the default public agent card path. |
None
|
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.get request. |
None
|
Returns:
Type | Description |
---|---|
AgentCard
|
An |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs during the request. |
A2AClientJSONError
|
If the response body cannot be decoded as JSON or validated against the AgentCard schema. |
A2AClient
¶
A2A Client for interacting with an A2A agent.
agent_card = agent_card
instance-attribute
¶
httpx_client = httpx_client
instance-attribute
¶
interceptors = interceptors or []
instance-attribute
¶
url = agent_card.url
instance-attribute
¶
cancel_task(request, *, http_kwargs=None, context=None)
async
¶
Requests the agent to cancel a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
CancelTaskRequest
|
The |
required |
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.post request. |
None
|
context
|
ClientCallContext | None
|
The client call context. |
None
|
Returns:
Type | Description |
---|---|
CancelTaskResponse
|
A |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs during the request. |
A2AClientJSONError
|
If the response body cannot be decoded as JSON or validated. |
get_client_from_agent_card_url(httpx_client, base_url, agent_card_path='/.well-known/agent.json', http_kwargs=None)
async
staticmethod
¶
Fetches the public AgentCard and initializes an A2A client.
This method will always fetch the public agent card. If an authenticated or extended agent card is required, the A2ACardResolver should be used directly to fetch the specific card, and then the A2AClient should be instantiated with it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
httpx_client
|
AsyncClient
|
An async HTTP client instance (e.g., httpx.AsyncClient). |
required |
base_url
|
str
|
The base URL of the agent's host. |
required |
agent_card_path
|
str
|
The path to the agent card endpoint, relative to the base URL. |
'/.well-known/agent.json'
|
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.get request when fetching the agent card. |
None
|
Returns:
Type | Description |
---|---|
A2AClient
|
An initialized |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs fetching the agent card. |
A2AClientJSONError
|
If the agent card response is invalid. |
get_task(request, *, http_kwargs=None, context=None)
async
¶
Retrieves the current state and history of a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
GetTaskRequest
|
The |
required |
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.post request. |
None
|
context
|
ClientCallContext | None
|
The client call context. |
None
|
Returns:
Type | Description |
---|---|
GetTaskResponse
|
A |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs during the request. |
A2AClientJSONError
|
If the response body cannot be decoded as JSON or validated. |
get_task_callback(request, *, http_kwargs=None, context=None)
async
¶
Retrieves the push notification configuration for a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
GetTaskPushNotificationConfigRequest
|
The |
required |
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.post request. |
None
|
context
|
ClientCallContext | None
|
The client call context. |
None
|
Returns:
Type | Description |
---|---|
GetTaskPushNotificationConfigResponse
|
A |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs during the request. |
A2AClientJSONError
|
If the response body cannot be decoded as JSON or validated. |
send_message(request, *, http_kwargs=None, context=None)
async
¶
Sends a non-streaming message request to the agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
SendMessageRequest
|
The |
required |
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.post request. |
None
|
context
|
ClientCallContext | None
|
The client call context. |
None
|
Returns:
Type | Description |
---|---|
SendMessageResponse
|
A |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs during the request. |
A2AClientJSONError
|
If the response body cannot be decoded as JSON or validated. |
send_message_streaming(request, *, http_kwargs=None, context=None)
async
¶
Sends a streaming message request to the agent and yields responses as they arrive.
This method uses Server-Sent Events (SSE) to receive a stream of updates from the agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
SendStreamingMessageRequest
|
The |
required |
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the
underlying httpx.post request. A default |
None
|
context
|
ClientCallContext | None
|
The client call context. |
None
|
Yields:
Type | Description |
---|---|
AsyncGenerator[SendStreamingMessageResponse]
|
|
AsyncGenerator[SendStreamingMessageResponse]
|
These can be Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent. |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP or SSE protocol error occurs during the request. |
A2AClientJSONError
|
If an SSE event data cannot be decoded as JSON or validated. |
set_task_callback(request, *, http_kwargs=None, context=None)
async
¶
Sets or updates the push notification configuration for a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
SetTaskPushNotificationConfigRequest
|
The |
required |
http_kwargs
|
dict[str, Any] | None
|
Optional dictionary of keyword arguments to pass to the underlying httpx.post request. |
None
|
context
|
ClientCallContext | None
|
The client call context. |
None
|
Returns:
Type | Description |
---|---|
SetTaskPushNotificationConfigResponse
|
A |
Raises:
Type | Description |
---|---|
A2AClientHTTPError
|
If an HTTP error occurs during the request. |
A2AClientJSONError
|
If the response body cannot be decoded as JSON or validated. |
A2AClientError
¶
Bases: Exception
Base exception for A2A Client errors.
A2AClientHTTPError
¶
Bases: A2AClientError
Client exception for HTTP errors received from the server.
A2AClientJSONError
¶
Bases: A2AClientError
Client exception for JSON errors during response parsing or validation.
message = message
instance-attribute
¶
A2AGrpcClient
¶
A2A Client for interacting with an A2A agent via gRPC.
agent_card = agent_card
instance-attribute
¶
stub = grpc_stub
instance-attribute
¶
cancel_task(request)
async
¶
Requests the agent to cancel a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
TaskIdParams
|
The |
required |
Returns:
Type | Description |
---|---|
Task
|
A |
get_task(request)
async
¶
Retrieves the current state and history of a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
TaskQueryParams
|
The |
required |
Returns:
Type | Description |
---|---|
Task
|
A |
get_task_callback(request)
async
¶
Retrieves the push notification configuration for a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
TaskIdParams
|
The |
required |
Returns:
Type | Description |
---|---|
TaskPushNotificationConfig
|
A |
send_message(request)
async
¶
Sends a non-streaming message request to the agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
MessageSendParams
|
The |
required |
Returns:
Type | Description |
---|---|
Task | Message
|
A |
send_message_streaming(request)
async
¶
Sends a streaming message request to the agent and yields responses as they arrive.
This method uses gRPC streams to receive a stream of updates from the agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
MessageSendParams
|
The |
required |
Yields:
Type | Description |
---|---|
AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]
|
|
AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]
|
|
AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]
|
stream. |
set_task_callback(request)
async
¶
Sets or updates the push notification configuration for a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
TaskPushNotificationConfig
|
The |
required |
Returns:
Type | Description |
---|---|
TaskPushNotificationConfig
|
A |
AuthInterceptor
¶
Bases: ClientCallInterceptor
An interceptor that automatically adds authentication details to requests.
Based on the agent's security schemes.
intercept(method_name, request_payload, http_kwargs, agent_card, context)
async
¶
Applies authentication headers to the request if credentials are available.
ClientCallContext
¶
Bases: BaseModel
A context passed with each client call, allowing for call-specific.
configuration and data passing. Such as authentication details or request deadlines.
state = Field(default_factory=dict)
class-attribute
instance-attribute
¶
ClientCallInterceptor
¶
Bases: ABC
An abstract base class for client-side call interceptors.
Interceptors can inspect and modify requests before they are sent, which is ideal for concerns like authentication, logging, or tracing.
intercept(method_name, request_payload, http_kwargs, agent_card, context)
abstractmethod
async
¶
Intercepts a client call before the request is sent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method_name
|
str
|
The name of the RPC method (e.g., 'message/send'). |
required |
request_payload
|
dict[str, Any]
|
The JSON RPC request payload dictionary. |
required |
http_kwargs
|
dict[str, Any]
|
The keyword arguments for the httpx request. |
required |
agent_card
|
AgentCard | None
|
The AgentCard associated with the client. |
required |
context
|
ClientCallContext | None
|
The ClientCallContext for this specific call. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
A tuple containing the (potentially modified) request_payload |
dict[str, Any]
|
and http_kwargs. |
CredentialService
¶
Bases: ABC
An abstract service for retrieving credentials.
get_credentials(security_scheme_name, context)
abstractmethod
async
¶
Retrieves a credential (e.g., token) for a security scheme.
InMemoryContextCredentialStore
¶
Bases: CredentialService
A simple in-memory store for session-keyed credentials.
This class uses the 'sessionId' from the ClientCallContext state to store and retrieve credentials...
get_credentials(security_scheme_name, context)
async
¶
Retrieves credentials from the in-memory store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
security_scheme_name
|
str
|
The name of the security scheme. |
required |
context
|
ClientCallContext | None
|
The client call context. |
required |
Returns:
Type | Description |
---|---|
str | None
|
The credential string, or None if not found. |
set_credentials(session_id, security_scheme_name, credential)
async
¶
Method to populate the store.
create_text_message_object(role=Role.user, content='')
¶
Create a Message object containing a single TextPart.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role
|
Role
|
The role of the message sender (user or agent). Defaults to Role.user. |
user
|
content
|
str
|
The text content of the message. Defaults to an empty string. |
''
|
Returns:
Type | Description |
---|---|
Message
|
A |
Server¶
Types¶
A2AError
¶
Bases: RootModel[JSONParseError | InvalidRequestError | MethodNotFoundError | InvalidParamsError | InternalError | TaskNotFoundError | TaskNotCancelableError | PushNotificationNotSupportedError | UnsupportedOperationError | ContentTypeNotSupportedError | InvalidAgentResponseError]
root
instance-attribute
¶
A2ARequest
¶
Bases: RootModel[SendMessageRequest | SendStreamingMessageRequest | GetTaskRequest | CancelTaskRequest | SetTaskPushNotificationConfigRequest | GetTaskPushNotificationConfigRequest | TaskResubscriptionRequest | ListTaskPushNotificationConfigRequest | DeleteTaskPushNotificationConfigRequest]
root
instance-attribute
¶
A2A supported request types
APIKeySecurityScheme
¶
Bases: BaseModel
API Key security scheme.
description = None
class-attribute
instance-attribute
¶
Description of this security scheme.
in_ = Field(..., alias='in')
class-attribute
instance-attribute
¶
The location of the API key. Valid values are "query", "header", or "cookie".
name
instance-attribute
¶
The name of the header, query or cookie parameter to be used.
type = 'apiKey'
class-attribute
instance-attribute
¶
AgentCapabilities
¶
Bases: BaseModel
Defines optional capabilities supported by an agent.
extensions = None
class-attribute
instance-attribute
¶
extensions supported by this agent.
pushNotifications = None
class-attribute
instance-attribute
¶
true if the agent can notify updates to client.
stateTransitionHistory = None
class-attribute
instance-attribute
¶
true if the agent exposes status change history for tasks.
streaming = None
class-attribute
instance-attribute
¶
true if the agent supports SSE.
AgentCard
¶
Bases: BaseModel
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. - Authentication requirements
additionalInterfaces = None
class-attribute
instance-attribute
¶
Announcement of additional supported transports. Client can use any of the supported transports.
capabilities
instance-attribute
¶
Optional capabilities supported by the agent.
defaultInputModes
instance-attribute
¶
The set of interaction modes that the agent supports across all skills. This can be overridden per-skill. Supported media types for input.
defaultOutputModes
instance-attribute
¶
Supported media types for output.
description
instance-attribute
¶
A human-readable description of the agent. Used to assist users and other agents in understanding what the agent can do.
documentationUrl = None
class-attribute
instance-attribute
¶
A URL to documentation for the agent.
iconUrl = None
class-attribute
instance-attribute
¶
A URL to an icon for the agent.
name
instance-attribute
¶
Human readable name of the agent.
preferredTransport = None
class-attribute
instance-attribute
¶
The transport of the preferred endpoint. If empty, defaults to JSONRPC.
provider = None
class-attribute
instance-attribute
¶
The service provider of the agent
security = None
class-attribute
instance-attribute
¶
Security requirements for contacting the agent.
securitySchemes = None
class-attribute
instance-attribute
¶
Security scheme details used for authenticating with this agent.
skills
instance-attribute
¶
Skills are a unit of capability that an agent can perform.
supportsAuthenticatedExtendedCard = None
class-attribute
instance-attribute
¶
true if the agent supports providing an extended agent card when the user is authenticated. Defaults to false if not specified.
url
instance-attribute
¶
A URL to the address the agent is hosted at. This represents the preferred endpoint as declared by the agent.
version
instance-attribute
¶
The version of the agent - format is up to the provider.
AgentExtension
¶
Bases: BaseModel
A declaration of an extension supported by an Agent.
description = None
class-attribute
instance-attribute
¶
A description of how this agent uses this extension.
params = None
class-attribute
instance-attribute
¶
Optional configuration for the extension.
required = None
class-attribute
instance-attribute
¶
Whether the client must follow specific requirements of the extension.
uri
instance-attribute
¶
The URI of the extension.
AgentInterface
¶
Bases: BaseModel
AgentInterface provides a declaration of a combination of the target url and the supported transport to interact with the agent.
AgentProvider
¶
AgentSkill
¶
Bases: BaseModel
Represents a unit of capability that an agent can perform.
description
instance-attribute
¶
Description of the skill - will be used by the client or a human as a hint to understand what the skill does.
examples = None
class-attribute
instance-attribute
¶
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
instance-attribute
¶
Unique identifier for the agent's skill.
inputModes = None
class-attribute
instance-attribute
¶
The set of interaction modes that the skill supports (if different than the default). Supported media types for input.
name
instance-attribute
¶
Human readable name of the skill.
outputModes = None
class-attribute
instance-attribute
¶
Supported media types for output.
tags
instance-attribute
¶
Set of tagwords describing classes of capabilities for this specific skill.
Artifact
¶
Bases: BaseModel
Represents an artifact generated for a task.
artifactId
instance-attribute
¶
Unique identifier for the artifact.
description = None
class-attribute
instance-attribute
¶
Optional description for the artifact.
extensions = None
class-attribute
instance-attribute
¶
The URIs of extensions that are present or contributed to this Artifact.
metadata = None
class-attribute
instance-attribute
¶
Extension metadata.
name = None
class-attribute
instance-attribute
¶
Optional name for the artifact.
parts
instance-attribute
¶
Artifact parts.
AuthorizationCodeOAuthFlow
¶
Bases: BaseModel
Configuration details for a supported OAuth Flow
authorizationUrl
instance-attribute
¶
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 = None
class-attribute
instance-attribute
¶
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
instance-attribute
¶
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
instance-attribute
¶
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.
CancelTaskRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/cancel' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/cancel'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
CancelTaskResponse
¶
Bases: RootModel[JSONRPCErrorResponse | CancelTaskSuccessResponse]
root
instance-attribute
¶
JSON-RPC response for the 'tasks/cancel' method.
CancelTaskSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'tasks/cancel' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success.
ClientCredentialsOAuthFlow
¶
Bases: BaseModel
Configuration details for a supported OAuth Flow
refreshUrl = None
class-attribute
instance-attribute
¶
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
instance-attribute
¶
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
instance-attribute
¶
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.
ContentTypeNotSupportedError
¶
Bases: BaseModel
A2A specific error indicating incompatible content types between request and agent capabilities.
code = -32005
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Incompatible content types'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
DataPart
¶
Bases: BaseModel
Represents a structured data segment within a message part.
DeleteTaskPushNotificationConfigParams
¶
DeleteTaskPushNotificationConfigRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/pushNotificationConfig/delete' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/pushNotificationConfig/delete'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
DeleteTaskPushNotificationConfigResponse
¶
Bases: RootModel[JSONRPCErrorResponse | DeleteTaskPushNotificationConfigSuccessResponse]
root
instance-attribute
¶
JSON-RPC response for the 'tasks/pushNotificationConfig/delete' method.
DeleteTaskPushNotificationConfigSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'tasks/pushNotificationConfig/delete' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success.
FileBase
¶
FilePart
¶
FileWithBytes
¶
Bases: BaseModel
Define the variant where 'bytes' is present and 'uri' is absent
FileWithUri
¶
GetTaskPushNotificationConfigParams
¶
GetTaskPushNotificationConfigRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/pushNotificationConfig/get' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/pushNotificationConfig/get'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method. TaskIdParams type is deprecated for this method
GetTaskPushNotificationConfigResponse
¶
Bases: RootModel[JSONRPCErrorResponse | GetTaskPushNotificationConfigSuccessResponse]
root
instance-attribute
¶
JSON-RPC response for the 'tasks/pushNotificationConfig/set' method.
GetTaskPushNotificationConfigSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'tasks/pushNotificationConfig/get' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success.
GetTaskRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/get' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/get'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
GetTaskResponse
¶
Bases: RootModel[JSONRPCErrorResponse | GetTaskSuccessResponse]
root
instance-attribute
¶
JSON-RPC response for the 'tasks/get' method.
GetTaskSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response for the 'tasks/get' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success.
HTTPAuthSecurityScheme
¶
Bases: BaseModel
HTTP Authentication security scheme.
bearerFormat = None
class-attribute
instance-attribute
¶
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 = None
class-attribute
instance-attribute
¶
Description of this security scheme.
scheme
instance-attribute
¶
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 = 'http'
class-attribute
instance-attribute
¶
ImplicitOAuthFlow
¶
Bases: BaseModel
Configuration details for a supported OAuth Flow
authorizationUrl
instance-attribute
¶
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 = None
class-attribute
instance-attribute
¶
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
instance-attribute
¶
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.
In
¶
InternalError
¶
Bases: BaseModel
JSON-RPC error indicating an internal JSON-RPC error on the server.
code = -32603
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Internal error'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
InvalidAgentResponseError
¶
Bases: BaseModel
A2A specific error indicating agent returned invalid response for the current method
code = -32006
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Invalid agent response'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
InvalidParamsError
¶
Bases: BaseModel
JSON-RPC error indicating invalid method parameter(s).
code = -32602
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Invalid parameters'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
InvalidRequestError
¶
Bases: BaseModel
JSON-RPC error indicating the JSON sent is not a valid Request object.
code = -32600
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Request payload validation error'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
JSONParseError
¶
Bases: BaseModel
JSON-RPC error indicating invalid JSON was received by the server.
code = -32700
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Invalid JSON payload'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
JSONRPCError
¶
Bases: BaseModel
Represents a JSON-RPC 2.0 Error object. This is typically included in a JSONRPCErrorResponse when an error occurs.
code
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message
instance-attribute
¶
A String providing a short description of the error.
JSONRPCErrorResponse
¶
Bases: BaseModel
Represents a JSON-RPC 2.0 Error Response object.
error
instance-attribute
¶
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
JSONRPCMessage
¶
Bases: BaseModel
Base interface for any JSON-RPC 2.0 request or response.
JSONRPCRequest
¶
Bases: BaseModel
Represents a JSON-RPC 2.0 Request object.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method
instance-attribute
¶
A String containing the name of the method to be invoked.
params = None
class-attribute
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
JSONRPCResponse
¶
Bases: RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse | SendStreamingMessageSuccessResponse | GetTaskSuccessResponse | CancelTaskSuccessResponse | SetTaskPushNotificationConfigSuccessResponse | GetTaskPushNotificationConfigSuccessResponse]
root
instance-attribute
¶
Represents a JSON-RPC 2.0 Response object.
JSONRPCSuccessResponse
¶
Bases: BaseModel
Represents a JSON-RPC 2.0 Success Response object.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success
ListTaskPushNotificationConfigParams
¶
ListTaskPushNotificationConfigRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/pushNotificationConfig/list' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/pushNotificationConfig/list'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
ListTaskPushNotificationConfigResponse
¶
Bases: RootModel[JSONRPCErrorResponse | ListTaskPushNotificationConfigSuccessResponse]
root
instance-attribute
¶
JSON-RPC response for the 'tasks/pushNotificationConfig/list' method.
ListTaskPushNotificationConfigSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'tasks/pushNotificationConfig/list' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success.
Message
¶
Bases: BaseModel
Represents a single message exchanged between user and agent.
contextId = None
class-attribute
instance-attribute
¶
The context the message is associated with
extensions = None
class-attribute
instance-attribute
¶
The URIs of extensions that are present or contributed to this Message.
kind = 'message'
class-attribute
instance-attribute
¶
Event type
messageId
instance-attribute
¶
Identifier created by the message creator
metadata = None
class-attribute
instance-attribute
¶
Extension metadata.
parts
instance-attribute
¶
Message content
referenceTaskIds = None
class-attribute
instance-attribute
¶
List of tasks referenced as context by this message.
role
instance-attribute
¶
Message sender's role
taskId = None
class-attribute
instance-attribute
¶
Identifier of task the message is related to
MessageSendConfiguration
¶
Bases: BaseModel
Configuration for the send message request.
acceptedOutputModes
instance-attribute
¶
Accepted output modalities by the client.
blocking = None
class-attribute
instance-attribute
¶
If the server should treat the client as a blocking request.
historyLength = None
class-attribute
instance-attribute
¶
Number of recent messages to be retrieved.
pushNotificationConfig = None
class-attribute
instance-attribute
¶
Where the server should send notifications when disconnected.
MessageSendParams
¶
Bases: BaseModel
Sent by the client to the agent as a request. May create, continue or restart a task.
MethodNotFoundError
¶
Bases: BaseModel
JSON-RPC error indicating the method does not exist or is not available.
code = -32601
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Method not found'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
OAuth2SecurityScheme
¶
Bases: BaseModel
OAuth2.0 security scheme configuration.
OAuthFlows
¶
Bases: BaseModel
Allows configuration of the supported OAuth Flows
authorizationCode = None
class-attribute
instance-attribute
¶
Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
clientCredentials = None
class-attribute
instance-attribute
¶
Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0
implicit = None
class-attribute
instance-attribute
¶
Configuration for the OAuth Implicit flow
password = None
class-attribute
instance-attribute
¶
Configuration for the OAuth Resource Owner Password flow
OpenIdConnectSecurityScheme
¶
Bases: BaseModel
OpenID Connect security scheme configuration.
Part
¶
PartBase
¶
Bases: BaseModel
Base properties common to all message parts.
metadata = None
class-attribute
instance-attribute
¶
Optional metadata associated with the part.
PasswordOAuthFlow
¶
Bases: BaseModel
Configuration details for a supported OAuth Flow
refreshUrl = None
class-attribute
instance-attribute
¶
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
instance-attribute
¶
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
instance-attribute
¶
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.
PushNotificationAuthenticationInfo
¶
PushNotificationConfig
¶
Bases: BaseModel
Configuration for setting up push notifications for task updates.
authentication = None
class-attribute
instance-attribute
¶
id = None
class-attribute
instance-attribute
¶
Push Notification ID - created by server to support multiple callbacks
token = None
class-attribute
instance-attribute
¶
Token unique to this task/session.
url
instance-attribute
¶
URL for sending the push notifications.
PushNotificationNotSupportedError
¶
Bases: BaseModel
A2A specific error indicating the agent does not support push notifications.
code = -32003
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Push Notification is not supported'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
Role
¶
SecurityScheme
¶
Bases: RootModel[APIKeySecurityScheme | HTTPAuthSecurityScheme | OAuth2SecurityScheme | OpenIdConnectSecurityScheme]
root
instance-attribute
¶
Mirrors the OpenAPI Security Scheme Object (https://swagger.io/specification/#security-scheme-object)
SecuritySchemeBase
¶
Bases: BaseModel
Base properties shared by all security schemes.
description = None
class-attribute
instance-attribute
¶
Description of this security scheme.
SendMessageRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'message/send' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'message/send'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
SendMessageResponse
¶
Bases: RootModel[JSONRPCErrorResponse | SendMessageSuccessResponse]
root
instance-attribute
¶
JSON-RPC response model for the 'message/send' method.
SendMessageSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'message/send' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success
SendStreamingMessageRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'message/stream' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'message/stream'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
SendStreamingMessageResponse
¶
Bases: RootModel[JSONRPCErrorResponse | SendStreamingMessageSuccessResponse]
root
instance-attribute
¶
JSON-RPC response model for the 'message/stream' method.
SendStreamingMessageSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'message/stream' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success
SetTaskPushNotificationConfigRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/pushNotificationConfig/set' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/pushNotificationConfig/set'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
SetTaskPushNotificationConfigResponse
¶
Bases: RootModel[JSONRPCErrorResponse | SetTaskPushNotificationConfigSuccessResponse]
root
instance-attribute
¶
JSON-RPC response for the 'tasks/pushNotificationConfig/set' method.
SetTaskPushNotificationConfigSuccessResponse
¶
Bases: BaseModel
JSON-RPC success response model for the 'tasks/pushNotificationConfig/set' method.
id = None
class-attribute
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
result
instance-attribute
¶
The result object on success.
Task
¶
Bases: BaseModel
artifacts = None
class-attribute
instance-attribute
¶
Collection of artifacts created by the agent.
contextId
instance-attribute
¶
Server-generated id for contextual alignment across interactions
history = None
class-attribute
instance-attribute
¶
id
instance-attribute
¶
Unique identifier for the task
kind = 'task'
class-attribute
instance-attribute
¶
Event type
metadata = None
class-attribute
instance-attribute
¶
Extension metadata.
status
instance-attribute
¶
Current status of the task
TaskArtifactUpdateEvent
¶
Bases: BaseModel
Sent by server during sendStream or subscribe requests
append = None
class-attribute
instance-attribute
¶
Indicates if this artifact appends to a previous one
artifact
instance-attribute
¶
Generated artifact
contextId
instance-attribute
¶
The context the task is associated with
kind = 'artifact-update'
class-attribute
instance-attribute
¶
Event type
lastChunk = None
class-attribute
instance-attribute
¶
Indicates if this is the last chunk of the artifact
metadata = None
class-attribute
instance-attribute
¶
Extension metadata.
taskId
instance-attribute
¶
Task id
TaskIdParams
¶
TaskNotCancelableError
¶
Bases: BaseModel
A2A specific error indicating the task is in a state where it cannot be canceled.
code = -32002
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Task cannot be canceled'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
TaskNotFoundError
¶
Bases: BaseModel
A2A specific error indicating the requested task ID was not found.
code = -32001
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'Task not found'
class-attribute
instance-attribute
¶
A String providing a short description of the error.
TaskPushNotificationConfig
¶
TaskQueryParams
¶
TaskResubscriptionRequest
¶
Bases: BaseModel
JSON-RPC request model for the 'tasks/resubscribe' method.
id
instance-attribute
¶
An identifier established by the Client that MUST contain a String, Number. Numbers SHOULD NOT contain fractional parts.
jsonrpc = '2.0'
class-attribute
instance-attribute
¶
Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
method = 'tasks/resubscribe'
class-attribute
instance-attribute
¶
A String containing the name of the method to be invoked.
params
instance-attribute
¶
A Structured value that holds the parameter values to be used during the invocation of the method.
TaskState
¶
Bases: str
, Enum
Represents the possible states of a Task.
auth_required = 'auth-required'
class-attribute
instance-attribute
¶
canceled = 'canceled'
class-attribute
instance-attribute
¶
completed = 'completed'
class-attribute
instance-attribute
¶
failed = 'failed'
class-attribute
instance-attribute
¶
input_required = 'input-required'
class-attribute
instance-attribute
¶
rejected = 'rejected'
class-attribute
instance-attribute
¶
submitted = 'submitted'
class-attribute
instance-attribute
¶
unknown = 'unknown'
class-attribute
instance-attribute
¶
working = 'working'
class-attribute
instance-attribute
¶
TaskStatus
¶
TaskStatusUpdateEvent
¶
Bases: BaseModel
Sent by server during sendStream or subscribe requests
contextId
instance-attribute
¶
The context the task is associated with
final
instance-attribute
¶
Indicates the end of the event stream
kind = 'status-update'
class-attribute
instance-attribute
¶
Event type
metadata = None
class-attribute
instance-attribute
¶
Extension metadata.
status
instance-attribute
¶
Current status of the task
taskId
instance-attribute
¶
Task id
TextPart
¶
UnsupportedOperationError
¶
Bases: BaseModel
A2A specific error indicating the requested operation is not supported by the agent.
code = -32004
class-attribute
instance-attribute
¶
A Number that indicates the error type that occurred.
data = None
class-attribute
instance-attribute
¶
A Primitive or Structured value that contains additional information about the error. This may be omitted.
message = 'This operation is not supported'
class-attribute
instance-attribute
¶
A String providing a short description of the error.