chore: Replace imports by importing from actual module instead of from package (__init__.py)

PiperOrigin-RevId: 786342250
This commit is contained in:
Xiang (Sean) Zhou
2025-07-23 10:49:43 -07:00
committed by Copybara-Service
parent 430b82024f
commit 927c75f0ee
110 changed files with 221 additions and 218 deletions
+1 -1
View File
@@ -568,7 +568,7 @@ class SubAgentConfig(BaseModel):
```
# my_library/custom_agents.py
from google.adk.agents import LlmAgent
from google.adk.agents.llm_agent import LlmAgent
my_custom_agent = LlmAgent(
name="my_custom_agent",
+3 -1
View File
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
import os
import subprocess
from typing import Optional
@@ -24,7 +26,7 @@ from . import agent
"""
_AGENT_PY_TEMPLATE = """\
from google.adk.agents import Agent
from google.adk.agents.llm_agent import Agent
root_agent = Agent(
model='{model_name}',
@@ -23,10 +23,10 @@ from typing import Union
from google.genai.types import FunctionDeclaration
from typing_extensions import override
from .. import BaseTool
from ...auth.auth_credential import AuthCredential
from ...auth.auth_schemes import AuthScheme
from .._gemini_schema_util import _to_gemini_schema
from ..base_tool import BaseTool
from ..openapi_tool.openapi_spec_parser.rest_api_tool import RestApiTool
from ..openapi_tool.openapi_spec_parser.tool_auth_handler import ToolAuthHandler
from ..tool_context import ToolContext
@@ -21,11 +21,11 @@ from typing import Optional
from google.genai.types import FunctionDeclaration
from typing_extensions import override
from .. import BaseTool
from ...auth import AuthCredential
from ...auth import AuthCredentialTypes
from ...auth import OAuth2Auth
from ...auth.auth_credential import AuthCredential
from ...auth.auth_credential import AuthCredentialTypes
from ...auth.auth_credential import OAuth2Auth
from ...auth.auth_credential import ServiceAccount
from ..base_tool import BaseTool
from ..openapi_tool import RestApiTool
from ..openapi_tool.auth.auth_helpers import service_account_scheme_credential
from ..tool_context import ToolContext
@@ -21,8 +21,8 @@ from typing import Union
from typing_extensions import override
from ...agents.readonly_context import ReadonlyContext
from ...auth import OpenIdConnectWithConfig
from ...auth.auth_credential import ServiceAccount
from ...auth.auth_schemes import OpenIdConnectWithConfig
from ...tools.base_toolset import BaseToolset
from ...tools.base_toolset import ToolPredicate
from ..openapi_tool import OpenAPIToolset
+4 -2
View File
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
import re
from ..agents.readonly_context import ReadonlyContext
@@ -34,12 +36,12 @@ async def inject_session_state(
e.g.
```
...
from google.adk.utils import instructions_utils
from google.adk.utils.instructions_utils import inject_session_state
async def build_instruction(
readonly_context: ReadonlyContext,
) -> str:
return await instructions_utils.inject_session_state(
return await inject_session_state(
'You can inject a state variable like {var_name} or an artifact '
'{artifact.file_name} into the instruction template.',
readonly_context,