You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VertexAiRagRetrieval.run_async() blocks the event loop with synchronous gRPC call #5033
VertexAiRagRetrieval.run_async() calls rag.retrieval_query() directly, which uses synchronous gRPC under the hood (grpc._channel._blocking → call.next_event()). Despite being an async def method, the entire call blocks the event loop for 1-2 seconds on every invocation.
This is particularly problematic in real-time/streaming applications (e.g. StreamingMode.BIDI with gemini-live-* models) where blocking the event loop causes audio/video desync and dropped frames.
Stack trace captured via event loop watchdog
File "google/adk/tools/retrieval/vertex_ai_rag_retrieval.py", line 95, in run_async
response = rag.retrieval_query(
File "vertexai/preview/rag/rag_retrieval.py", line 270, in retrieval_query
response = client.retrieve_contexts(request=request)
File "grpc/_channel.py", line 1150, in _blocking
event = call.next_event()
Event loop blocked for 1.2s+ on every RAG tool call — not just the first.
@overrideasyncdefrun_async(self, *, args, tool_context) ->Any:
from ...dependencies.vertexaiimportrag# This is a synchronous gRPC call that blocks the event loopresponse=rag.retrieval_query(...)
Suggested fix
Wrap the synchronous call with asyncio.to_thread():
This is the same pattern used to fix the equivalent issue in GCS artifact storage (#1346 / PR #1347).
Environment
google-adk==1.23.0 (also verified on main — still present)
google-cloud-aiplatform==1.135.0
Python 3.13
Using StreamingMode.BIDI with gemini-live-2.5-flash-native-audio
Hi @loic-combis , thanks for the raising this. To help us get a full understanding of the issue, would you mind sharing minimal reproduction code? Thanks!
Hi @loic-combis , We are closing this issue because it has been inactive for a while without the requested details. If you still need help, please feel free to reach out.
Thanks.
Activity
sanketpatil06 commentedon Mar 31, 2026
Hi @loic-combis , thanks for the raising this. To help us get a full understanding of the issue, would you mind sharing minimal reproduction code? Thanks!
fix(tools): prevent VertexAiRagRetrieval from blocking the event loop
sanketpatil06 commentedon May 22, 2026
Hi @loic-combis , We are closing this issue because it has been inactive for a while without the requested details. If you still need help, please feel free to reach out.
Thanks.
fix: prevent VertexAiRagRetrieval from blocking the event loop
fix: prevent VertexAiRagRetrieval from blocking the event loop