adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

VertexAIRagRetrieval error when using in SequentialAgent in streaming mode.

Open torbilote opened this issue 1 year ago • 2 comments

Describe the bug VertexAiRagRetrieval tool does not work when the agent is a sub-agent of SequentialAgent in streaming mode.

Following code works as expected:

ask_vertex_retrieval = VertexAiRagRetrieval(name="RetrieveRAGTool", ...)

chat_agent = Agent(
   name="chat_agent",
   model="gemini-2.0-flash-live-preview-04-09",
   instruction="Answer the questions based on RetrieveRAGTool.",
   tools=[ask_vertex_retrieval],
   output_key='chat-agent-output'
)
root_agent = chat_agent

Whereas the following does not work:

ask_vertex_retrieval = VertexAiRagRetrieval(name="RetrieveRAGTool", ...)

chat_agent = Agent(
   name="chat_agent",
   model="gemini-2.0-flash-live-preview-04-09",
   instruction="Answer the questions based on RetrieveRAGTool.",
   tools=[ask_vertex_retrieval],
   output_key='chat-agent-output'
)
root_agent = SequentialAgent(
    name="sequential_agent",
    description='Execute the sequence of chatting and formatting responses.',
    sub_agents=[chat_agent]
)

Giving the error: Error in SSE stream: received 1007 (invalid frame payload data) Request contains an invalid argument.; then sent 1007 (invalid frame payload data) Request contains an invalid argument.

However if you erase the ask_vertex_retrieval tool it works fine.

** Steps to reproduce**: 1.Set up the project according to https://google.github.io/adk-docs/streaming/custom-streaming/ 2. Modify the agent as shown above.

Expected behavior RAG Retrieval Tool should work fine within SequentialAgent.

Desktop (please complete the following information):

  • OS: Windows
  • Python version(python -V): Python 3.12
  • ADK version(pip show google-adk): google-adk==1.2.1

Model Information: "gemini-2.0-flash-live-preview-04-09"

torbilote avatar Jul 01 '25 11:07 torbilote

Yes, I do see the same thing, thought there is an issue with the context management, while it seems to be the built-in function that detoriates this.

roman-loosli avatar Jul 03 '25 09:07 roman-loosli

This should be fixed now. Please retry with latest version. If you still see this, please raise another ticket.

hangfei avatar Nov 08 '25 04:11 hangfei