diff --git a/src/google/adk/features/_feature_registry.py b/src/google/adk/features/_feature_registry.py index 036b56ef..90c09d65 100644 --- a/src/google/adk/features/_feature_registry.py +++ b/src/google/adk/features/_feature_registry.py @@ -24,17 +24,23 @@ from ..utils.env_utils import is_env_enabled class FeatureName(str, Enum): """Feature names.""" + AUTHENTICATED_FUNCTION_TOOL = "AUTHENTICATED_FUNCTION_TOOL" + BASE_AUTHENTICATED_TOOL = "BASE_AUTHENTICATED_TOOL" BIG_QUERY_TOOLSET = "BIG_QUERY_TOOLSET" BIG_QUERY_TOOL_CONFIG = "BIG_QUERY_TOOL_CONFIG" BIGTABLE_TOOL_SETTINGS = "BIGTABLE_TOOL_SETTINGS" + BIGTABLE_TOOLSET = "BIGTABLE_TOOLSET" COMPUTER_USE = "COMPUTER_USE" GOOGLE_CREDENTIALS_CONFIG = "GOOGLE_CREDENTIALS_CONFIG" GOOGLE_TOOL = "GOOGLE_TOOL" JSON_SCHEMA_FOR_FUNC_DECL = "JSON_SCHEMA_FOR_FUNC_DECL" PROGRESSIVE_SSE_STREAMING = "PROGRESSIVE_SSE_STREAMING" + PUBSUB_TOOL_CONFIG = "PUBSUB_TOOL_CONFIG" PUBSUB_TOOLSET = "PUBSUB_TOOLSET" SPANNER_TOOLSET = "SPANNER_TOOLSET" SPANNER_TOOL_SETTINGS = "SPANNER_TOOL_SETTINGS" + TOOL_CONFIG = "TOOL_CONFIG" + TOOL_CONFIRMATION = "TOOL_CONFIRMATION" class FeatureStage(Enum): @@ -67,6 +73,12 @@ class FeatureConfig: # Central registry: FeatureName -> FeatureConfig _FEATURE_REGISTRY: dict[FeatureName, FeatureConfig] = { + FeatureName.AUTHENTICATED_FUNCTION_TOOL: FeatureConfig( + FeatureStage.EXPERIMENTAL, default_on=True + ), + FeatureName.BASE_AUTHENTICATED_TOOL: FeatureConfig( + FeatureStage.EXPERIMENTAL, default_on=True + ), FeatureName.BIG_QUERY_TOOLSET: FeatureConfig( FeatureStage.EXPERIMENTAL, default_on=True ), @@ -76,6 +88,9 @@ _FEATURE_REGISTRY: dict[FeatureName, FeatureConfig] = { FeatureName.BIGTABLE_TOOL_SETTINGS: FeatureConfig( FeatureStage.EXPERIMENTAL, default_on=True ), + FeatureName.BIGTABLE_TOOLSET: FeatureConfig( + FeatureStage.EXPERIMENTAL, default_on=True + ), FeatureName.COMPUTER_USE: FeatureConfig( FeatureStage.EXPERIMENTAL, default_on=True ), @@ -91,6 +106,9 @@ _FEATURE_REGISTRY: dict[FeatureName, FeatureConfig] = { FeatureName.PROGRESSIVE_SSE_STREAMING: FeatureConfig( FeatureStage.EXPERIMENTAL, default_on=True ), + FeatureName.PUBSUB_TOOL_CONFIG: FeatureConfig( + FeatureStage.EXPERIMENTAL, default_on=True + ), FeatureName.PUBSUB_TOOLSET: FeatureConfig( FeatureStage.EXPERIMENTAL, default_on=True ), @@ -100,6 +118,12 @@ _FEATURE_REGISTRY: dict[FeatureName, FeatureConfig] = { FeatureName.SPANNER_TOOL_SETTINGS: FeatureConfig( FeatureStage.EXPERIMENTAL, default_on=True ), + FeatureName.TOOL_CONFIG: FeatureConfig( + FeatureStage.EXPERIMENTAL, default_on=True + ), + FeatureName.TOOL_CONFIRMATION: FeatureConfig( + FeatureStage.EXPERIMENTAL, default_on=True + ), } # Track which experimental features have already warned (warn only once) diff --git a/src/google/adk/tools/authenticated_function_tool.py b/src/google/adk/tools/authenticated_function_tool.py index 01e44ed0..5a1cc932 100644 --- a/src/google/adk/tools/authenticated_function_tool.py +++ b/src/google/adk/tools/authenticated_function_tool.py @@ -18,7 +18,6 @@ import inspect import logging from typing import Any from typing import Callable -from typing import Dict from typing import Optional from typing import Union @@ -27,14 +26,15 @@ from typing_extensions import override from ..auth.auth_credential import AuthCredential from ..auth.auth_tool import AuthConfig from ..auth.credential_manager import CredentialManager -from ..utils.feature_decorator import experimental +from ..features import experimental +from ..features import FeatureName from .function_tool import FunctionTool from .tool_context import ToolContext logger = logging.getLogger("google_adk." + __name__) -@experimental +@experimental(FeatureName.AUTHENTICATED_FUNCTION_TOOL) class AuthenticatedFunctionTool(FunctionTool): """A FunctionTool that handles authentication before the actual tool logic gets called. Functions can accept a special `credential` argument which is the diff --git a/src/google/adk/tools/base_authenticated_tool.py b/src/google/adk/tools/base_authenticated_tool.py index 6279d4f7..862d1cef 100644 --- a/src/google/adk/tools/base_authenticated_tool.py +++ b/src/google/adk/tools/base_authenticated_tool.py @@ -25,14 +25,15 @@ from typing_extensions import override from ..auth.auth_credential import AuthCredential from ..auth.auth_tool import AuthConfig from ..auth.credential_manager import CredentialManager -from ..utils.feature_decorator import experimental +from ..features import experimental +from ..features import FeatureName from .base_tool import BaseTool from .tool_context import ToolContext logger = logging.getLogger("google_adk." + __name__) -@experimental +@experimental(FeatureName.BASE_AUTHENTICATED_TOOL) class BaseAuthenticatedTool(BaseTool): """A base tool class that handles authentication before the actual tool logic gets called. Functions can accept a special `credential` argument which is the diff --git a/src/google/adk/tools/bigtable/bigtable_toolset.py b/src/google/adk/tools/bigtable/bigtable_toolset.py index 3b39e908..424a6fee 100644 --- a/src/google/adk/tools/bigtable/bigtable_toolset.py +++ b/src/google/adk/tools/bigtable/bigtable_toolset.py @@ -23,18 +23,19 @@ from typing_extensions import override from . import metadata_tool from . import query_tool +from ...features import experimental +from ...features import FeatureName from ...tools.base_tool import BaseTool from ...tools.base_toolset import BaseToolset from ...tools.base_toolset import ToolPredicate from ...tools.google_tool import GoogleTool -from ...utils.feature_decorator import experimental from .bigtable_credentials import BigtableCredentialsConfig from .settings import BigtableToolSettings DEFAULT_BIGTABLE_TOOL_NAME_PREFIX = "bigtable" -@experimental +@experimental(FeatureName.BIGTABLE_TOOLSET) class BigtableToolset(BaseToolset): """Bigtable Toolset contains tools for interacting with Bigtable data and metadata. diff --git a/src/google/adk/tools/pubsub/config.py b/src/google/adk/tools/pubsub/config.py index eb48a1f7..60f21f1e 100644 --- a/src/google/adk/tools/pubsub/config.py +++ b/src/google/adk/tools/pubsub/config.py @@ -17,10 +17,11 @@ from __future__ import annotations from pydantic import BaseModel from pydantic import ConfigDict -from ...utils.feature_decorator import experimental +from ...features import experimental +from ...features import FeatureName -@experimental('Config defaults may have breaking change in the future.') +@experimental(FeatureName.PUBSUB_TOOL_CONFIG) class PubSubToolConfig(BaseModel): """Configuration for Pub/Sub tools.""" diff --git a/src/google/adk/tools/tool_configs.py b/src/google/adk/tools/tool_configs.py index 6953afab..bfeba569 100644 --- a/src/google/adk/tools/tool_configs.py +++ b/src/google/adk/tools/tool_configs.py @@ -20,24 +20,25 @@ from pydantic import BaseModel from pydantic import ConfigDict from pydantic import Field -from ..utils.feature_decorator import experimental +from ..features import experimental +from ..features import FeatureName -@experimental +@experimental(FeatureName.TOOL_CONFIG) class BaseToolConfig(BaseModel): """The base class for all tool configs.""" model_config = ConfigDict(extra="forbid") -@experimental +@experimental(FeatureName.TOOL_CONFIG) class ToolArgsConfig(BaseModel): """Config to host free key-value pairs for the args in ToolConfig.""" model_config = ConfigDict(extra="allow") -@experimental +@experimental(FeatureName.TOOL_CONFIG) class ToolConfig(BaseModel): """The configuration for a tool. diff --git a/src/google/adk/tools/tool_confirmation.py b/src/google/adk/tools/tool_confirmation.py index a561ac6a..6f71699c 100644 --- a/src/google/adk/tools/tool_confirmation.py +++ b/src/google/adk/tools/tool_confirmation.py @@ -20,12 +20,12 @@ from typing import Optional from pydantic import alias_generators from pydantic import BaseModel from pydantic import ConfigDict -from pydantic import Field -from ..utils.feature_decorator import experimental +from ..features import experimental +from ..features import FeatureName -@experimental +@experimental(FeatureName.TOOL_CONFIRMATION) class ToolConfirmation(BaseModel): """Represents a tool confirmation configuration."""