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:
LlmAgent using LocalMCPToolsetWrapper(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", line183, instdio_clientanyio.create_task_group() astg,
File"/home/appuser/.cache/pypoetry/.../site-packages/anyio/_backends/_asyncio.py", line778, in__aexit__ifself.cancel_scope.__exit__(type(exc), exc, exc.__traceback__):
RuntimeError: AttemptedtoexitcancelscopeinadifferenttaskthanitwasenteredinConsequences (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.
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
agent_engines.create()), linked to Gemini Enterprise.LlmAgentusingLocalMCPToolsetWrapper(MCPToolset).StdioConnectionParams(StdioServerParameters).get_tools()returning[]).Steps Taken
Observed Failure (Full Traceback Snippet)
{...} File"/home/appuser/.cache/pypoetry/.../site-packages/mcp/client/stdio/__init__.py", line183, instdio_clientanyio.create_task_group() astg, File"/home/appuser/.cache/pypoetry/.../site-packages/anyio/_backends/_asyncio.py", line778, in__aexit__ifself.cancel_scope.__exit__(type(exc), exc, exc.__traceback__): RuntimeError: AttemptedtoexitcancelscopeinadifferenttaskthanitwasenteredinConsequences (Key Issue)
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, andanyiodependencies that is compatible with the Vertex AI Agent Engine runtime, or a fix for this concurrency bug in the latest release.