stream_query and HTTP Streaming to Vertex AI Agent Return Empty/Exhausted Responses (Works via ADK Web)
I am encountering an issue where my deployed Vertex AI Agent, which functions correctly and streams responses as expected via the official ADK web interface, consistently returns empty or exhausted results when attempting to access it programmatically (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/use/adk?hl=en#vertex-ai-sdk-for-python_6) through:
- vertexai.agent_engines.AgentEngine.stream_query()
- Direct HTTP POST requests to the deployed agent's endpoint with stream=True.
In both scenarios, the expected streaming output is absent. For agent_engine.stream_query(), the generator is immediately exhausted (yields no events). For the HTTP POST, response.text is an empty string.
This behavior suggests a discrepancy between how the ADK web interface interacts with the deployed agent and how the google-cloud-aiplatform library (specifically agent_engines) or direct HTTP calls are handled on the server side, or an unhandled client-side consumption issue given the ADK web's success.
Steps to Reproduce:
- Agent: The RAG agent sample from https://github.com/google/adk-samples/tree/main/python/agents/RAG.
- Deployment: Deploy this agent to Vertex AI Agent Engine. (Detailed deployment steps are available in the ADK samples README).
- ADK Web Verification: Confirm the deployed agent works as expected, including streaming responses, via "adk web" command.
- Run the given deployment/run.py script (I also added the HTTP POST as described in the documentation).
Regarding versions, they are following the poetry env given in the RAG repo: google-adk = 1.5.0 google-genai = 1.24.0 google-cloud-aiplatform = 1.101.0
Thanks in advance for the help, let me know if more context is needed.