### Install a2a-sdk Source: https://a2a-protocol.org/latest/sdk/python/api/_sources/index.rst.txt Use this command to install the a2a-sdk Python package. ```sh pip install a2a-sdk ``` -------------------------------- ### get Method Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.tasks.inmemory_task_store.html Retrieves a specific task from the in-memory store by its ID. ```APIDOC async get(_task_id : str_, _context : ServerCallContext_) → Task | None Retrieves a task from the store by ID. ``` -------------------------------- ### ServiceParametersFactory.create_from Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.service_parameters.html Creates new ServiceParameters by starting with existing parameters and applying a list of updates. This allows for modification of pre-existing configurations. ```APIDOC ## ServiceParametersFactory.create_from ### Description Create new ServiceParameters from existing ones and apply updates. ### Method Signature `static create_from(_service_parameters : dict[str, str] | None, _updates : list[Callable[[dict[str, str]], None]]) -> dict[str, str]` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **service_parameters** (dict[str, str] | None) - Optional - Existing ServiceParameters to start from. - **updates** (list[Callable[[dict[str, str]], None]]) - Required - List of update functions to apply. ### Returns - dict[str, str] - New ServiceParameters dictionary. ``` -------------------------------- ### Get Task from Database Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.agent_execution.active_task.html Retrieves the task details from the database. ```python async get_task() -> Task ``` -------------------------------- ### minimal_agent_card Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.html Generates a minimal card to simplify bootstrapping client creation. This minimal card is not viable itself to interact with the remote agent. Instead, this is a shorthand way to take a known URL and transport option and interact with the get card endpoint of the agent server to get the correct agent card. This pattern is necessary for gRPC based card access as typically these servers won’t expose a well-known path card. ```APIDOC ## minimal_agent_card ### Description Generates a minimal card to simplify bootstrapping client creation. This minimal card is not viable itself to interact with the remote agent. Instead this is a shorthand way to take a known url and transport option and interact with the get card endpoint of the agent server to get the correct agent card. This pattern is necessary for gRPC based card access as typically these servers won’t expose a well known path card. ### Parameters #### Path Parameters - **url** (str) - Required - The URL of the agent. - **transports** (list[str] | None) - Optional - A list of transports to consider. ### Returns - **AgentCard** - A minimal AgentCard object. ``` -------------------------------- ### DatabasePushNotificationConfigStore.initialize Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.tasks.database_push_notification_config_store.html Initializes the database connection and creates the necessary table if it does not already exist. ```APIDOC ## initialize ### Description Initialize the database and create the table if needed. ### Method async initialize() ### Parameters None ``` -------------------------------- ### ActiveTask.start() Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.agent_execution.active_task.html Starts the active task. ```APIDOC ## ActiveTask.start() ### Description Starts the active task. ### Method `start()` ### Parameters None ``` -------------------------------- ### Start Active Task Background Processes Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.agent_execution.active_task.html Starts the background producer and consumer tasks for an ActiveTask. Uses a lock to ensure these tasks are singletons. The `create_task_if_missing` flag controls whether to create tasks if they don't already exist. ```python async start(_call_context : ServerCallContext_, _create_task_if_missing : bool = False_) -> None ``` -------------------------------- ### Create client using convenience function Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html A convenience function to create a client from a URL or AgentCard. It internally constructs a ClientFactory. ```python client = await a2a.client.client_factory.create_client('https://example.com') ``` -------------------------------- ### subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.jsonrpc_transport.html Reconnects to get task updates. ```APIDOC subscribe(_request : SubscribeToTaskRequest_, _*_ , _context : ClientCallContext | None = None_) → AsyncGenerator[StreamResponse] Reconnects to get task updates. ``` -------------------------------- ### create_client Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.html Function to create a client instance. ```APIDOC ## create_client() ### Description Function to create a client instance. ``` -------------------------------- ### ClientTransport.subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.transports.base.html Reconnects to get task updates. ```APIDOC ## subscribe ### Description Reconnects to get task updates. ### Method `async subscribe(_request: SubscribeToTaskRequest_, *_ , _context: ClientCallContext | None = None_) -> AsyncGenerator[StreamResponse]` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_request** (SubscribeToTaskRequest_) - The request to subscribe to task updates. - **_context** (ClientCallContext | None) - Optional client call context. ### Request Example ```python # Example usage (assuming necessary imports and setup) # async for update in client_transport.subscribe(request_object, context=context_object): # # Process task updates ``` ### Response #### Success Response (200) - **AsyncGenerator[StreamResponse]** - An asynchronous generator yielding `StreamResponse` objects for task updates. ``` -------------------------------- ### Create client from URL Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html Resolve an AgentCard from a URL and create a client. This is useful when the AgentCard is not readily available. ```python client = await factory.create_from_url('https://example.com') ``` -------------------------------- ### StarletteUser.user_name Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.routes.common.html Property to get the username of the current user. ```APIDOC ## StarletteUser.user_name ### Description Returns the user name of the current user. ### Parameters - None ### Returns - **str**: The username of the current user. ``` -------------------------------- ### ClientFactory.create Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html Create a new Client for the provided AgentCard. ```APIDOC ## ClientFactory.create ### Description Create a new Client for the provided AgentCard. ### Parameters * **card** (AgentCard) - An AgentCard defining the characteristics of the agent. * **interceptors** (list[ClientCallInterceptor] | None) - A list of interceptors to use for each request. These are used for things like attaching credentials or http headers to all outbound requests. ### Returns * Client - A Client object. ### Raises * ValueError - If there is no valid matching of the client configuration with the server configuration. ``` -------------------------------- ### Create ClientFactory instance Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html Instantiate ClientFactory with a ClientConfig. Custom transport producers can be registered using the register method. ```python factory = ClientFactory(config) factory.register('my_custom_transport', custom_transport_producer) ``` -------------------------------- ### subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.grpc_transport.html Reconnects to get task updates (v0.3). ```APIDOC ## subscribe ### Description Reconnects to get task updates (v0.3). ### Method async ### Parameters #### Path Parameters - `_request` (SubscribeToTaskRequest) - Description not available - `_*` - Keyword-only parameters separator #### Other Parameters - `_context` (ClientCallContext | None) - Description not available ### Return Value - AsyncGenerator[StreamResponse] ``` -------------------------------- ### create_client Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html Create a Client for an agent from a URL or AgentCard. ```APIDOC ## create_client ### Description Create a Client for an agent from a URL or AgentCard. Convenience function that constructs a ClientFactory internally. For reusing a factory across multiple agents or registering custom transports, use ClientFactory directly instead. ### Parameters * **agent** (str | AgentCard) - The base URL of the agent, or an AgentCard to use directly. * **client_config** (ClientConfig | None) - Optional ClientConfig. A default config is created if not provided. * **interceptors** (list[ClientCallInterceptor] | None) - A list of interceptors to use for each request. * **relative_card_path** (str | None) - The relative path when resolving the agent card. Only used when agent is a URL. * **resolver_http_kwargs** (dict[str, Any] | None) - Dictionary of arguments to provide to the httpx client when resolving the agent card. * **signature_verifier** (Callable[[AgentCard], None] | None) - A callable used to verify the agent card’s signatures. ### Returns * Client - A Client object. ``` -------------------------------- ### GetAuthenticatedExtendedCardResponse Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Response object for getting an authenticated extended card. ```APIDOC ## GetAuthenticatedExtendedCardResponse ### Description Response object for getting an authenticated extended card. ### Attributes * `model_config` (dict): Pydantic model configuration. * `root` (any): The result of the operation. ``` -------------------------------- ### run_migrations() Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.a2a_db_cli.html A command-line interface tool designed to manage database migrations. ```APIDOC ## run_migrations() ### Description CLI tool to manage database migrations. ### Method ```python run_migrations() ``` ### Returns - None ``` -------------------------------- ### GetAuthenticatedExtendedCardRequest Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Request object for getting an authenticated extended card. ```APIDOC ## GetAuthenticatedExtendedCardRequest ### Description Request object for getting an authenticated extended card. ### Attributes * `id` (str): The ID of the extended card. * `jsonrpc` (str): The JSON-RPC version. * `method` (str): The method name, typically 'get_authenticated_extended_card'. * `model_config` (dict): Pydantic model configuration. ``` -------------------------------- ### on_get_task Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.html Handles the 'tasks/get' method. Retrieves the state and history of a specific task. Requires a PushConfigStore to be configured. ```APIDOC ## on_get_task ### Description Handles the ‘tasks/get’ method. Retrieves the state and history of a specific task. ### Parameters - **_params** (GetTaskRequest_) - Parameters specifying the task ID and optionally history length. - **_context** (ServerCallContext_) - Context provided by the server. ### Returns - **Task | None** - The Task object if found, otherwise None. ``` -------------------------------- ### ClientFactory.create_from_url Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html Create a Client by resolving an AgentCard from a URL. ```APIDOC ## ClientFactory.create_from_url ### Description Create a Client by resolving an AgentCard from a URL. Resolves the agent card from the given URL using the factory’s configured httpx client, then creates a client via create. If the agent card is already available, use create directly instead. ### Parameters * **url** (str) - The base URL of the agent. The agent card will be fetched from /.well-known/agent-card.json by default. * **interceptors** (list[ClientCallInterceptor] | None) - A list of interceptors to use for each request. These are used for things like attaching credentials or http headers to all outbound requests. * **relative_card_path** (str | None) - The relative path when resolving the agent card. See A2ACardResolver.get_agent_card for details. * **resolver_http_kwargs** (dict[str, Any] | None) - Dictionary of arguments to provide to the httpx client when resolving the agent card. * **signature_verifier** (Callable[[AgentCard], None] | None) - A callable used to verify the agent card’s signatures. ### Returns * Client - A Client object. ``` -------------------------------- ### Proto Conversion Utilities Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.html Utilities for converting between dictionaries and Protocol Buffers messages. ```APIDOC ## Proto Conversion Utilities ### FromProto Utilities to convert Protocol Buffers messages to Python objects. #### agent_card() Converts a proto agent card to an object. #### agent_card_signature() Converts a proto agent card signature to an object. #### agent_extension() Converts a proto agent extension to an object. #### agent_interface() Converts a proto agent interface to an object. #### artifact() Converts a proto artifact to an object. #### authentication_info() Converts a proto authentication info to an object. #### capabilities() Converts a proto capabilities to an object. #### data() Converts a proto data to an object. #### file() Converts a proto file to an object. #### list_task_push_notification_config_response() Converts a proto list task push notification config response to an object. #### message() Converts a proto message to an object. #### message_send_configuration() Converts a proto message send configuration to an object. #### message_send_params() Converts a proto message send parameters to an object. #### metadata() Converts a proto metadata to an object. #### oauth2_flows() Converts a proto oauth2 flows to an object. #### part() Converts a proto part to an object. #### provider() Converts a proto provider to an object. #### push_notification_config() Converts a proto push notification config to an object. #### role() Converts a proto role to an object. #### security() Converts a proto security to an object. #### security_scheme() Converts a proto security scheme to an object. #### security_schemes() Converts a proto security schemes to an object. #### skill() Converts a proto skill to an object. #### stream_response() Converts a proto stream response to an object. #### task() Converts a proto task to an object. #### task_artifact_update_event() Converts a proto task artifact update event to an object. #### task_id_params() Converts a proto task id parameters to an object. #### task_or_message() Converts a proto task or message to an object. #### task_push_notification_config() Converts a proto task push notification config to an object. #### task_push_notification_config_request() Converts a proto task push notification config request to an object. #### task_query_params() Converts a proto task query parameters to an object. #### task_state() Converts a proto task state to an object. #### task_status() Converts a proto task status to an object. #### task_status_update_event() Converts a proto task status update event to an object. ### ToProto Utilities to convert Python objects to Protocol Buffers messages. #### agent_card() Converts an object agent card to proto. #### agent_card_signature() Converts an object agent card signature to proto. #### agent_interface() Converts an object agent interface to proto. #### artifact() Converts an object artifact to proto. #### authentication_info() Converts an object authentication info to proto. #### capabilities() Converts an object capabilities to proto. #### data() Converts an object data to proto. #### extension() Converts an object extension to proto. #### file() Converts an object file to proto. #### message() Converts an object message to proto. #### message_send_configuration() Converts an object message send configuration to proto. #### metadata() Converts an object metadata to proto. #### oauth2_flows() Converts an object oauth2 flows to proto. #### part() Converts an object part to proto. #### provider() Converts an object provider to proto. #### push_notification_config() Converts an object push notification config to proto. #### role() Converts an object role to proto. #### security() Converts an object security to proto. #### security_scheme() Converts an object security scheme to proto. #### security_schemes() Converts an object security schemes to proto. #### skill() Converts an object skill to proto. #### stream_response() Converts an object stream response to proto. #### task() Converts an object task to proto. #### task_artifact_update_event() Converts an object task artifact update event to proto. #### task_or_message() Converts an object task or message to proto. #### task_push_notification_config() Converts an object task push notification config to proto. #### task_state() Converts an object task state to proto. #### task_status() Converts an object task status to proto. #### task_status_update_event() Converts an object task status update event to proto. #### update_event() Converts an object update event to proto. ### dict_to_struct() Converts a dictionary to a proto struct. ### make_dict_serializable() Makes a dictionary serializable for proto conversion. ### normalize_large_integers_to_strings() Normalizes large integers in a dictionary to strings. ### parse_string_integers_in_dict() Parses string integers in a dictionary to integers. ``` -------------------------------- ### GetTaskPushNotificationConfigParams Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Parameters for getting a task's push notification configuration. ```APIDOC ## GetTaskPushNotificationConfigParams ### Description Parameters for getting a task's push notification configuration. ### Attributes * `id` (str): The ID of the task. * `metadata` (dict): Metadata associated with the request. * `model_config` (dict): Pydantic model configuration. * `push_notification_config_id` (str): The ID of the push notification configuration to retrieve. ``` -------------------------------- ### GetAuthenticatedExtendedCardSuccessResponse Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Successful response object for getting an authenticated extended card. ```APIDOC ## GetAuthenticatedExtendedCardSuccessResponse ### Description Successful response object for getting an authenticated extended card. ### Attributes * `id` (str): The ID of the extended card. * `jsonrpc` (str): The JSON-RPC version. * `model_config` (dict): Pydantic model configuration. * `result` (any): The extended card details. ``` -------------------------------- ### Create Task Model with Custom Base Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.models.html Demonstrates how to create a task model using a custom SQLAlchemy base class. Ensure your custom base class is properly imported and configured. ```python from myapp.database import Base as MyBase TaskModel = create_task_model('tasks', MyBase) ``` -------------------------------- ### Context Builder Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.html Provides utilities for building gRPC server call contexts. ```APIDOC ## V03GrpcServerCallContextBuilder ### Description Builder for creating gRPC server call contexts compatible with v0.3. ### Methods - `build()`: Constructs and returns a gRPC server call context. ``` ```APIDOC ## V03ServerCallContextBuilder ### Description Builder for creating server call contexts compatible with v0.3. ### Methods - `build()`: Constructs and returns a server call context. ``` -------------------------------- ### to_compat_get_task_request Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts a get task request to the v0.3 compatible type. ```APIDOC ## to_compat_get_task_request ### Description Convert get task request to v0.3 compat type. ### Signature a2a.compat.v0_3.conversions.to_compat_get_task_request(_core_req : GetTaskRequest_, _request_id : str | int_) → GetTaskRequest ``` -------------------------------- ### ClientFactory Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.html Factory class for creating and managing `Client` instances. ```APIDOC ## ClientFactory ### Description Factory class for creating and managing `Client` instances. ### Methods - `create()`: Creates a new client instance. - `create_from_url(url: str)`: Creates a client instance from a given URL. - `register(client: Client)`: Registers a client instance. ``` -------------------------------- ### Get Task Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.routes.rest_dispatcher.html Handles the ‘tasks/{id}’ REST method. ```APIDOC ## GET tasks/{id} ### Description Retrieves a specific task by its ID. ### Method GET ### Endpoint /tasks/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the task. ### Request Body (No request body specified in the source) ### Response #### Success Response (200) (No response details specified in the source) ``` -------------------------------- ### Get Push Notification Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.routes.rest_dispatcher.html Handles the ‘tasks/pushNotificationConfig/get’ REST method. ```APIDOC ## GET tasks/pushNotificationConfig/get ### Description Retrieves push notification configurations. ### Method GET ### Endpoint /tasks/pushNotificationConfig/get ### Parameters #### Query Parameters (No query parameters specified in the source) ### Request Body (No request body specified in the source) ### Response #### Success Response (200) (No response details specified in the source) ``` -------------------------------- ### GetTaskPushNotificationConfigResponse Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Response object for getting a task's push notification configuration. ```APIDOC ## GetTaskPushNotificationConfigResponse ### Description Response object for getting a task's push notification configuration. ### Attributes * `model_config` (dict): Pydantic model configuration. * `root` (any): The result of the operation. ``` -------------------------------- ### CompatRestTransport.list_tasks() Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.html Lists all available tasks. ```APIDOC ## CompatRestTransport.list_tasks() ### Description Retrieves a list of all tasks available through the system. ### Method GET ### Endpoint `/v0.3/tasks` ### Parameters None. ### Request Example None. ### Response #### Success Response (200) - **result** (object) - An object containing a list of tasks. #### Response Example ```json { "result": { "tasks": [ { "id": "task_abc", "status": "in_progress" }, { "id": "task_xyz", "status": "completed" } ] } } ``` ``` -------------------------------- ### GetTaskPushNotificationConfigRequest Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Request object for getting a task's push notification configuration. ```APIDOC ## GetTaskPushNotificationConfigRequest ### Description Request object for getting a task's push notification configuration. ### Attributes * `id` (str): The ID of the task. * `jsonrpc` (str): The JSON-RPC version. * `method` (str): The method name, typically 'get_task_push_notification_config'. * `model_config` (dict): Pydantic model configuration. * `params` (dict): Parameters for the get operation. ``` -------------------------------- ### create Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.grpc_transport.html Creates a gRPC transport for the A2A client. ```APIDOC ## create ### Description Creates a gRPC transport for the A2A client. ### Method classmethod async ### Parameters #### Path Parameters - `_card` (AgentCard) - Description not available - `_url` (str) - Description not available - `_config` (ClientConfig) - Description not available ### Return Value - CompatGrpcTransport ``` -------------------------------- ### new_task Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.helpers.html Creates a new task object. ```APIDOC ## new_task ### Description Creates a new task object. ### Parameters - **name** (str) - The name of the task. - **input** (str | None) - Optional input for the task. - **context_id** (str | None) - Optional context ID. - **task_id** (str | None) - Optional task ID. ### Returns A Task object. ``` -------------------------------- ### Get Task Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.request_handler.html Handles the 'tasks/get' method to retrieve the state and history of a specific task. ```APIDOC ## Get Task ### Description Retrieves the state and history of a specific task. ### Method GET (assumed, as it retrieves information) ### Endpoint /tasks/get ### Parameters #### Request Body - **params** (GetTaskRequest) - Required - Parameters specifying the task ID and optionally history length. - **context** (ServerCallContext) - Required - Context provided by the server. ### Response #### Success Response (200) - **Task | None** (Task | None) - The Task object if found, otherwise None. #### Response Example ```json { "task_id": "task_123", "status": "completed", "history": [ { "timestamp": "...", "message": "..." } ] } ``` ``` -------------------------------- ### GetTaskPushNotificationConfigSuccessResponse Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.types.html Successful response object for getting a task's push notification configuration. ```APIDOC ## GetTaskPushNotificationConfigSuccessResponse ### Description Successful response object for getting a task's push notification configuration. ### Attributes * `id` (str): The ID of the task. * `jsonrpc` (str): The JSON-RPC version. * `model_config` (dict): Pydantic model configuration. * `result` (any): The push notification configuration details. ``` -------------------------------- ### ClientFactory.create_from_url Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.html Creates a Client by resolving an AgentCard from a URL. The agent card is fetched from the URL's well-known endpoint. ```APIDOC ## ClientFactory.create_from_url ### Description Creates a Client by resolving an AgentCard from a URL. The agent card is fetched from the URL's well-known endpoint. ### Method `async create_from_url(_url: str, _interceptors: list[ClientCallInterceptor] | None = None_, _relative_card_path: str | None = None_, _resolver_http_kwargs: dict[str, Any] | None = None_, _signature_verifier: Callable[[AgentCard], None] | None = None_) -> Client` ### Parameters #### Path Parameters * **url** (str) - The base URL of the agent. The agent card will be fetched from /.well-known/agent-card.json by default. * **interceptors** (list[ClientCallInterceptor] | None, optional) - A list of interceptors to use for each request. * **relative_card_path** (str | None, optional) - The relative path to the agent card if not at the default location. * **resolver_http_kwargs** (dict[str, Any] | None, optional) - Additional keyword arguments for the HTTP client used to resolve the agent card. * **signature_verifier** (Callable[[AgentCard], None] | None, optional) - A callable to verify the agent card's signature. ### Returns A Client object. ``` -------------------------------- ### list Method Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.tasks.inmemory_task_store.html Retrieves a list of tasks from the in-memory store based on specified parameters. ```APIDOC async list(_params : ListTasksRequest_, _context : ServerCallContext_) → ListTasksResponse Retrieves a list of tasks from the store. ``` -------------------------------- ### to_compat_get_extended_agent_card_request Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts a get extended agent card request to the v0.3 compatible type. ```APIDOC ## to_compat_get_extended_agent_card_request ### Description Convert get extended agent card request to v0.3 compat type. ### Signature a2a.compat.v0_3.conversions.to_compat_get_extended_agent_card_request(_core_req : GetExtendedAgentCardRequest_, _request_id : str | int_) → GetAuthenticatedExtendedCardRequest ``` -------------------------------- ### Get Task Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.rest_handler.html Handles the 'v1/tasks/{id}' REST method to retrieve a specific task by its ID. ```APIDOC ## GET v1/tasks/{id} ### Description Handles the ‘v1/tasks/{id}’ REST method to retrieve a specific task by its ID. ### Method GET ### Endpoint v1/tasks/{id} ### Parameters #### Path Parameters - **id** (str) - Required - The ID of the task to retrieve. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Task** - A Task object containing the Task in v0.3 format. #### Response Example None ``` -------------------------------- ### Generate minimal AgentCard Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client_factory.html Generates a minimal AgentCard to simplify bootstrapping client creation. This card is not directly usable for interaction but aids in fetching the full card. ```python minimal_card = a2a.client.client_factory.minimal_agent_card('https://example.com', ['http']) ``` -------------------------------- ### TaskStore.list Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.tasks.task_store.html Fetches a list of tasks from the store based on provided parameters. ```APIDOC ## TaskStore.list ### Description Retrieves a list of tasks from the store. ### Method `async list(_params: ListTasksRequest, _context: ServerCallContext) -> ListTasksResponse` ### Parameters * **_params** (ListTasksRequest) - Required - Parameters for listing tasks. * **_context** (ServerCallContext) - Required - The server call context. ### Returns * **ListTasksResponse** - A response object containing the list of tasks. ``` -------------------------------- ### to_core_get_task_request Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts a get task request from the v0.3 compatibility type to the core v1.0 type. ```APIDOC ## to_core_get_task_request ### Description Convert get task request to v1.0 core type. ### Method Signature a2a.compat.v0_3.conversions.to_core_get_task_request(_compat_req : GetTaskRequest_) ### Parameters - **_compat_req** (GetTaskRequest_) - The v0.3 compatibility get task request object to convert. ``` -------------------------------- ### ClientFactory Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.html Factory for creating and managing A2A client instances. ```APIDOC ## ClientFactory ### Description Factory for creating A2A clients. ### Methods - `create()`: Creates a new client instance. - `create_from_url(url: str)`: Creates a client instance from a URL. - `register(client: Client)`: Registers a client instance. ``` -------------------------------- ### to_compat_get_task_push_notification_config_request Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts a get task push notification config request to the v0.3 compatible type. ```APIDOC ## to_compat_get_task_push_notification_config_request ### Description Convert get task push notification config request to v0.3 compat type. ### Signature a2a.compat.v0_3.conversions.to_compat_get_task_push_notification_config_request(_core_req : GetTaskPushNotificationConfigRequest_, _request_id : str | int_) → GetTaskPushNotificationConfigRequest ``` -------------------------------- ### on_message_send_stream Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.html Handles the 'message/stream' (streaming) interface. Starts the agent execution and yields events as they are produced by the agent. ```APIDOC ## on_message_send_stream ### Description Handles the ‘message/stream’ (streaming) interface. Starts the agent execution and yields events as they are produced by the agent. ### Parameters - **_params** (SendMessageRequest_) - Parameters for sending the message. - **_context** (ServerCallContext_) - Context provided by the server. ### Returns - **AsyncGenerator[Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent]** - An asynchronous generator yielding events as they are produced. ``` -------------------------------- ### new_raw_part Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.html Creates a new raw part. ```APIDOC ## new_raw_part() ### Description Creates a new raw part. ### Parameters - `content`: The raw content for the part. - `content_type`: The content type of the raw data. ``` -------------------------------- ### Get Push Notification Configuration Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.rest_handler.html Handles the 'tasks/pushNotificationConfig/get' REST method to retrieve push notification configuration. ```APIDOC ## GET tasks/pushNotificationConfig/get ### Description Handles the ‘tasks/pushNotificationConfig/get’ REST method to retrieve push notification configuration. ### Method GET ### Endpoint tasks/pushNotificationConfig/get ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **dict[str, Any]** - A dict containing the config in v0.3 format. #### Response Example None ``` -------------------------------- ### list_tasks Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.base_client.html Lists all available tasks. ```APIDOC ## list_tasks() ### Description Lists all available tasks. ### Method (Not specified, assumed to be a client method) ### Endpoint (Not specified) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### Get Extended Agent Card Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.request_handler.html Handles the 'GetExtendedAgentCard' method to retrieve the extended agent card for the agent. ```APIDOC ## Get Extended Agent Card ### Description Retrieves the extended agent card for the agent. ### Method GET (assumed, as it retrieves information) ### Endpoint /GetExtendedAgentCard ### Parameters #### Request Body - **params** (GetExtendedAgentCardRequest) - Required - Parameters for the request. - **context** (ServerCallContext) - Required - Context provided by the server. ### Response #### Success Response (200) - **AgentCard** (AgentCard) - The AgentCard object representing the extended properties of the agent. #### Response Example ```json { "agent_name": "ExampleAgent", "version": "1.0", "description": "An example agent card." } ``` ``` -------------------------------- ### to_compat_authentication_info Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts authentication info to the v0.3 compatible type. ```APIDOC ## to_compat_authentication_info ### Description Convert authentication info to v0.3 compat type. ### Signature a2a.compat.v0_3.conversions.to_compat_authentication_info(_core_auth : AuthenticationInfo_) → PushNotificationAuthenticationInfo ``` -------------------------------- ### Get Task Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.default_request_handler_v2.html Handles the ‘tasks/get’ method. Retrieves the state and history of a specific task. ```APIDOC ## POST /tasks/get ### Description Retrieves the state and history of a specific task. ### Method POST ### Endpoint /tasks/get ### Parameters #### Request Body - **params** (GetTaskRequest) - Required - Parameters specifying the task ID and optionally history length. - **context** (ServerCallContext) - Required - Context provided by the server. ### Response #### Success Response (200) - **Task** (Task | None) - The Task object if found, otherwise None. ``` -------------------------------- ### Client.list_task_push_notification_configs Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client.html Lists all push notification configurations for a given task. ```APIDOC ## Client.list_task_push_notification_configs() ### Description Lists all push notification configurations for a given task. ### Method ``` list_task_push_notification_configs(task_id: str) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # Example usage (assuming 'client' is an instance of Client and 'task_id' is a valid task ID) # configs = client.list_task_push_notification_configs(task_id='your_task_id') ``` ### Response #### Success Response (200) - **configs** (List[PushNotificationConfig]) - A list of push notification configurations for the task. #### Response Example ```json { "example": "[{\"config_id\": \"config1\", \"url\": \"http://example.com/notify1\"}, {\"config_id\": \"config2\", \"url\": \"http://example.com/notify2\"}]" } ``` ``` -------------------------------- ### Get Extended Agent Card Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.default_request_handler_v2.html Default handler for ‘GetExtendedAgentCard’. Requires capabilities.extended_agent_card to be true. ```APIDOC ## POST /GetExtendedAgentCard ### Description Retrieves extended information about the agent card. Requires capabilities.extended_agent_card to be true. ### Method POST ### Endpoint /GetExtendedAgentCard ### Parameters #### Request Body - **params** (GetExtendedAgentCardRequest) - Required - Parameters for getting the extended agent card. - **context** (ServerCallContext) - Required - Context provided by the server. ### Response #### Success Response (200) - **AgentCard** (AgentCard) - The extended agent card information. ``` -------------------------------- ### to_compat_part Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts a v1.0 core Part (Protobuf object) to a v0.3 Part (Pydantic model). ```APIDOC ## to_compat_part ### Description Converts a v1.0 core Part (Protobuf object) to a v0.3 Part (Pydantic model). ### Signature a2a.compat.v0_3.conversions.to_compat_part(_core_part : Part_) → Part ``` -------------------------------- ### RestTransport.list_tasks Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.transports.rest.html Retrieves a list of tasks associated with an agent. This is useful for getting an overview of active or completed tasks. ```APIDOC ## list_tasks ### Description Retrieves tasks for an agent. ### Method GET ### Endpoint /tasks ### Parameters #### Query Parameters - **agent_id** (string) - Required - The unique identifier of the agent whose tasks are to be retrieved. #### Request Body - **_request** (ListTasksRequest) - Required - The request object for listing tasks. #### Context - **_context** (ClientCallContext | None) - Optional - Context for the client call. ### Response #### Success Response (200) - **ListTasksResponse** - A response object containing a list of tasks. ``` -------------------------------- ### Proto Utils Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.html Utility functions for working with Protocol Buffers in the A2A compatibility layer. ```APIDOC ## Proto Utils ### `FromProto` #### Description Interface for converting Protocol Buffer messages to Python objects. ### `ToProto` #### Description Interface for converting Python objects to Protocol Buffer messages. ### `dict_to_struct()` #### Description Converts a Python dictionary to a Protocol Buffer Struct. ### `make_dict_serializable()` #### Description Ensures a dictionary is serializable for Protocol Buffers. ### `normalize_large_integers_to_strings()` #### Description Normalizes large integers within a dictionary to strings for compatibility. ### `parse_string_integers_in_dict()` #### Description Parses string representations of integers within a dictionary. ``` -------------------------------- ### ServerCallContextBuilder Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.html Abstract methods for building server call contexts. ```APIDOC ## ServerCallContextBuilder Methods ### Description Abstract methods for building server call contexts. ### Methods - `build()` ``` -------------------------------- ### Get Extended Agent Card Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.rest_handler.html Handles the 'v1/agent/authenticatedExtendedAgentCard' REST method to retrieve extended agent card information. ```APIDOC ## GET v1/agent/authenticatedExtendedAgentCard ### Description Handles the ‘v1/agent/authenticatedExtendedAgentCard’ REST method to retrieve extended agent card information. ### Method GET ### Endpoint v1/agent/authenticatedExtendedAgentCard ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **dict[str, Any]** - A dict containing the extended agent card information. #### Response Example None ``` -------------------------------- ### to_core_get_extended_agent_card_request Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.conversions.html Converts a get extended agent card request from the v0.3 compatibility type to the core v1.0 type. ```APIDOC ## to_core_get_extended_agent_card_request ### Description Convert get extended agent card request to v1.0 core type. ### Method Signature a2a.compat.v0_3.conversions.to_core_get_extended_agent_card_request(_compat_req : GetAuthenticatedExtendedCardRequest_) ### Parameters - **_compat_req** (GetAuthenticatedExtendedCardRequest_) - The v0.3 compatibility get authenticated extended card request object to convert. ``` -------------------------------- ### CompatRestTransport.list_task_push_notification_configs() Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.compat.v0_3.html Lists all push notification configurations for a task. ```APIDOC ## CompatRestTransport.list_task_push_notification_configs() ### Description Lists all configured push notifications for a given task. ### Method GET ### Endpoint `/v0.3/tasks/{task_id}/push_notifications` ### Parameters #### Path Parameters - **task_id** (string) - Required - The ID of the task. ### Request Example None. ### Response #### Success Response (200) - **result** (object) - An object containing a list of push notification configurations. #### Response Example ```json { "result": { "notifications": [ { "notification_id": "notif_1", "url": "http://example.com/cb1", "event": "TASK_COMPLETED" } ] } } ``` ``` -------------------------------- ### RestTransport.subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.transports.html Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ```APIDOC ## RestTransport.subscribe ### Description Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ### Method Signature `subscribe(_request : SubscribeToTaskRequest_, _*_ , _context : ClientCallContext | None = None_) -> AsyncGenerator[StreamResponse]` ### Parameters - `_request` (SubscribeToTaskRequest): The request object for subscribing to task updates. - `_*_`: Keyword-only arguments separator. - `_context` (ClientCallContext | None, optional): Client call context. Defaults to None. ``` -------------------------------- ### TaskStore Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.html Abstract base class or interface for task storage. ```APIDOC ## TaskStore.delete(task_id) ### Description Abstract method to delete a task by its ID. ### Method `delete(self, task_id)` ### Parameters - **task_id** (any) - The ID of the task to delete. ``` ```APIDOC ## TaskStore.get(task_id) ### Description Abstract method to retrieve a task by its ID. ### Method `get(self, task_id)` ### Parameters - **task_id** (any) - The ID of the task to retrieve. ### Returns - (Task) - The retrieved task object. ``` ```APIDOC ## TaskStore.list() ### Description Abstract method to list all tasks. ### Method `list(self)` ### Returns - (list) - A list of task objects. ``` ```APIDOC ## TaskStore.save(task) ### Description Abstract method to save a task. ### Method `save(self, task)` ### Parameters - **task** (Task) - The task object to save. ``` -------------------------------- ### DefaultGrpcServerCallContextBuilder Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.grpc_handler.html Methods for building a server call context from gRPC context. ```APIDOC ## DefaultGrpcServerCallContextBuilder ### Description Default implementation of GrpcServerCallContextBuilder. ### Methods #### build(_context : ServicerContext_) -> ServerCallContext Builds a ServerCallContext from a gRPC ServicerContext. #### build_user(_context : ServicerContext_) -> User Builds a User from a gRPC ServicerContext. ``` -------------------------------- ### JsonRpcTransport.subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.transports.html Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ```APIDOC ## JsonRpcTransport.subscribe ### Description Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ### Method Signature `subscribe(_request : SubscribeToTaskRequest_, _*_ , _context : ClientCallContext | None = None_) -> AsyncGenerator[StreamResponse]` ### Parameters - `_request` (SubscribeToTaskRequest): The request object for subscribing to task updates. - `_*_`: Keyword-only arguments separator. - `_context` (ClientCallContext | None, optional): Client call context. Defaults to None. ``` -------------------------------- ### GrpcTransport.subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.transports.html Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ```APIDOC ## GrpcTransport.subscribe ### Description Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ### Method Signature `subscribe(_request : SubscribeToTaskRequest_, _*_ , _context : ClientCallContext | None = None_) -> AsyncGenerator[StreamResponse]` ### Parameters - `_request` (SubscribeToTaskRequest): The request object for subscribing to task updates. - `_*_`: Keyword-only arguments separator. - `_context` (ClientCallContext | None, optional): Client call context. Defaults to None. ``` -------------------------------- ### Client.list_tasks Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.client.html Lists all tasks associated with the client. ```APIDOC ## Client.list_tasks() ### Description Lists all tasks associated with the client. ### Method ``` list_tasks() ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # Example usage (assuming 'client' is an instance of Client) # tasks = client.list_tasks() ``` ### Response #### Success Response (200) - **tasks** (List[Task]) - A list of tasks. #### Response Example ```json { "example": "[{\"task_id\": \"task1\", \"status\": \"pending\"}, {\"task_id\": \"task2\", \"status\": \"completed\"}]" } ``` ``` -------------------------------- ### ClientTransport.subscribe Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.transports.html Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ```APIDOC ## ClientTransport.subscribe ### Description Sends a streaming message request to the agent and yields responses as they arrive. Reconnects to get task updates. ### Method Signature `subscribe(_request : SubscribeToTaskRequest_, _*_ , _context : ClientCallContext | None = None_) -> AsyncGenerator[StreamResponse]` ### Parameters - `_request` (SubscribeToTaskRequest): The request object for subscribing to task updates. - `_*_`: Keyword-only arguments separator. - `_context` (ClientCallContext | None, optional): Client call context. Defaults to None. ``` -------------------------------- ### DefaultServerCallContextBuilder Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.html Methods for building server call contexts with default implementations. ```APIDOC ## DefaultServerCallContextBuilder Methods ### Description Provides default implementations for building server call contexts and users. ### Methods - `build()` - `build_user()` ``` -------------------------------- ### on_message_send Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.html Handles the 'message/send' interface (non-streaming). Starts the agent execution for the message and waits for the final result (Task or Message). ```APIDOC ## on_message_send ### Description Handles the ‘message/send’ interface (non-streaming). Starts the agent execution for the message and waits for the final result (Task or Message). ### Parameters - **_params** (SendMessageRequest_) - Parameters for sending the message. - **_context** (ServerCallContext_) - Context provided by the server. ### Returns - **Message | Task** - The final result of the agent execution, either a Message or a Task. ``` -------------------------------- ### InMemoryContextCredentialStore Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.client.html InMemoryContextCredentialStore provides an in-memory storage for credentials. ```APIDOC ## InMemoryContextCredentialStore ### Description An in-memory store for credentials. ### Methods - `get_credentials()`: Retrieves credentials from the in-memory store. - `set_credentials(credentials)`: Sets credentials in the in-memory store. ``` -------------------------------- ### DatabasePushNotificationConfigStore Methods Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.html Methods for interacting with the push notification configuration store using a database. ```APIDOC ## DatabasePushNotificationConfigStore Methods ### Description Provides methods for managing push notification configurations stored in a database. ### Attributes - `async_session_maker` - `config_model` - `core_to_model_conversion` - `engine` - `model_to_core_conversion` - `owner_resolver` ### Methods - `create_table()` - `delete_info()` - `get_info()` - `get_info_for_dispatch()` - `initialize()` ``` -------------------------------- ### Get Task Push Notification Configuration Source: https://a2a-protocol.org/latest/sdk/python/api/a2a.server.request_handlers.request_handler.html Handles the 'tasks/pushNotificationConfig/get' method to retrieve the current push notification configuration for a task. ```APIDOC ## Get Task Push Notification Configuration ### Description Retrieves the current push notification configuration for a task. ### Method GET (assumed, as it retrieves information) ### Endpoint /tasks/pushNotificationConfig/get ### Parameters #### Request Body - **params** (GetTaskPushNotificationConfigRequest) - Required - Parameters including the task ID. - **context** (ServerCallContext) - Required - Context provided by the server. ### Response #### Success Response (200) - **TaskPushNotificationConfig** (TaskPushNotificationConfig) - The TaskPushNotificationConfig for the task. #### Response Example ```json { "task_id": "task_123", "notification_url": "http://example.com/notify" } ``` ```