instruction
stringclasses
100 values
code
stringlengths
78
193k
response
stringlengths
259
170k
file
stringlengths
59
203
Fully document this Python 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...
--- +++ @@ -42,6 +42,7 @@ def _iter_artifact_dirs(root: Path) -> list[Path]: + """Returns artifact directory paths beneath a root.""" if not root.exists(): return [] artifact_dirs: list[Path] = [] @@ -54,6 +55,7 @@ def _file_uri_to_path(uri: str) -> Optional[Path]: + """Converts a file:// URI to a ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/artifacts/file_artifact_service.py
Generate 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...
--- +++ @@ -185,6 +185,7 @@ class LlmAgent(BaseAgent): + """LLM-based Agent.""" DEFAULT_MODEL: ClassVar[str] = 'gemini-2.5-flash' """System default model used when no model is set on an agent.""" @@ -507,6 +508,10 @@ @property def canonical_model(self) -> BaseLlm: + """The resolved self.model fie...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/llm_agent.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,13 @@ def _stable_model_digest(model: BaseModel) -> str: + """Returns a stable digest for a pydantic model. + + The digest is stable across: + - Python hash seeds (does not use `hash()`). + - Dict insertion ordering differences (canonicalizes via `sort_keys=True`). + - Pydantic `model_extr...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/auth_tool.py
Write docstrings describing each step
# 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,7 @@ class ArtifactVersion(BaseModel): + """Metadata describing a specific version of an artifact.""" model_config = ConfigDict( alias_generator=alias_generators.to_camel, @@ -65,6 +66,19 @@ def ensure_part(artifact: Union[types.Part, dict[str, Any]]) -> types.Part: + """Norma...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/artifacts/base_artifact_service.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. +"""Common configuration classes for agent YAML configs.""" from __future__ import annotations @@ -29,6 +30,7 @@ @experimental(FeatureName.AGENT_CONFIG) class ArgumentConfig(BaseMo...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/common_configs.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...
--- +++ @@ -18,6 +18,14 @@ def roll_die(sides: int, tool_context: ToolContext) -> int: + """Roll a die and return the rolled result. + + Args: + sides: The integer number of sides the die has. + + Returns: + An integer of the result of rolling the die. + """ result = random.randint(1, sides) if not ...
https://raw.githubusercontent.com/google/adk-python/HEAD/contributing/samples/tool_functions_config/tools.py
Document classes and their 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...
--- +++ @@ -35,16 +35,36 @@ @dataclasses.dataclass class _ArtifactEntry: + """Represents a single version of an artifact stored in memory. + + Attributes: + data: The actual data of the artifact. + artifact_version: Metadata about this specific version of the artifact. + """ data: types.Part artifac...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/artifacts/in_memory_artifact_service.py
Write documentation strings for class attributes
# 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,8 @@ @experimental class BaseCredentialService(ABC): + """Abstract class for Service that loads / saves tool credentials from / to + the backend credential store.""" @abstractmethod async def load_credential( @@ -33,10 +35,41 @@ auth_config: AuthConfig, callback_context: C...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/credential_service/base_credential_service.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. +"""Base credential exchanger interface.""" from __future__ import annotations @@ -25,6 +26,7 @@ class CredentialExchangeError(Exception): + """Base exception for credential exch...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/exchanger/base_credential_exchanger.py
Document classes and their 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""OAuth2 credential exchanger implementation.""" from __future__ import annotations @@ -44,6 +45,7 @@ @experimental class OAuth2CredentialExchanger(BaseCredentialExchanger): + "...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/exchanger/oauth2_credential_exchanger.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Credential refresher registry.""" from __future__ import annotations @@ -26,6 +27,7 @@ @experimental class CredentialRefresherRegistry: + """Registry for credential refresher ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/refresher/credential_refresher_registry.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...
--- +++ @@ -34,6 +34,11 @@ class ToolThreadPoolConfig(BaseModel): + """Configuration for the tool thread pool executor. + + Attributes: + max_workers: Maximum number of worker threads in the pool. Defaults to 4. + """ model_config = ConfigDict( extra='forbid', @@ -47,6 +52,11 @@ class Streamin...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/run_config.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...
--- +++ @@ -88,6 +88,14 @@ def _serialize_metadata_value(value: Any) -> str: + """Safely serializes metadata values to string format. + + Args: + value: The value to serialize. + + Returns: + String representation of the value. + """ if hasattr(value, "model_dump"): try: return value.model_...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/converters/event_converter.py
Document my Python 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Base credential refresher interface.""" from __future__ import annotations @@ -24,10 +25,16 @@ class CredentialRefresherError(Exception): + """Base exception for credential r...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/refresher/base_credential_refresher.py
Add docstrings for better understanding
# 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. +"""OAuth2 credential refresher implementation.""" from __future__ import annotations @@ -42,6 +43,7 @@ @experimental class OAuth2CredentialRefresher(BaseCredentialRefresher): + "...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/refresher/oauth2_credential_refresher.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Sequential agent implementation.""" from __future__ import annotations @@ -38,12 +39,14 @@ @experimental(FeatureName.AGENT_STATE) class SequentialAgentState(BaseAgentState): + ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/sequential_agent.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...
--- +++ @@ -27,6 +27,10 @@ @experimental class SessionStateCredentialService(BaseCredentialService): + """Class for implementation of credential service using session state as the + store. + Note: store credential in session may not be secure, use at your own risk. + """ @override async def load_credenti...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/credential_service/session_state_credential_service.py
Generate 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...
--- +++ @@ -57,6 +57,10 @@ @a2a_experimental class _A2aAgentExecutor(AgentExecutor): + """An AgentExecutor that runs an ADK Agent against an A2A request and + + publishes updates to an event queue. + """ def __init__( self, @@ -70,6 +74,7 @@ @override async def cancel(self, context: RequestCont...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/executor/a2a_agent_executor_impl.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...
--- +++ @@ -35,6 +35,15 @@ auth_scheme: AuthScheme, auth_credential: AuthCredential, ) -> Tuple[Optional[OAuth2Session], Optional[str]]: + """Create an OAuth2 session for token operations. + + Args: + auth_scheme: The authentication scheme configuration. + auth_credential: The authentication crede...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/oauth2_credential_util.py
Add docstrings to incomplete 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...
--- +++ @@ -32,6 +32,14 @@ def _get_last_human_messages(events: list[Event]) -> list[HumanMessage]: + """Extracts last human messages from given list of events. + + Args: + events: the list of events + + Returns: + list of last human messages + """ messages = [] for event in reversed(events): i...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/langgraph_agent.py
Document all public 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...
--- +++ @@ -18,6 +18,7 @@ def reimburse(purpose: str, amount: float) -> str: + """Reimburse the amount of money to the employee.""" return { 'status': 'ok', } @@ -26,8 +27,9 @@ def ask_for_approval( purpose: str, amount: float, tool_context: ToolContext ) -> dict[str, Any]: + """Ask for approva...
https://raw.githubusercontent.com/google/adk-python/HEAD/contributing/samples/tool_human_in_the_loop_config/tools.py
Add docstrings to my 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...
--- +++ @@ -40,6 +40,7 @@ class Context(ReadonlyContext): + """The context within an agent run.""" def __init__( self, @@ -49,6 +50,16 @@ function_call_id: str | None = None, tool_confirmation: ToolConfirmation | None = None, ) -> None: + """Initializes the Context. + + Args: + ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/context.py
Help me write clear 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...
--- +++ @@ -73,6 +73,7 @@ @experimental(FeatureName.AGENT_STATE) class BaseAgentState(BaseModel): + """Base class for all agent states.""" model_config = ConfigDict( extra='forbid', @@ -83,6 +84,7 @@ class BaseAgent(BaseModel): + """Base class for all agents in Agent Development Kit.""" model_...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/base_agent.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...
--- +++ @@ -38,6 +38,7 @@ class HttpCredentials(BaseModelWithConfig): + """Represents the secret token value for HTTP authentication, like user name, password, oauth token, etc.""" username: Optional[str] = None password: Optional[str] = None @@ -53,6 +54,7 @@ class HttpAuth(BaseModelWithConfig): + ""...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/auth_credential.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...
--- +++ @@ -45,9 +45,11 @@ class LlmCallsLimitExceededError(Exception): + """Error thrown when the number of LLM calls exceed the limit.""" class RealtimeCacheEntry(BaseModel): + """Store audio data chunks for caching before flushing.""" model_config = ConfigDict( arbitrary_types_allowed=True, @@...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/invocation_context.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...
--- +++ @@ -31,6 +31,7 @@ @experimental class AuthorizationServerMetadata(BaseModel): + """Represents the OAuth2 authorization server metadata per RFC8414.""" issuer: str authorization_endpoint: str @@ -41,6 +42,7 @@ @experimental class ProtectedResourceMetadata(BaseModel): + """Represents the OAuth2 pr...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/auth/oauth2_discovery.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...
--- +++ @@ -113,6 +113,17 @@ def _parse_cors_origins( allow_origins: list[str], ) -> tuple[list[str], Optional[str]]: + """Parse allow_origins into literal origins and a combined regex pattern. + + Args: + allow_origins: List of origin strings. Entries prefixed with 'regex:' are + treated as regex patte...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/adk_web_server.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Agent factory for creating Agent Builder Assistant with embedded schema.""" from __future__ import annotations @@ -44,6 +45,7 @@ class AgentBuilderAssistant: + """Agent Build...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/adk_agent_builder_assistant.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Sub-agent for Google Search functionality.""" from __future__ import annotations @@ -20,6 +21,7 @@ def create_google_search_agent() -> LlmAgent: + """Create a sub-agent that ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/sub_agents/google_search_agent.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Sub-agent for URL context fetching functionality.""" from __future__ import annotations @@ -20,6 +21,7 @@ def create_url_context_agent() -> LlmAgent: + """Create a sub-agent ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/sub_agents/url_context_agent.py
Add docstrings to my 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""ADK AgentConfig schema query tool for dynamic schema information access.""" from __future__ import annotations @@ -27,6 +28,52 @@ component: Optional[str] = None, field_p...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/query_schema.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Project explorer tool for analyzing structure and suggesting file paths.""" from __future__ import annotations @@ -26,6 +27,76 @@ async def explore_project(tool_context: ToolC...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/explore_project.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""File deletion tool for Agent Builder Assistant.""" from __future__ import annotations @@ -33,6 +34,32 @@ create_backup: bool = False, confirm_deletion: bool = True, ) ->...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/delete_files.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Cleanup unused files tool for Agent Builder Assistant.""" from __future__ import annotations @@ -29,6 +30,27 @@ file_patterns: list[str] | None = None, exclude_patterns: ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/cleanup_unused_files.py
Document my Python 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""File reading tool for Agent Builder Assistant.""" from __future__ import annotations @@ -28,6 +29,27 @@ async def read_files( file_paths: List[str], tool_context: ToolContext...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/read_files.py
Document this script properly
# 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. +"""Configuration file reader tool for existing YAML configs.""" from __future__ import annotations @@ -29,6 +30,29 @@ async def read_config_files( file_paths: List[str], tool_co...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/read_config_files.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Configuration file writer tool with validation-before-write.""" from __future__ import annotations @@ -58,6 +59,98 @@ backup_existing: bool = False, # Changed default to Fals...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/write_config_files.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...
--- +++ @@ -20,12 +20,36 @@ def _get_adk_metadata_key(key: str) -> str: + """Gets the A2A event metadata key for the given key. + + Args: + key: The metadata key to prefix. + + Returns: + The prefixed metadata key. + + Raises: + ValueError: If key is empty or None. + """ if not key: raise Valu...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/converters/utils.py
Add docstrings that explain 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...
--- +++ @@ -77,6 +77,7 @@ def _get_gcp_project_from_gcloud() -> str: + """Uses gcloud to get default project.""" try: result = subprocess.run( ["gcloud", "config", "get-value", "project"], @@ -90,6 +91,7 @@ def _get_gcp_region_from_gcloud() -> str: + """Uses gcloud to get default region.""" ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/cli_create.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Working directory helper tool to resolve path context issues.""" from __future__ import annotations @@ -30,6 +31,19 @@ session_state: Optional[Dict[str, Any]] = None, wor...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/utils/resolve_root_directory.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...
--- +++ @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +module containing utilities for conversion between A2A Part and Google GenAI Part +""" from __future__ import annotations @@ -55,6 +58,7 @@ def convert_a2a_part_to_genai_part( ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/converters/part_converter.py
Document this script properly
# 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, ...
--- +++ @@ -1,3 +1,4 @@+"""HTTP client for interacting with the ADK web server.""" # Copyright 2026 Google LLC # @@ -35,16 +36,45 @@ class AdkWebServerClient: + """HTTP client for interacting with the ADK web server for conformance tests. + + Usage patterns: + + # Pattern 1: Manual lifecycle management + ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/conformance/adk_web_server_client.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Utilities for generating Markdown reports for conformance tests.""" from __future__ import annotations @@ -31,6 +32,7 @@ summaries: list[_ConformanceTestSummary], report_...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/conformance/_generate_markdown_utils.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Helpers for normalizing file path strings produced by the model.""" from __future__ import annotations @@ -22,6 +23,20 @@ def sanitize_generated_file_path(file_path: str) -> s...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/utils/path_normalizer.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...
--- +++ @@ -43,6 +43,7 @@ class LongRunningFunctions: + """Keeps track of long running function calls and related responses.""" def __init__( self, part_converter: A2APartToGenAIPartConverter | None = None @@ -53,9 +54,18 @@ self._task_state: TaskState = TaskState.input_required def has_long_r...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/converters/long_running_functions.py
Expand my code with proper 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Pydantic models for ADK recordings.""" from __future__ import annotations @@ -27,6 +28,7 @@ class LlmRecording(BaseModel): + """Paired LLM request and response.""" model...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/plugins/recordings_schema.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""CLI commands for ADK conformance testing.""" from __future__ import annotations @@ -33,6 +34,7 @@ user_id: str = "adk_conformance_test_user", streaming_mode: StreamingMod...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/conformance/cli_record.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. +"""File writing tool for Agent Builder Assistant.""" from __future__ import annotations @@ -34,6 +35,29 @@ create_backup: bool = False, create_directories: bool = True, ) -...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/write_files.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...
--- +++ @@ -30,6 +30,7 @@ @a2a_experimental class AgentRunRequest(BaseModel): + """Data model for arguments passed to the ADK runner.""" user_id: Optional[str] = None session_id: Optional[str] = None @@ -78,6 +79,18 @@ request: RequestContext, part_converter: A2APartToGenAIPartConverter = convert_a...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/converters/request_converter.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...
--- +++ @@ -43,6 +43,7 @@ @dataclasses.dataclass class ExecuteInterceptor: + """Interceptor for the A2aAgentExecutor.""" before_agent: Optional[ Callable[[RequestContext], Awaitable[RequestContext]] @@ -82,6 +83,7 @@ @a2a_experimental class A2aAgentExecutorConfig(BaseModel): + """Configuration for t...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/executor/config.py
Create Google-style docstrings for 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Recording plugin for ADK conformance testing.""" from __future__ import annotations @@ -46,6 +47,7 @@ class _InvocationRecordingState(BaseModel): + """Per-invocation recordin...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/plugins/recordings_plugin.py
Add docstrings to improve collaboration
# 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...
--- +++ @@ -60,6 +60,7 @@ def __getattr__(name: str): + """Lazily import defaults so patching in tests keeps working.""" if name not in _LAZY_SERVICE_IMPORTS: raise AttributeError(f"module {__name__!r} has no attribute {name!r}") @@ -94,6 +95,52 @@ logo_image_url: Optional[str] = None, auto_crea...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/fast_api.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...
--- +++ @@ -37,6 +37,7 @@ def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None: + """Ensures staged requirements include Agent Engine dependencies.""" if not os.path.exists(requirements_txt_path): raise FileNotFoundError( f'requirements.txt not found at: {requirements_txt_path}'...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/cli_deploy.py
Generate docstrings for exported 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Validation logic for conformance test replay mode.""" from __future__ import annotations @@ -26,6 +27,7 @@ @dataclass class ComparisonResult: + """Result of comparing two obje...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/conformance/_replay_validators.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...
--- +++ @@ -11,6 +11,55 @@ # 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. +""" +ADK Service Registry. + +This module manages pluggable backend services for sessions, artifacts, and memory...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/service_registry.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Replay plugin for ADK conformance testing.""" from __future__ import annotations @@ -41,16 +42,19 @@ class ReplayVerificationError(Exception): + """Exception raised when repl...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/plugins/replay_plugin.py
Improve documentation 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""ADK source code search tool for Agent Builder Assistant.""" from __future__ import annotations @@ -32,6 +33,38 @@ context_lines: int = 3, case_sensitive: bool = False, )...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/tools/search_adk_source.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...
--- +++ @@ -45,6 +45,18 @@ class AgentLoader(BaseAgentLoader): + """Centralized agent loading with proper isolation, caching, and .env loading. + Support loading agents from below folder/file structures: + a) {agent_name}.agent as a module name: + agents_dir/{agent_name}/agent.py (with root_agent defined i...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/agent_loader.py
Create simple docstrings for beginners
# 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,12 @@ @functools.lru_cache(maxsize=1) def _get_explicit_env_keys() -> frozenset[str]: + """Returns env var keys set before ADK loads any `.env` files. + + This snapshot is used to preserve user-provided environment variables while + still allowing later `.env` files to override earlier ones v...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/envs.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...
--- +++ @@ -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. +"""Utilities for local .adk folder persistence.""" from __future__ import annotations @@ -41,6 +42,14 @@ ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/local_storage.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...
--- +++ @@ -36,6 +36,11 @@ def _create_symlink(symlink_path: str, target_path: str) -> bool: + """Creates a symlink at symlink_path pointing to target_path. + + Returns: + True if successful, False otherwise. + """ try: if os.path.islink(symlink_path): os.unlink(symlink_path) @@ -54,6 +59,7 @@ ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/logs.py
Write docstrings for backend 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...
--- +++ @@ -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. +"""Helpers for managing an agent's `.adk` folder.""" from __future__ import annotations @@ -19,6 +20,7 @@ ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/dot_adk_folder.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...
--- +++ @@ -27,6 +27,11 @@ class BuiltInCodeExecutor(BaseCodeExecutor): + """A code executor that uses the Model's built-in code executor. + + Currently only supports Gemini 2.0+ models, but will be expanded to + other models. + """ @override def execute_code( @@ -37,6 +42,7 @@ pass def process...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/built_in_code_executor.py
Add docstrings to my 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...
--- +++ @@ -46,6 +46,10 @@ def _redact_uri_for_log(uri: str) -> str: + """Returns a safe-to-log representation of a URI. + + Redacts user info (username/password) and query parameter values. + """ if not uri or not uri.strip(): return "<empty>" sanitized = uri.replace("\r", "\\r").replace("\n", "\\n")...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/service_factory.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...
--- +++ @@ -24,12 +24,20 @@ @a2a_experimental class TaskResultAggregator: + """Aggregates the task status updates and provides the final task state.""" def __init__(self): self._task_state = TaskState.working self._task_status_message = None def process_event(self, event: Event): + """Process...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/executor/task_result_aggregator.py
Generate docstrings for each module
# 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,24 @@ class BaseCodeExecutor(BaseModel): + """Abstract base class for all code executors. + + The code executor allows the agent to execute code blocks from model responses + and incorporate the execution results into the final response. + + Attributes: + optimize_data_file: If true, ext...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/base_code_executor.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...
--- +++ @@ -40,6 +40,14 @@ def convert_session_to_eval_invocations(session: Session) -> list[Invocation]: + """Converts a session data into a list of Invocation. + + Args: + session: The session that should be converted. + + Returns: + list: A list of invocation. + """ events = session.events if se...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/utils/evals.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Utility functions for code execution.""" from __future__ import annotations @@ -28,6 +29,7 @@ @dataclasses.dataclass(frozen=True) class File: + """A structure that contains a ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/code_execution_utils.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...
--- +++ @@ -34,6 +34,16 @@ class AgentEngineSandboxCodeExecutor(BaseCodeExecutor): + """A code executor that uses Agent Engine Code Execution Sandbox to execute code. + + Attributes: + sandbox_resource_name: If set, load the existing resource name of the code + interpreter extension instead of creating a ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/agent_engine_sandbox_code_executor.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...
--- +++ @@ -86,6 +86,7 @@ def _get_code_interpreter_extension(resource_name: str = None): + """Returns: Load or create the code interpreter extension.""" from vertexai.preview.extensions import Extension if not resource_name: @@ -104,6 +105,13 @@ class VertexAiCodeExecutor(BaseCodeExecutor): + """A co...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/vertex_ai_code_executor.py
Write proper docstrings for these 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...
--- +++ @@ -40,6 +40,17 @@ def _load_agent_card( agent_card: Optional[Union[AgentCard, str]], ) -> Optional[AgentCard]: + """Load agent card from various sources. + + Args: + agent_card: AgentCard object, path to JSON file, or None + + Returns: + AgentCard object or None if no agent card provided + +...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/utils/agent_to_a2a.py
Add docstrings that explain 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Utility functions for structured A2A request and response logging.""" from __future__ import annotations @@ -40,6 +41,7 @@ def _is_a2a_task(obj) -> bool: + """Check if an obj...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/logs/log_utils.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...
--- +++ @@ -83,6 +83,11 @@ class _EvalMetricResultWithInvocation(BaseModel): + """EvalMetricResult along with both actual and expected invocation. + + This is class is intentionally marked as private and is created for + convenience. + """ actual_invocation: Invocation expected_invocation: Invocation @@...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/agent_evaluator.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...
--- +++ @@ -39,6 +39,7 @@ def agent_config_discriminator(v: Any) -> str: + """Discriminator function that returns the tag name for Pydantic.""" if isinstance(v, dict): agent_class: str = v.get("agent_class", "LlmAgent") @@ -68,4 +69,5 @@ # Use a RootModel to represent the agent directly at the top level....
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/agent_config.py
Help me comply with documentation standards
# 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,48 @@ class GkeCodeExecutor(BaseCodeExecutor): + """Executes Python code in a secure gVisor-sandboxed Pod on GKE. + + This executor supports two modes of execution: 'job' and 'sandbox'. + + Job Mode (default): + Securely runs code by dynamically creating a Kubernetes Job for each execution ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/gke_code_executor.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...
--- +++ @@ -31,6 +31,7 @@ class EvaluateConfig(BaseModel): + """Contains configurations needed to run evaluations.""" model_config = ConfigDict( alias_generator=alias_generators.to_camel, @@ -54,6 +55,7 @@ class InferenceConfig(BaseModel): + """Contains configurations need to run inferences.""" ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/base_eval_service.py
Document this code for team use
# 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,12 @@ @a2a_experimental class AgentCardBuilder: + """Builder class for creating agent cards from ADK agents. + + This class provides functionality to convert ADK agents into A2A agent cards, + including extracting skills, capabilities, and metadata from various agent + types. + """ def...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/a2a/utils/agent_card_builder.py
Document this script properly
# 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,6 +18,7 @@ class ToolErrorType(str, enum.Enum): + """HTTP error types conforming to OpenTelemetry semantics.""" BAD_REQUEST = 'BAD_REQUEST' UNAUTHORIZED = 'UNAUTHORIZED' @@ -31,13 +32,22 @@ class ToolExecutionError(Exception): + """Represents an error that occurs during the execution of...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/errors/tool_execution_error.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...
--- +++ @@ -42,6 +42,11 @@ def add_default_retry_options_if_not_present(llm_request: LlmRequest): + """Adds default HTTP Retry Options, if they are not present on the llm_request. + + NOTE: This implementation is intended for eval systems internal usage. Do not + take direct dependency on it. + """ llm_reque...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/_retry_options_utils.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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Utilities for finding ADK source folder dynamically and loading schema.""" from __future__ import annotations @@ -31,6 +32,24 @@ def find_adk_source_folder(start_path: Optiona...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/built_in_agents/utils/adk_source_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...
--- +++ @@ -37,6 +37,7 @@ def _execute_in_process( code: str, globals_: dict[str, Any], result_queue: multiprocessing.Queue ) -> None: + """Executes code in a separate process and puts result in queue.""" stdout = io.StringIO() error = None try: @@ -48,11 +49,13 @@ def _prepare_globals(code: str, gl...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/unsafe_local_code_executor.py
Add docstrings explaining edge cases
# 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,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""An artifact service implementation using Google Cloud Storage (GCS). + +The blob name format used depends on whether the filename has a user namespace: + - For files with user namesp...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/artifacts/gcs_artifact_service.py
Add docstrings to incomplete 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...
--- +++ @@ -23,6 +23,10 @@ class AgentDetails(EvalBaseModel): + """Details about the individual agent in the App. + + This could be a root agent or the sub-agents in the Agent Tree. + """ name: str """The name of the Agent that uniquely identifies it in the App.""" @@ -39,6 +43,11 @@ class AppDetails...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/app_details.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...
--- +++ @@ -33,6 +33,19 @@ @experimental(FeatureName.AGENT_CONFIG) def from_config(config_path: str) -> BaseAgent: + """Build agent from a configfile path. + + Args: + config: the path to a YAML config file. + + Returns: + The created agent instance. + + Raises: + FileNotFoundError: If config file doesn...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/config_agent_utils.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...
--- +++ @@ -28,6 +28,23 @@ class LlmEventSummarizer(BaseEventsSummarizer): + """An LLM-based event summarizer for sliding window compaction. + + This class is responsible for summarizing a provided list of events into a + single compacted event. It is designed to be used as part of a sliding window + compaction...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/apps/llm_event_summarizer.py
Can you add docstrings to this Python 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...
--- +++ @@ -28,6 +28,7 @@ def get_eval_set_from_app_and_id( eval_sets_manager: EvalSetsManager, app_name: str, eval_set_id: str ) -> EvalSet: + """Returns an EvalSet if found; otherwise, raises NotFoundError.""" eval_set = eval_sets_manager.get_eval_set(app_name, eval_set_id) if not eval_set: raise No...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/_eval_sets_manager_utils.py
Fully document this Python 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...
--- +++ @@ -57,12 +57,17 @@ class EvalCaseResponses(BaseModel): + """Contains multiple responses associated with an EvalCase. + + Multiple responses are a result of repeated requests to generate inferences. + """ eval_case: EvalCase responses: list[list[Invocation]] class EvaluationGenerator: + """...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/evaluation_generator.py
Document this code for team use
# 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,36 +35,72 @@ class CodeExecutorContext: + """The persistent context used to configure the code executor.""" _context: dict[str, Any] def __init__(self, session_state: State): + """Initializes the code executor context. + + Args: + session_state: The session state to get the code...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/code_executor_context.py
Expand my code with proper 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...
--- +++ @@ -24,6 +24,7 @@ def _sanitize_eval_set_result_name(eval_set_result_name: str) -> str: + """Sanitizes the eval set result name.""" return eval_set_result_name.replace("/", "_") @@ -32,6 +33,7 @@ eval_set_id: str, eval_case_results: list[EvalCaseResult], ) -> EvalSetResult: + """Creates a...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/_eval_set_results_manager_utils.py
Generate docstrings for exported 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...
--- +++ @@ -23,30 +23,63 @@ class EvalSetsManager(ABC): + """An interface to manage Eval Sets.""" @abstractmethod def get_eval_set(self, app_name: str, eval_set_id: str) -> Optional[EvalSet]: + """Returns an EvalSet identified by an app_name and eval_set_id.""" @abstractmethod def create_eval_se...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/eval_sets_manager.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...
--- +++ @@ -16,7 +16,13 @@ class InputValidationError(ValueError): + """Represents an error raised when user input fails validation.""" def __init__(self, message="Invalid input."): + """Initializes the InputValidationError exception. + + Args: + message (str): A message describing why the input ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/errors/input_validation_error.py
Document this script properly
# 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,10 @@ class RougeEvaluator(Evaluator): + """Evaluates if agent's final response matches a golden/expected final response using Rouge_1 metric. + + Value range for this metric is [0,1], with values closer to 1 more desirable. + """ def __init__(self, eval_metric: EvalMetric): self._...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/final_response_match_v1.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...
--- +++ @@ -35,6 +35,16 @@ class ContainerCodeExecutor(BaseCodeExecutor): + """A code executor that uses a custom container to execute code. + + Attributes: + base_url: Optional. The base url of the user hosted Docker client. + image: The tag of the predefined image or custom image to run on the + cont...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/code_executors/container_code_executor.py
Expand my code with proper 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Config definition for SequentialAgent.""" from __future__ import annotations @@ -25,6 +26,7 @@ @experimental(FeatureName.AGENT_CONFIG) class SequentialAgentConfig(BaseAgentConf...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/agents/sequential_agent_config.py
Generate docstrings with parameter types
# 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,7 @@ class LocalEvalSetResultsManager(EvalSetResultsManager): + """An EvalSetResult manager that stores eval set results locally on disk.""" def __init__(self, agents_dir: str): self._agents_dir = agents_dir @@ -44,6 +45,7 @@ eval_set_id: str, eval_case_results: list[Eva...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/local_eval_set_results_manager.py
Add detailed documentation for each class
# 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...
--- +++ @@ -16,7 +16,13 @@ class NotFoundError(Exception): + """Represents an error that occurs when an entity is not found.""" def __init__(self, message="The requested item was not found."): + """Initializes the NotFoundError exception. + + Args: + message (str): An optional custom message to d...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/errors/not_found_error.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...
--- +++ @@ -76,6 +76,7 @@ def get_default_metric_info( metric_name: str, description: str = "" ) -> MetricInfo: + """Returns a default MetricInfo for a metric.""" return MetricInfo( metric_name=metric_name, description=description, @@ -86,12 +87,14 @@ def get_root_agent(agent_module_file_pat...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/cli_eval.py
Document all public 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...
--- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +"""Loading utilities for conformance testing.""" from __future__ import annotations @@ -28,6 +29,7 @@ def load_test_case(test_case_dir: Path) -> TestSpec: + """Load TestSpec fro...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/conformance/_generated_file_utils.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...
--- +++ @@ -71,6 +71,7 @@ def _add_rubrics_to_invocation( invocation: Invocation, rubrics_to_add: list[Rubric] ): + """Adds rubrics to invocation, throwing ValueError on duplicate rubric_id.""" if not invocation.rubrics: invocation.rubrics = [] existing_ids = {r.rubric_id for r in invocation.rubrics} ...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/evaluation/local_eval_service.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...
--- +++ @@ -56,6 +56,12 @@ enable_features: tuple[str, ...] = (), disable_features: tuple[str, ...] = (), ) -> None: + """Apply feature overrides from CLI flags. + + Args: + enable_features: Tuple of feature names to enable. + disable_features: Tuple of feature names to disable. + """ feature_over...
https://raw.githubusercontent.com/google/adk-python/HEAD/src/google/adk/cli/cli_tools_click.py