Skip to content

Add Toolset Authentication per issue #1227 - 4 - #2138

Open
zyantw wants to merge 1 commit into
mainfrom
zyantw-patch-5
Open

Add Toolset Authentication per issue #1227 - 4#2138
zyantw wants to merge 1 commit into
mainfrom
zyantw-patch-5

Conversation

@zyantw

@zyantw zyantw commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Added documentation for the new Toolset-level authentication feature and improved the visual rendering of our authentication flow diagrams.


Technical Verification Against google/adk-python

Verification of Import Statements

  • Snippet Under Review:
    from google.adk.auth import AuthConfig
    from google.adk.tools.base_toolset import BaseToolset
  • Status: PASS
  • Citations & Verification:
    • auth/init.py:L25: AuthConfig is exposed directly by the google.adk.auth top-level namespace.
    • base_toolset.py:L38: BaseToolset is located at google.adk.tools.base_toolset. Importing from this module path resolves without error.

Method Signature and Subclassing

  • Snippet Under Review:
    class MyAuthenticatedToolset(BaseToolset):
    
      def get_auth_config(self) -> AuthConfig | None:
        return AuthConfig(...)
  • Status: PASS
  • Citations & Verification:
    • base_toolset.py:L225-241: BaseToolset.get_auth_config defines def get_auth_config(self) -> Optional[AuthConfig]: return None.
    • The return type annotation AuthConfig | None is valid in Python 3.10+ and conforms with Optional[AuthConfig].
    • test_toolset_auth.py:L43-57: Unit tests demonstrate custom toolsets overriding get_auth_config() using this exact pattern.

Pre-Execution Authentication Resolution

  • Draft Statement: "Under the hood, the BaseLlmFlow automatically checks your BaseToolset for authentication requirements before it even lists or executes any tools. It does this by checking the toolset's get_auth_config() method."
  • Status: PASS
  • Citations & Verification:
    • base_llm_flow.py:L1158-1167: In BaseLlmFlow._preprocess_async, self._resolve_toolset_auth(invocation_context, agent) executes before _process_agent_tools, guaranteeing credentials are resolved before get_tools() is called.
    • base_llm_flow.py:L171-177: _resolve_toolset_auth loops over agent.tools, inspects instances of BaseToolset, and queries tool_union.get_auth_config().

Pausing Execution and Emitting adk_request_credential

  • Draft Statement: "1. Pause execution: It safely halts the current flow. 2. Request credentials: It issues an adk_request_credential event to the client..."
  • Status: PASS
  • Citations & Verification:
    • functions.py:L64: REQUEST_EUC_FUNCTION_CALL_NAME is set to 'adk_request_credential'.
    • functions.py:L341-351: build_auth_request_event builds the function call part using name=REQUEST_EUC_FUNCTION_CALL_NAME.
    • base_llm_flow.py:L220-227: Emits the event and sets invocation_context.end_invocation = True, safely interrupting the flow.

Added documentation for the new Toolset-level authentication feature and improved the visual rendering of our authentication flow diagrams.
@netlify

netlify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 4fd10b4
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a837583f2c93800084ba251
😎 Deploy Preview https://deploy-preview-2138--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@zyantw
zyantw requested a review from joefernandez August 17, 2026 21:01
@zyantw zyantw self-assigned this Aug 17, 2026

#### Toolset authentication flow

```mermaid

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried my best to make the flow as close as possible to the original in the page. Do you happen to have the mermaid code for that one? I can't find it. @joefernandez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant