Repository navigation
Closed
Labels
agent engine[Component] This issue is related to Vertex AI Agent Engine[Component] This issue is related to Vertex AI Agent Engineanswered[Status] This issue has been answered by the maintainer[Status] This issue has been answered by the maintainermcp[Component] This issues is related to MCP support[Component] This issues is related to MCP supportrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user response[Status] Issues which have been marked inactive since there is no user response
Description
Description
I am unable to run a custom ADK agent on the Vertex AI Agent Engine due to a concurrency crash occurring during the MCP client setup/teardown. This prevents the agent from processing user queries and, crucially, blocks the required OAuth consent flow from being triggered.
Environment Details
- Platform: Vertex AI Agent Engine (deployed via
agent_engines.create()), linked to Gemini Enterprise. - Agent Configuration:
LlmAgentusingLocalMCPToolsetWrapper(MCPToolset). - Connection:
StdioConnectionParams(StdioServerParameters). - Goal: Trigger the OAuth flow (which relies on
get_tools()returning[]).
Steps Taken
- Deployed Agent (after fixing the initial Node.js token check crash).
- Sent a user query (e.g., "list contacts") that forces a tool call.
Observed Failure (Full Traceback Snippet)
{...}
File "/home/appuser/.cache/pypoetry/.../site-packages/mcp/client/stdio/__init__.py", line 183, in stdio_client
anyio.create_task_group() as tg,
File "/home/appuser/.cache/pypoetry/.../site-packages/anyio/_backends/_asyncio.py", line 778, in __aexit__
if self.cancel_scope.__exit__(type(exc), exc, exc.__traceback__):
RuntimeError: Attempted to exit cancel scope in a different task than it was entered inConsequences (Key Issue)
- The agent process crashes immediately when attempting to connect to the MCP server.
- This crash prevents the Python tool code's OAuth trigger logic (
if not access_token: return []) from executing, meaning the user is never prompted for HubSpot authorization.
Request
We require guidance on a stable version combination for the google-adk, mcp, and anyio dependencies that is compatible with the Vertex AI Agent Engine runtime, or a fix for this concurrency bug in the latest release.
Reacted by Dirk Remmers and Mason Oh
Metadata
Metadata
Assignees
Labels
agent engine[Component] This issue is related to Vertex AI Agent Engine[Component] This issue is related to Vertex AI Agent Engineanswered[Status] This issue has been answered by the maintainer[Status] This issue has been answered by the maintainermcp[Component] This issues is related to MCP support[Component] This issues is related to MCP supportrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user response[Status] Issues which have been marked inactive since there is no user response
Activity
yukthiwgeotab commentedon Dec 8, 2025
Any progress on this? It has completely blocked our ability to use our remote mcp servers with agents deployed to agent engine
timjonez commentedon Dec 12, 2025
Also running into this issue
rrondir commentedon Dec 17, 2025
Same issue #3950 it applies to any mcp it seems
feat: start and close ClientSession in a single task in McpSessionMan…
llalitkumarrr commentedon Feb 3, 2026
Hello,
PR (#4025) related to this issue has been merged, kindly update to latest version to test this issue again.
adk-bot commentedon Feb 11, 2026
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
adk-bot commentedon Feb 19, 2026
This has been automatically closed because it has been marked as stale for over 7 days.
feat: start and close ClientSession in a single task in McpSessionMan…