feat: Enable A2A features as experimental

PiperOrigin-RevId: 776656783
This commit is contained in:
Xiang (Sean) Zhou
2025-06-27 11:28:28 -07:00
committed by Copybara-Service
parent 3f621ae6f2
commit f0183a9b98
6 changed files with 18 additions and 19 deletions
@@ -40,7 +40,7 @@ from google.genai import types as genai_types
from ...agents.invocation_context import InvocationContext
from ...events.event import Event
from ...flows.llm_flows.functions import REQUEST_EUC_FUNCTION_CALL_NAME
from ...utils.feature_decorator import working_in_progress
from ...utils.feature_decorator import experimental
from .part_converter import A2A_DATA_PART_METADATA_IS_LONG_RUNNING_KEY
from .part_converter import A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
from .part_converter import A2A_DATA_PART_METADATA_TYPE_KEY
@@ -242,7 +242,6 @@ def _process_long_running_tool(a2a_part: A2APart, event: Event) -> None:
] = True
@working_in_progress
def convert_a2a_task_to_event(
a2a_task: Task,
author: Optional[str] = None,
@@ -298,7 +297,7 @@ def convert_a2a_task_to_event(
raise
@working_in_progress
@experimental
def convert_a2a_message_to_event(
a2a_message: Message,
author: Optional[str] = None,
@@ -394,7 +393,7 @@ def convert_a2a_message_to_event(
raise RuntimeError(f"Failed to convert message: {e}") from e
@working_in_progress
@experimental
def convert_event_to_a2a_message(
event: Event, invocation_context: InvocationContext, role: Role = Role.agent
) -> Optional[Message]:
@@ -545,7 +544,7 @@ def _create_status_update_event(
)
@working_in_progress
@experimental
def convert_event_to_a2a_events(
event: Event,
invocation_context: InvocationContext,
@@ -39,7 +39,7 @@ except ImportError as e:
from google.genai import types as genai_types
from ...utils.feature_decorator import working_in_progress
from ...utils.feature_decorator import experimental
logger = logging.getLogger('google_adk.' + __name__)
@@ -51,7 +51,7 @@ A2A_DATA_PART_METADATA_TYPE_CODE_EXECUTION_RESULT = 'code_execution_result'
A2A_DATA_PART_METADATA_TYPE_EXECUTABLE_CODE = 'executable_code'
@working_in_progress
@experimental
def convert_a2a_part_to_genai_part(
a2a_part: a2a_types.Part,
) -> Optional[genai_types.Part]:
@@ -140,7 +140,7 @@ def convert_a2a_part_to_genai_part(
return None
@working_in_progress
@experimental
def convert_genai_part_to_a2a_part(
part: genai_types.Part,
) -> Optional[a2a_types.Part]:
@@ -31,7 +31,7 @@ except ImportError as e:
from google.genai import types as genai_types
from ...runners import RunConfig
from ...utils.feature_decorator import working_in_progress
from ...utils.feature_decorator import experimental
from .part_converter import convert_a2a_part_to_genai_part
@@ -48,7 +48,7 @@ def _get_user_id(request: RequestContext) -> str:
return f'A2A_USER_{request.context_id}'
@working_in_progress
@experimental
def convert_a2a_request_to_adk_run_args(
request: RequestContext,
) -> dict[str, Any]:
@@ -48,7 +48,7 @@ from google.adk.runners import Runner
from pydantic import BaseModel
from typing_extensions import override
from ...utils.feature_decorator import working_in_progress
from ...utils.feature_decorator import experimental
from ..converters.event_converter import convert_event_to_a2a_events
from ..converters.request_converter import convert_a2a_request_to_adk_run_args
from ..converters.utils import _get_adk_metadata_key
@@ -57,14 +57,14 @@ from .task_result_aggregator import TaskResultAggregator
logger = logging.getLogger('google_adk.' + __name__)
@working_in_progress
@experimental
class A2aAgentExecutorConfig(BaseModel):
"""Configuration for the A2aAgentExecutor."""
pass
@working_in_progress
@experimental
class A2aAgentExecutor(AgentExecutor):
"""An AgentExecutor that runs an ADK Agent against an A2A request and
publishes updates to an event queue.
@@ -19,10 +19,10 @@ from a2a.types import Message
from a2a.types import TaskState
from a2a.types import TaskStatusUpdateEvent
from ...utils.feature_decorator import working_in_progress
from ...utils.feature_decorator import experimental
@working_in_progress
@experimental
class TaskResultAggregator:
"""Aggregates the task status updates and provides the final task state."""
+4 -4
View File
@@ -60,7 +60,7 @@ from ..events.event import Event
from ..flows.llm_flows.contents import _convert_foreign_event
from ..flows.llm_flows.contents import _is_other_agent_reply
from ..flows.llm_flows.functions import find_matching_function_call
from ..utils.feature_decorator import working_in_progress
from ..utils.feature_decorator import experimental
from .base_agent import BaseAgent
# Constants
@@ -71,21 +71,21 @@ DEFAULT_TIMEOUT = 600.0
logger = logging.getLogger("google_adk." + __name__)
@working_in_progress
@experimental
class AgentCardResolutionError(Exception):
"""Raised when agent card resolution fails."""
pass
@working_in_progress
@experimental
class A2AClientError(Exception):
"""Raised when A2A client operations fail."""
pass
@working_in_progress
@experimental
class RemoteA2aAgent(BaseAgent):
"""Agent that communicates with a remote A2A agent via A2A client.