adk-docs
adk-docs copied to clipboard
Missing documentation for Integrated OAuth flow with ADK Agents on Vertex AI / Gemini Enterprise
There is currently a lack of documentation regarding the end-to-end setup of an ADK agent hosted on Vertex AI via Gemini Enterprise, specifically concerning the Integrated Authorization Flow (OAuth).
Problem: When enabling OAuth in Gemini Enterprise for an agent, it is unclear how the retrieved access tokens are passed to the agent code or how to access them within the ADK LlmAgent or McpToolset configuration.
I am attempting to connect a remote MCP tool which requires authentication. I assume the agent needs to retrieve the token (e.g., from request headers or a context object) and pass it to the tool, but there are no examples or API references explaining this mechanism.
Current Code: I am initializing the toolset and agent as follows, but it is unclear how to retrieve the token from a Gemini Enterprise session to complete the tool setup:
# imports
#(...)
# Create MCP toolset
mcp_toolset = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url=os.getenv("MCP_SERVER_URL"),
),
errlog=None,
)
# Agent
root_agent = LlmAgent(
model="gemini-2.5-flash",
name='my_agent',
instruction=instruction,
tools=[mcp_toolset],
)
Expected Behavior: Documentation or a code sample demonstrating:
- How Gemini Enterprise passes the OAuth token to the ADK agent (is it in a session event?)
- How to access this token within the agent's runtime.
- How to correctly pass this token to an MCP tool or McpToolset for authenticated requests.