instruction stringclasses 100
values | code stringlengths 78 193k | response stringlengths 259 170k | file stringlengths 59 203 |
|---|---|---|---|
Add missing documentation to my Python functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -35,12 +35,14 @@
class TrackingScope(Enum):
+ """Defines the lifecycle scope for tracking tool failure counts."""
INVOCATION = "invocation"
GLOBAL = "global"
class ToolFailureResponse(BaseModel):
+ """Response containing tool failure details and retry guidance."""
response_type: str =... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/plugins/reflect_retry_tool_plugin.py |
Fill in missing docstrings in my code | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -100,6 +100,7 @@ def _apply_run_config_custom_metadata(
event: Event, run_config: RunConfig | None
) -> None:
+ """Merges run-level custom metadata into the event, if present."""
if not run_config or not run_config.custom_metadata:
return
@@ -110,6 +111,23 @@
class Runner:
+ """The Runn... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/runners.py |
Generate helpful docstrings for debugging | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,6 +30,7 @@
@experimental
class AgentSimulatorFactory:
+ """Factory for creating AgentSimulator instances."""
@staticmethod
def create_callback(
@@ -37,6 +38,14 @@ ) -> Callable[
[BaseTool, Dict[str, Any], Any], Awaitable[Optional[Dict[str, Any]]]
]:
+ """Creates a callback func... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/agent_simulator_factory.py |
Create structured documentation for my script | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+"""Utility functions for session service."""
from __future__ import annotations
@@ -27,6 +28,7 @@ def decode... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/_session_util.py |
Write docstrings describing functionality | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -49,6 +49,7 @@ def _set_internal_custom_metadata(
metadata_dict: dict[str, Any], *, key: str, value: dict[str, Any]
) -> None:
+ """Stores internal metadata alongside user-provided custom metadata."""
existing_custom_metadata = metadata_dict.get('custom_metadata') or {}
metadata_dict['custom_met... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/vertex_ai_session_service.py |
Create documentation for each function signature | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -18,30 +18,40 @@
class State:
+ """A state dict that maintains the current value and the pending-commit delta."""
APP_PREFIX = "app:"
USER_PREFIX = "user:"
TEMP_PREFIX = "temp:"
def __init__(self, value: dict[str, Any], delta: dict[str, Any]):
+ """
+ Args:
+ value: The curren... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/state.py |
Write beginner-friendly docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -35,8 +35,36 @@
class LoggingPlugin(BasePlugin):
+ """A plugin that logs important information at each callback point.
+
+ This plugin helps print all critical events in the console. It is not a
+ replacement of existing logging in ADK. It rather helps terminal based
+ debugging by showing all logs i... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/plugins/logging_plugin.py |
Add concise docstrings to each method | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -29,6 +29,7 @@
class InjectedError(BaseModel):
+ """An error to be injected into a tool call."""
injected_http_error_code: int
"""Inject http error code to the tool call. Will present as "error_code"
@@ -40,6 +41,7 @@
class InjectionConfig(BaseModel):
+ """Injection configuration for a tool... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/agent_simulator_config.py |
Generate consistent docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -58,12 +58,31 @@
class PluginManager:
+ """Manages the registration and execution of plugins.
+
+ The PluginManager is an internal class that orchestrates the invocation of
+ plugin callbacks at key points in the SDK's execution lifecycle. It maintains
+ a list of registered plugins and ensures they ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/plugins/plugin_manager.py |
Write clean docstrings for readability | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,8 +30,19 @@
class MultimodalToolResultsPlugin(BasePlugin):
+ """A plugin that modifies function tool responses to support returning list of parts directly.
+
+ Should be removed in favor of directly supporting FunctionResponsePart when these
+ are supported outside of computer use tool.
+ For con... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/plugins/multimodal_tool_results_plugin.py |
Add documentation for all methods | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,17 +27,26 @@
class GetSessionConfig(BaseModel):
+ """The configuration of getting a session."""
num_recent_events: Optional[int] = None
after_timestamp: Optional[float] = None
class ListSessionsResponse(BaseModel):
+ """The response of listing sessions.
+
+ The events and states are n... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/base_session_service.py |
Add docstrings that explain inputs and outputs | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -35,6 +35,11 @@
class InMemorySessionService(BaseSessionService):
+ """An in-memory implementation of the session service.
+
+ It is not suitable for multi-threaded production environments. Use it for
+ testing and development only.
+ """
def __init__(self):
# A map from app name to a map f... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/in_memory_session_service.py |
Add return value explanations in docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -40,6 +40,10 @@
@experimental(FeatureName.GOOGLE_CREDENTIALS_CONFIG)
class BaseGoogleCredentialsConfig(BaseModel):
+ """Base Google Credentials Configuration for Google API tools (Experimental).
+
+ Please do not use this in production, as it may be deprecated later.
+ """
# Configure the model to... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/_google_credentials.py |
Auto-generate documentation strings for this file | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -42,6 +42,18 @@
def _get_input_schema(agent: BaseAgent) -> Optional[type[BaseModel]]:
+ """Extracts the input_schema from an agent.
+
+ For LlmAgent, returns its input_schema directly.
+ For agents with sub_agents, recursively searches the first sub-agent for an
+ input_schema.
+
+ Args:
+ agent:... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_tool.py |
Add docstrings to existing functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -41,6 +41,7 @@ llm_name: str,
llm_config: genai_types.GenerateContentConfig,
) -> base_mock_strategies.MockStrategy:
+ """Creates a mock strategy based on the given type."""
if mock_strategy_type == MockStrategyEnum.MOCK_STRATEGY_TOOL_SPEC:
return tool_spec_mock_strategy.ToolSpecMockStrate... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/agent_simulator_engine.py |
Please document this code using docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+"""Migration script from SQLAlchemy DB with Pickle Events to JSON schema."""
from __future__ import annotation... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/migration/migrate_from_sqlalchemy_pickle.py |
Provide docstrings following PEP 257 | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -13,6 +13,7 @@ # limitations under the License.
+"""Provides instrumentation for experimental semantic convention https://github.com/open-telemetry/semantic-conventions/blob/v1.39.0/docs/gen-ai/gen-ai-events.md."""
from __future__ import annotations
@@ -117,6 +118,14 @@
def _safe_json_serialize_... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/telemetry/_experimental_semconv.py |
Document functions with clear intent | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -94,6 +94,20 @@
def _parse_db_path(db_path: str) -> tuple[str, str, bool]:
+ """Normalizes a SQLite db path from a URL or filesystem path.
+
+ Returns:
+ A tuple of:
+ - filesystem path (for `os.path.exists` and user-facing messages)
+ - value to pass to sqlite/aiosqlite connect
+ - w... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/sqlite_session_service.py |
Write Python docstrings for this snippet | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,6 +27,7 @@
class DynamicJSON(TypeDecorator):
+ """A JSON-like type that uses JSONB on PostgreSQL and TEXT with JSON serialization for other databases."""
impl = Text # Default implementation is TEXT
@@ -55,6 +56,7 @@
class PreciseTimestamp(TypeDecorator):
+ """Represents a timestamp pre... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/schemas/shared.py |
Replace inline comments with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -11,6 +11,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+"""V0 database schema for ADK versions from 1.19.0 to 1.21.0.
+
+This module defines SQLAlchemy models for stori... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/sessions/schemas/v0.py |
Create structured documentation for my script | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""SQLite-backed OpenTelemetry span exporter for local development."""
from __future__ import annotations
@@ -73,6 +74,11 @@
class SqliteSpanExporter(SpanExporter):
+ """Exports... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/telemetry/sqlite_span_exporter.py |
Add docstrings that explain purpose and usage | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Tool to execute bash commands."""
from __future__ import annotations
@@ -31,11 +32,17 @@
@dataclasses.dataclass(frozen=True)
class BashToolPolicy:
+ """Configuration for allow... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bash_tool.py |
Add docstrings that explain purpose and usage | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -28,6 +28,11 @@
class IntegrationClient:
+ """A client for interacting with Google Cloud Application Integration.
+
+ This class provides methods for retrieving OpenAPI spec for an integration or
+ a connection.
+ """
def __init__(
self,
@@ -41,6 +46,23 @@ actions: Optional[list[str... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/application_integration_tool/clients/integration_client.py |
Add well-formatted docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -22,6 +22,7 @@
class MockStrategy:
+ """Base class for mock strategies."""
async def mock(
self,
@@ -32,10 +33,12 @@ state_store: Dict[str, Any],
environment_data: Optional[str] = None,
) -> Dict[str, Any]:
+ """Generates a mock response for a tool call."""
raise NotI... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/strategies/base.py |
Add minimal docstrings for each function | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,15 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Function tool declaration builder using Pydantic's JSON schema generation.
+
+This module provides a streamlined approach to building FunctionDeclaration
+objects by leveraging Pydant... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/_function_tool_declarations.py |
Provide docstrings following PEP 257 | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -47,6 +47,14 @@ enable_cloud_logging: bool = False,
google_auth: Optional[tuple[Credentials, str]] = None,
) -> OTelHooks:
+ """Returns GCP OTel exporters to be used in the app.
+
+ Args:
+ enable_tracing: whether to enable tracing to Cloud Trace.
+ enable_metrics: whether to enable reporti... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/telemetry/google_cloud.py |
Write docstrings for data processing functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -39,6 +39,17 @@ location: Optional[str] = None,
user_agent: Optional[Union[str, List[str]]] = None,
) -> bigquery.Client:
+ """Get a BigQuery client.
+
+ Args:
+ project: The GCP project ID.
+ credentials: The credentials to use for the request.
+ location: The location of the BigQuery c... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/client.py |
Write docstrings describing functionality | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -70,6 +70,7 @@
def _find_value_by_key(data: Any, target_key: str) -> Optional[Any]:
+ """Recursively searches for a value by key in a nested structure."""
if isinstance(data, dict):
if target_key in data:
return data[target_key]
@@ -86,6 +87,7 @@
class ToolSpecMockStrategy(MockStrateg... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/strategies/tool_spec_mock_strategy.py |
Add clean documentation to messy code | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -28,6 +28,7 @@ def _construct_search_query_helper(
predicate: str, operator: str, items: list[str]
) -> str:
+ """Constructs a search query part for a specific predicate and items."""
if not items:
return ""
@@ -47,6 +48,59 @@ dataset_ids_filter: list[str] | None = None,
types_filte... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/search_tool.py |
Add docstrings to clarify complex logic | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -33,6 +33,25 @@
def _to_snake_case(text: str) -> str:
+ """Converts a string into snake_case.
+
+ Handles lowerCamelCase, UpperCamelCase, or space-separated case, acronyms
+ (e.g., "REST API") and consecutive uppercase letters correctly. Also handles
+ mixed cases with and without spaces.
+
+ Examp... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/_gemini_schema_util.py |
Add verbose docstrings with examples | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -20,6 +20,7 @@
class StatefulParameter(BaseModel):
+ """Represents a stateful parameter and its connections."""
parameter_name: str
"""The name of the shared parameter (e.g., "ticket_id")."""
@@ -32,6 +33,7 @@
class ToolConnectionMap(BaseModel):
+ """Represents the map of tool connections."... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/tool_connection_map.py |
Write reusable docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -34,13 +34,16 @@
class BaseAPIHubClient(ABC):
+ """Base class for API Hub clients."""
@abstractmethod
def get_spec_content(self, resource_name: str) -> str:
+ """From a given resource name, get the spec in the API Hub."""
raise NotImplementedError()
class APIHubClient(BaseAPIHubClie... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/apihub_tool/clients/apihub_client.py |
Generate NumPy-style docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -76,6 +76,11 @@
class ToolConnectionAnalyzer:
+ """
+ Uses an LLM to analyze stateful connections between tools. For example,
+ get_ticket will consume a ticket_id created by create_ticket, the analyzer
+ will create a list of such connections.
+ """
def __init__(
self, llm_name: str, ll... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/agent_simulator/tool_connection_analyzer.py |
Write Python docstrings for this snippet | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -34,6 +34,28 @@
class APIHubToolset(BaseToolset):
+ """APIHubTool generates tools from a given API Hub resource.
+
+ Examples::
+
+ apihub_toolset = APIHubToolset(
+ apihub_resource_name="projects/test-project/locations/us-central1/apis/test-api",
+ service_account_json="...",
+ ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/apihub_tool/apihub_toolset.py |
Please document this code using docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -25,12 +25,37 @@
class SecretManagerClient:
+ """A client for interacting with Google Cloud Secret Manager.
+
+ This class provides a simplified interface for retrieving secrets from
+ Secret Manager, handling authentication using either a service account
+ JSON keyfile (passed as a string) or a pree... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/apihub_tool/clients/secret_client.py |
Add professional docstrings to my codebase | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,6 +30,7 @@
class ConnectionsClient:
+ """Utility class for interacting with Google Cloud Connectors API."""
def __init__(
self,
@@ -38,6 +39,16 @@ connection: str,
service_account_json: Optional[str] = None,
):
+ """Initializes the ConnectionsClient.
+
+ Args:
+ ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/application_integration_tool/clients/connections_client.py |
Document this module using docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -44,6 +44,41 @@
# TODO(cheliu): Apply a common toolset interface
class ApplicationIntegrationToolset(BaseToolset):
+ """ApplicationIntegrationToolset generates tools from a given Application
+ Integration or Integration Connector resource.
+
+ Example Usage::
+
+ # Get all available tools for an int... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/application_integration_tool/application_integration_toolset.py |
Insert docstrings into my code | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -35,6 +35,10 @@
@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
+ credential ready for use.(Experime... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/base_authenticated_tool.py |
Annotate my code with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -33,6 +33,13 @@
@experimental(FeatureName.COMPUTER_USE)
class ComputerUseTool(FunctionTool):
+ """A tool that wraps computer control functions for use with LLMs.
+
+ This tool automatically normalizes coordinates from a virtual coordinate space
+ (by default 1000x1000) to the actual screen size. This a... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/computer_use/computer_use_tool.py |
Write clean docstrings for readability | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,6 +27,7 @@
@experimental(FeatureName.COMPUTER_USE)
class ComputerEnvironment(str, Enum):
+ """Case insensitive enum for computer environments."""
ENVIRONMENT_UNSPECIFIED = "ENVIRONMENT_UNSPECIFIED"
"""Defaults to browser."""
@@ -36,6 +37,12 @@
@experimental(FeatureName.COMPUTER_USE)
class ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/computer_use/base_computer.py |
Add docstrings that explain inputs and outputs | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -37,6 +37,23 @@
class IntegrationConnectorTool(BaseTool):
+ """A tool that wraps a RestApiTool to interact with a specific Application Integration endpoint.
+
+ This tool adds Application Integration specific context like connection
+ details, entity, operation, and action to the underlying REST API c... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/application_integration_tool/integration_connector_tool.py |
Write docstrings for utility functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -45,6 +45,7 @@
class BaseTool(ABC):
+ """The base class for all tools."""
name: str
"""The name of the tool."""
@@ -78,16 +79,52 @@ self.custom_metadata = custom_metadata
def _get_declaration(self) -> Optional[types.FunctionDeclaration]:
+ """Gets the OpenAPI specification of this to... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/base_tool.py |
Add docstrings for internal functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -36,6 +36,10 @@
@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
+ credential ready for use.... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/authenticated_function_tool.py |
Document helper functions with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -39,16 +39,32 @@
@runtime_checkable
class ToolPredicate(Protocol):
+ """Base class for a predicate that defines the interface to decide whether a
+
+ tool should be exposed to LLM. Toolset implementer could consider whether to
+ accept such instance in the toolset's constructor and apply the predicate ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/base_toolset.py |
Add docstrings that explain inputs and outputs | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -28,8 +28,13 @@
@experimental(FeatureName.GOOGLE_CREDENTIALS_CONFIG)
class BigQueryCredentialsConfig(BaseGoogleCredentialsConfig):
+ """BigQuery Credentials Configuration for Google API tools (Experimental).
+
+ Please do not use this in production, as it may be deprecated later.
+ """
def __post_... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/bigquery_credentials.py |
Add docstrings to meet PEP guidelines | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -26,6 +26,7 @@
class WriteMode(Enum):
+ """Write mode indicating what levels of write operations are allowed in BigQuery."""
BLOCKED = 'blocked'
"""No write operations are allowed.
@@ -49,6 +50,7 @@
@experimental(FeatureName.BIG_QUERY_TOOL_CONFIG)
class BigQueryToolConfig(BaseModel):
+ """Co... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/config.py |
Add docstrings to meet PEP guidelines | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -35,6 +35,85 @@ credentials: Credentials,
settings: BigQueryToolConfig,
) -> Dict[str, Any]:
+ """Answers questions about structured data in BigQuery tables using natural language.
+
+ This function takes a user's question (which can include conversational
+ history for context) and references t... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/data_insights_tool.py |
Improve my code by adding docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -24,6 +24,28 @@ def list_dataset_ids(
project_id: str, credentials: Credentials, settings: BigQueryToolConfig
) -> list[str]:
+ """List BigQuery dataset ids in a Google Cloud project.
+
+ Args:
+ project_id (str): The Google Cloud project id.
+ credentials (Credentials): The credentials to ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/metadata_tool.py |
Add docstrings with type hints explained | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,6 +27,15 @@
class BigQueryToolset(GoogleApiToolset):
+ """Auto-generated BigQuery toolset based on Google BigQuery API v2 spec exposed by Google API discovery API.
+
+ Args:
+ client_id: OAuth2 client ID for authentication.
+ client_secret: OAuth2 client secret for authentication.
+ tool_f... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/google_api_tool/google_api_toolsets.py |
Add docstrings including usage examples | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -203,6 +203,84 @@ tool_context: ToolContext,
dry_run: bool = False,
) -> dict:
+ """Run a BigQuery or BigQuery ML SQL query in the project and return the result.
+
+ Args:
+ project_id (str): The GCP project id in which the query should be
+ executed.
+ query (str): The BigQuery ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigquery/query_tool.py |
Write docstrings including parameters and return values | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -38,11 +38,23 @@ async def load_memory(
query: str, tool_context: ToolContext
) -> LoadMemoryResponse:
+ """Loads the memory for the current user.
+
+ Args:
+ query: The query to load the memory for.
+
+ Returns:
+ A list of memory results.
+ """
search_memory_response = await tool_context... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/load_memory_tool.py |
Create docstrings for reusable components | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,8 +27,13 @@
@experimental(FeatureName.GOOGLE_CREDENTIALS_CONFIG)
class BigtableCredentialsConfig(BaseGoogleCredentialsConfig):
+ """Bigtable Credentials Configuration for Google API tools (Experimental).
+
+ Please do not use this in production, as it may be deprecated later.
+ """
def __post_... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigtable/bigtable_credentials.py |
Replace inline comments with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -46,6 +46,23 @@
class OpenIdConfig(BaseModel):
+ """Represents OpenID Connect configuration.
+
+ Attributes:
+ client_id: The client ID.
+ auth_uri: The authorization URI.
+ token_uri: The token URI.
+ client_secret: The client secret.
+
+ Example:
+ config = OpenIdConfig(
+ ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/auth/auth_helpers.py |
Add well-formatted docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -66,6 +66,17 @@ ],
llm_request: LlmRequest,
) -> None:
+ """Adapt a computer use tool by replacing it with a modified version.
+
+ Args:
+ method_name: The name of the method (of BaseComputer class) to adapt (e.g.
+ 'wait').
+ adapter_func: A function that accepts exist... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/computer_use/computer_use_toolset.py |
Write docstrings that follow conventions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,6 +27,33 @@
class AutoAuthCredentialExchanger(BaseAuthCredentialExchanger):
+ """Automatically selects the appropriate credential exchanger based on the auth scheme.
+
+ Optionally, an override can be provided to use a specific exchanger for a
+ given auth scheme.
+
+ Example (common case):
+ ``... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.py |
Add missing documentation to my Python functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -26,6 +26,30 @@
def list_instances(project_id: str, credentials: Credentials) -> dict:
+ """List Bigtable instance ids in a Google Cloud project.
+
+ Args:
+ project_id (str): The Google Cloud project id.
+ credentials (Credentials): The credentials to use for the request.
+
+ Returns:
+ ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/bigtable/metadata_tool.py |
Write docstrings describing functionality | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -29,6 +29,26 @@
class SessionContext:
+ """Represents the context of a single MCP session within a dedicated task.
+
+ AnyIO's TaskGroup/CancelScope requires that the start and end of a scope
+ occur within the same task. Since MCP clients use AnyIO internally, we need
+ to ensure that the client's e... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/mcp_tool/session_context.py |
Add standardized docstrings across the file | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -21,8 +21,10 @@
class DataAgentCredentialsConfig(BaseGoogleCredentialsConfig):
+ """Data Agent Credentials Configuration for Google API tools."""
def __post_init__(self) -> DataAgentCredentialsConfig:
+ """Populate default scope if scopes is None."""
super().__post_init__()
if not se... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/data_agent/credentials.py |
Write docstrings for this repository | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -49,12 +49,14 @@
def _normalize_mime_type(mime_type: str | None) -> str | None:
+ """Returns the normalized MIME type, without parameters like charset."""
if not mime_type:
return None
return mime_type.split(';', 1)[0].strip()
def _is_inline_mime_type_supported(mime_type: str | None) -> ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/load_artifacts_tool.py |
Create docstrings for each class method | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -42,6 +42,25 @@
class OpenAPIToolset(BaseToolset):
+ """Class for parsing OpenAPI spec into a list of RestApiTool.
+
+ Usage::
+
+ # Initialize OpenAPI toolset from a spec string.
+ openapi_toolset = OpenAPIToolset(spec_str=openapi_spec_str,
+ spec_str_type="json")
+ # Or, initialize Open... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py |
Add docstrings to existing functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,8 +30,19 @@
class EnterpriseWebSearchTool(BaseTool):
+ """A Gemini 2+ built-in tool using web grounding for Enterprise compliance.
+
+ NOTE: This tool is not the same as Vertex AI Search, which is used to be
+ called "Enterprise Search".
+
+ See the documentation for more details:
+ https://clou... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/enterprise_search_tool.py |
Help me add docstrings to my project | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -65,11 +65,34 @@
class OpenApiSpecParser:
+ """Generates Python code, JSON schema, and callables for an OpenAPI operation.
+
+ This class takes an OpenApiOperation object and provides methods to generate:
+ 1. A string representation of a Python function that handles the operation.
+ 2. A JSON schema... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.py |
Write docstrings for algorithm functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,6 +27,7 @@
class DiscoveryEngineSearchTool(FunctionTool):
+ """Tool for searching the discovery engine."""
def __init__(
self,
@@ -38,6 +39,19 @@ filter: Optional[str] = None,
max_results: Optional[int] = None,
):
+ """Initializes the DiscoveryEngineSearchTool.
+
+ ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/discovery_engine_search_tool.py |
Write docstrings including parameters and return values | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -31,12 +31,28 @@
def rename_python_keywords(s: str, prefix: str = 'param_') -> str:
+ """Renames Python keywords by adding a prefix.
+
+ Example:
+ ```
+ rename_python_keywords('if') -> 'param_if'
+ rename_python_keywords('for') -> 'param_for'
+ ```
+
+ Args:
+ s: The input string.
+ pre... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/common/common.py |
Add inline docstrings for readability | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,8 +30,15 @@
class GoogleApiToOpenApiConverter:
+ """Converts Google API Discovery documents to OpenAPI v3 format."""
def __init__(self, api_name: str, api_version: str):
+ """Initialize the converter with the API name and version.
+
+ Args:
+ api_name: The name of the Google API (e... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py |
Add professional docstrings to my codebase | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Provides data for the agent."""
from __future__ import annotations
@@ -28,6 +29,14 @@
def _get_default_embedding_model() -> BaseEmbedding:
+ """Get the default Google Gemini ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/retrieval/files_retrieval.py |
Generate helpful docstrings for debugging | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""A retrieval tool that uses Vertex AI RAG to retrieve data."""
from __future__ import annotations
@@ -35,6 +36,7 @@
class VertexAiRagRetrieval(BaseRetrievalTool):
+ """A retri... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/retrieval/vertex_ai_rag_retrieval.py |
Help me document legacy Python code | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -33,6 +33,15 @@
@experimental(FeatureName.GOOGLE_TOOL)
class GoogleTool(FunctionTool):
+ """GoogleTool class for tools that call Google APIs.
+
+ This class is for developers to handcraft customized Google API tools rather
+ than auto generate Google API tools based on API specs.
+
+ This class handle... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/google_tool.py |
Generate missing documentation strings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -29,6 +29,7 @@ def _get_http_headers(
credentials: Credentials,
) -> dict[str, str]:
+ """Prepares headers for HTTP requests."""
if not credentials.token:
error_details = (
"The provided credentials object does not have a valid access"
@@ -49,6 +50,70 @@ project_id: str,
cred... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/data_agent/data_agent_tool.py |
Provide clean and structured docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -32,6 +32,20 @@ attributes: Optional[dict[str, str]] = None,
ordering_key: str = "",
) -> dict:
+ """Publish a message to a Pub/Sub topic.
+
+ Args:
+ topic_name (str): The Pub/Sub topic name (e.g.
+ projects/my-project/topics/my-topic).
+ message (str): The message content to pu... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/pubsub/message_tool.py |
Generate consistent documentation across files | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -31,6 +31,7 @@
@experimental(FeatureName.PUBSUB_TOOLSET)
class PubSubToolset(BaseToolset):
+ """Pub/Sub Toolset contains tools for interacting with Pub/Sub topics and subscriptions."""
def __init__(
self,
@@ -39,6 +40,15 @@ credentials_config: PubSubCredentialsConfig | None = None,
... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/pubsub/pubsub_toolset.py |
Write docstrings including parameters and return values | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -37,6 +37,11 @@
class FunctionTool(BaseTool):
+ """A tool that wraps a user-defined Python function.
+
+ Attributes:
+ func: The function to wrap.
+ """
def __init__(
self,
@@ -44,6 +49,15 @@ *,
require_confirmation: Union[bool, Callable[..., bool]] = False,
):
+ """I... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/function_tool.py |
Generate NumPy-style docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -38,6 +38,16 @@ user_agent: str | list[str] | None = None,
publisher_options: pubsub_v1.types.PublisherOptions | None = None,
) -> pubsub_v1.PublisherClient:
+ """Get a Pub/Sub Publisher client.
+
+ Args:
+ credentials: The credentials to use for the request.
+ user_agent: The user agent to... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/pubsub/client.py |
Add documentation for all methods | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -50,6 +50,12 @@
def _has_cancelled_error_context(exc: BaseException) -> bool:
+ """Returns True if `exc` is/was caused by `asyncio.CancelledError`.
+
+ Cancellation can be translated into other exceptions during teardown (e.g.
+ connection errors) while still retaining the original cancellation in an
... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/mcp_tool/mcp_session_manager.py |
Generate consistent docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -26,9 +26,14 @@
@experimental(FeatureName.GOOGLE_CREDENTIALS_CONFIG)
class PubSubCredentialsConfig(BaseGoogleCredentialsConfig):
+ """Pub/Sub Credentials Configuration for Google API tools (Experimental).
+
+ Please do not use this in production, as it may be deprecated later.
+ """
@model_validat... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/pubsub/pubsub_credentials.py |
Add docstrings for production code | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -25,6 +25,23 @@
def adk_to_mcp_tool_type(tool: BaseTool) -> mcp_types.Tool:
+ """Convert a Tool in ADK into MCP tool type.
+
+ This function transforms an ADK tool definition into its equivalent
+ representation in the MCP (Model Context Protocol) system.
+
+ Args:
+ tool: The ADK tool to conver... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/mcp_tool/conversion_utils.py |
Add detailed docstrings explaining each function | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -26,10 +26,26 @@
def _truncate(text: str, max_len: int) -> str:
+ """Truncate text to max length, appending '...' if truncated.
+
+ Args:
+ text: The text to truncate.
+ max_len: Maximum length before truncation.
+
+ Returns:
+ The truncated text with '...' appended if it exceeds max_le... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/utils/_debug_output.py |
Add docstrings to improve readability | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,6 +30,11 @@
class GoogleSearchTool(BaseTool):
+ """A built-in tool that is automatically invoked by Gemini 2 models to retrieve search results from Google Search.
+
+ This tool operates internally within the model and does not require or perform
+ local code execution.
+ """
def __init__(
... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/google_search_tool.py |
Write docstrings that follow conventions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Credential fetcher for Google Service Account."""
from __future__ import annotations
@@ -34,12 +35,40 @@
class ServiceAccountCredentialExchanger(BaseAuthCredentialExchanger):
... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.py |
Provide docstrings following PEP 257 | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -34,6 +34,13 @@
class OperationParser:
+ """Generates parameters for Python functions from an OpenAPI operation.
+
+ This class processes an OpenApiOperation object and provides helper methods
+ to extract information needed to generate Python function declarations,
+ docstrings, signatures, and JSON... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py |
Generate docstrings for this script | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -55,6 +55,41 @@
@runtime_checkable
class ProgressCallbackFactory(Protocol):
+ """Factory protocol for creating per-tool progress callbacks.
+
+ This protocol allows users to create different progress callbacks for
+ different tools based on tool name and runtime context. The factory receives
+ the too... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/mcp_tool/mcp_tool.py |
Write docstrings for algorithm functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -39,6 +39,7 @@
class AuthPreparationResult(BaseModel):
+ """Result of the credential preparation process."""
state: AuthPreparationState
auth_scheme: Optional[AuthScheme] = None
@@ -46,6 +47,7 @@
class ToolContextCredentialStore:
+ """Handles storage and retrieval of credentials within a To... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.py |
Add docstrings to existing functions | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -64,6 +64,35 @@
class McpToolset(BaseToolset):
+ """Connects to a MCP Server, and retrieves MCP Tools into ADK Tools.
+
+ This toolset manages the connection to an MCP server and provides tools
+ that can be used by an agent. It properly implements the BaseToolset
+ interface for easy integration wit... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/mcp_tool/mcp_toolset.py |
Add docstrings following best practices | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -14,6 +14,7 @@
# pylint: disable=g-import-not-at-top,protected-access
+"""Toolset for discovering, viewing, and executing agent skills."""
from __future__ import annotations
@@ -75,6 +76,7 @@
@experimental(FeatureName.SKILL_TOOLSET)
class ListSkillsTool(BaseTool):
+ """Tool to list all available... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/skill_toolset.py |
Replace inline comments with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -26,18 +26,92 @@
@experimental(FeatureName.TOOL_CONFIG)
class BaseToolConfig(BaseModel):
+ """The base class for all tool configs."""
model_config = ConfigDict(extra="forbid")
@experimental(FeatureName.TOOL_CONFIG)
class ToolArgsConfig(BaseModel):
+ """Config to host free key-value pairs for ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/tool_configs.py |
Fill in missing docstrings in my code | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -117,6 +117,7 @@ query: str,
output_dimensionality: Optional[int] = None,
) -> List[float]:
+ """Gets the embedding for the query."""
if dialect == DatabaseDialect.POSTGRESQL:
embedding_query = _generate_postgresql_for_embedding_query(
spanner_pg_vertex_ai_embedding_model_endpoint... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/spanner/search_tool.py |
Add structured docstrings to improve clarity | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Tool for setting model response when using output_schema with other tools."""
from __future__ import annotations
@@ -33,14 +34,35 @@
class SetModelResponseTool(BaseTool):
+ "... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/set_model_response_tool.py |
Generate descriptive docstrings automatically | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -54,6 +54,27 @@ params: Optional[dict] = None,
params_types: Optional[dict] = None,
) -> dict:
+ """Utility function to run a Spanner Read-Only query in the spanner database and return the result.
+
+ Args:
+ project_id (str): The GCP project id in which the spanner database
+ resides... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/spanner/utils.py |
Include argument descriptions in docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,11 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""General schema utilities.
+
+This module is for ADK internal use only.
+Please do not rely on the implementation details.
+"""
from __future__ import annotations
@@ -39,10 +44,26... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/utils/_schema_utils.py |
Add docstrings to improve code quality | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -28,6 +28,7 @@
class OAuth2CredentialExchanger(BaseAuthCredentialExchanger):
+ """Fetches credentials for OAuth2 and OpenID Connect."""
def _check_scheme_credential_type(
self,
@@ -59,6 +60,16 @@ self,
auth_credential: Optional[AuthCredential] = None,
) -> AuthCredential:
+ ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py |
Add inline docstrings for readability | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -30,6 +30,29 @@ credentials: Credentials,
named_schema: str = "",
) -> dict:
+ """List tables within the database.
+
+ Args:
+ project_id (str): The Google Cloud project id.
+ instance_id (str): The Spanner instance id.
+ database_id (str): The Spanner database id.
+ credentia... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/spanner/metadata_tool.py |
Add well-formatted docstrings | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -18,6 +18,11 @@
def get_tracking_headers() -> dict[str, str]:
+ """Returns a dictionary of HTTP headers for tracking API requests.
+
+ These headers are used to identify HTTP calls made by ADK towards
+ Vertex AI LLM APIs.
+ """
labels = get_client_labels()
header_value = " ".join(labels)
r... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/utils/_google_client_headers.py |
Generate consistent docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -22,6 +22,7 @@
class AuthCredentialMissingError(Exception):
+ """Exception raised when required authentication credentials are missing."""
def __init__(self, message: str):
super().__init__(message)
@@ -29,6 +30,7 @@
class BaseAuthCredentialExchanger:
+ """Base class for authentication cr... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/openapi_tool/auth/credential_exchangers/base_credential_exchanger.py |
Annotate my code with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -33,6 +33,13 @@
class ToolboxToolset(BaseToolset):
+ """A class that provides access to toolbox toolsets.
+
+ Example:
+ ```python
+ toolbox_toolset = ToolboxToolset("http://127.0.0.1:5000")
+ ```
+ """
def __init__(
self,
@@ -47,6 +54,31 @@ additional_headers: Optional[Mapping[st... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/toolbox_toolset.py |
Replace inline comments with docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -31,6 +31,39 @@ template: str,
readonly_context: ReadonlyContext,
) -> str:
+ """Populates values in the instruction template, e.g. state, artifact, etc.
+
+ This method is intended to be used in InstructionProvider based instruction
+ and global_instruction which are called with readonly_contex... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/utils/instructions_utils.py |
Add inline docstrings for readability | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -24,20 +24,52 @@
def transfer_to_agent(agent_name: str, tool_context: ToolContext) -> None:
+ """Transfer the question to another agent.
+
+ This tool hands off control to another agent when it's more suitable to
+ answer the user's question according to the agent's description.
+
+ Note:
+ For mo... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/transfer_to_agent_tool.py |
Generate missing documentation strings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -39,6 +39,7 @@
def _get_default_labels() -> List[str]:
+ """Returns a list of labels that are always added."""
framework_label = f"{_ADK_LABEL}/{version.__version__}"
if os.environ.get(_AGENT_ENGINE_TELEMETRY_ENV_VARIABLE_NAME):
@@ -50,6 +51,7 @@
@contextmanager
def client_label_context(clien... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/utils/_client_labels_utils.py |
Write docstrings including parameters and return values | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -35,6 +35,31 @@
class VertexAiSearchTool(BaseTool):
+ """A built-in tool using Vertex AI Search.
+
+ Attributes:
+ data_store_id: The Vertex AI search data store resource ID.
+ search_engine_id: The Vertex AI search engine resource ID.
+
+ To dynamically customize the search configuration at run... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/vertex_ai_search_tool.py |
Generate consistent docstrings | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utilities for model name validation and parsing."""
from __future__ import annotations
@@ -27,10 +28,24 @@
def is_gemini_model_id_check_disabled() -> bool:
+ """Returns True ... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/utils/model_name_utils.py |
Create documentation for each function signature | # Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | --- +++ @@ -27,8 +27,13 @@
@experimental(FeatureName.GOOGLE_CREDENTIALS_CONFIG)
class SpannerCredentialsConfig(BaseGoogleCredentialsConfig):
+ """Spanner Credentials Configuration for Google API tools (Experimental).
+
+ Please do not use this in production, as it may be deprecated later.
+ """
def __post_in... | https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/tools/spanner/spanner_credentials.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.