Repository navigation
Add Toolset Authentication per issue #1227 - 4 - #2138
Conversation
Added documentation for the new Toolset-level authentication feature and improved the visual rendering of our authentication flow diagrams.
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
joefernandez
left a comment
There was a problem hiding this comment.
Content review report
- Review Score: 95
- Overall assessment: 🟡 Medium Risk
- Summary reasoning: The prose describing toolset-level auth is accurate against
_toolset_auth.resolve_toolset_authandBaseToolset.get_auth_config. The one substantive problem is the new sequence diagram: it is headed "Toolset authentication flow" but draws the per-toolrequest_credentialhandshake with BigQuery participants, which misrepresents a shipped capability. The remaining items are a malformed link, a non-runnable code sample and a missing version note. - Recommended action: Approve with these specific changes. The diagram should be redrawn (or dropped) so it does not imply
BigQueryToolsetuses toolset-level auth — it does not overrideget_auth_config()(bigquery_toolset.py) — and the sample should be made runnable. No legal, privacy, security, pricing or third-party-claim risk in this change. - Number of lines changed: M, 55
- Number of files changed: 1
🟡 Medium risk items
- The
#### Toolset authentication flowmermaid diagram at lines 434-457 depicts the per-tooltool_context.request_credentialhandshake (Tool-->>Agent: Request Credentials,Tool->>Google: Run API Call (BigQuery)), not the toolset-level flow the section describes, where the framework resolves auth beforeget_tools()is called. It is also a near-duplicate of theauth_part1.svgdiagram at line 401. Because the participants are named for BigQuery, a reader will reasonably conclude the shippedBigQueryToolsetuses toolset-level auth; it does not. Suggested change: redraw with generic participants and theget_auth_config()→adk_request_credential→get_tools()ordering (inline suggestion below), or remove the diagram.
🟢 Low risk items
-
Line 412: the link to "Handle the interactive OAuth/OIDC flow" has a stray trailing
)that renders as literal text, and it is an absolutehttps://adk.devURL for a heading on this same page. Use the in-page anchor#handle-the-interactive-oauthoidc-flow-client-side. -
Lines 419-430: the sample is not runnable.
AuthConfig(...)passes a literalEllipsiswhere the requiredauth_schemefield belongs (auth_tool.py#L59), andget_tools()is an@abstractmethod(base_toolset.py#L90), soMyAuthenticatedToolsetcannot be instantiated. -
Line 416: no availability note.
get_auth_config()and the framework support that calls it first shipped ingoogle-adkv1.24.0 (commit381d44ca, 2026-01-29). On earlier releases the base method returnsNone(base_toolset.py#L264) and nothing calls it, so the feature silently does nothing.
Cosmetic, non-risk: trailing whitespace on lines 407, 444, 446 and 451.
Note: the AuthConfig | None return annotation is fine as written — google-adk requires Python >= 3.10 and ADK itself uses that form (agent_registry.py#L133) — so no from __future__ import annotations is needed.
Applied feedback
joefernandez
left a comment
There was a problem hiding this comment.
Approved with a few comments.
Note that I recommend dropping the new mermaid diagram
Applied feedback
removed flow and added version tag
Added documentation for the new Toolset-level authentication feature and improved the visual rendering of our authentication flow diagrams.
Technical Report: Toolset Authentication Documentation Verification
1. Verification of Import Statements
Snippet Under Review
PASSsrc/google/adk/auth/__init__.py:L25AuthConfigis exposed directly by thegoogle.adk.authtop-level namespace (from .auth_tool import AuthConfig).src/google/adk/tools/base_toolset.py:L63BaseToolsetis defined atgoogle.adk.tools.base_toolset.BaseToolset. Importing fromgoogle.adk.tools.base_toolsetresolves without error.2. Method Signature and Subclassing
Snippet Under Review
PASSsrc/google/adk/tools/base_toolset.py:L225-L241BaseToolset.get_auth_configdefinesdef get_auth_config(self) -> Optional[AuthConfig]: return None. The return type annotationAuthConfig | Noneis valid in Python 3.10+ and conforms withOptional[AuthConfig].tests/unittests/auth/test_toolset_auth.py:L43-L57Unit tests demonstrate custom toolsets (
MockToolset(BaseToolset)) overridingget_auth_config()using this exact pattern.3. Pre-Execution Authentication Resolution
Draft Statement Under Review
PASSsrc/google/adk/flows/llm_flows/base_llm_flow.py:L1414-L1427In
BaseLlmFlow._preprocess_async,self._resolve_toolset_auth(invocation_context, agent)executes prior to_process_agent_tools, guaranteeing credentials are resolved beforeget_tools()is invoked.src/google/adk/flows/llm_flows/base_llm_flow.py:L187-L193_resolve_toolset_authloops overagent.tools, inspects instances ofBaseToolset, and queriestool_union.get_auth_config().4. Pausing Execution and Emitting
adk_request_credentialDraft Statement Under Review
PASSsrc/google/adk/flows/llm_flows/functions.py:L64REQUEST_EUC_FUNCTION_CALL_NAMEis defined as'adk_request_credential'.src/google/adk/flows/llm_flows/functions.py:L350-L362build_auth_request_eventconstructs the function call event usingname=REQUEST_EUC_FUNCTION_CALL_NAME.src/google/adk/flows/llm_flows/base_llm_flow.py:L236-L244Yields the auth request event and sets
invocation_context.end_invocation = True, safely interrupting the execution flow.