Text Messages Don't Create Session Events in Live Streaming Mode
Summary
In live streaming mode, text messages sent via live_request_queue.send_content() do not create Session events with role="user", while audio messages sent via live_request_queue.send_realtime() do create these events.
Current Behavior
live_request_queue.send_content(): Bypasses Session event creation and goes directly to LLM viasend_content()live_request_queue.send_realtime(): Creates Session events withrole="user"through model transcription feature
Expected Behavior
Both send_content() and send_realtime() should consistently create Session events with role="user" for proper conversation history tracking.
Root Cause
Text content sent via send_content() in live mode bypasses the normal _append_new_message_to_session() pathway used in non-live mode. Audio blobs work because the LLM model's transcription feature generates LlmResponse objects with role="user" content that flow back through the system.
Impact
- Inconsistent Session history between text and audio inputs
- Missing user messages in Session events when using
send_content() - Potential issues with conversation tracking and debugging
Code Location
LiveRequestQueue.send_content()andsend_realtime()insrc/google/adk/agents/live_request_queue.pyBaseLlmFlow._send_to_model()insrc/google/adk/flows/llm_flows/base_llm_flow.pyRunner._append_new_message_to_session()insrc/google/adk/runners.pyGeminiLlmConnection.receive()transcription handling insrc/google/adk/models/gemini_llm_connection.py
I assumed that's the way it was intended. After all, it makes no sense to add the audio user to the event, it just clutters the event and takes up extra space. Text messages can be added separately, controlling what you add.
It would be cool to have a flag to delete agent audio data. Since they clog up the database a lot and don't carry any meaningful load. I made a wrapper for myself over DatabaseSessionService and delete agent audio data. It saves a lot of space.
@NikitaZemtsov This issue is about sending text content, e.g.:
content = Content(
role="user", parts=[Part.from_text(text="Hello")]
)
live_request_queue.send_content(content=content)
This is not added to the Session. Audio blobs work fine as they are transcribed and added to Session as expected.
Hi @frankfarzan ,
First of all, my apologies — I wasn't aware that this issue had already been reported. I ended up creating a duplicate issue with a possible fix. The changes I made resolved the problem for me: user input messages are now being saved correctly. You can check the details in #2175.
As for @NikitaZemtsov — regarding the audio blobs from the agent, I also duplicated that issue. However, the fix is quite straightforward: you just need to filter out inline_data in each append method of the session service (though I'm not sure if this applies to the Vertex session service). More details are in #2172.
@hangfei FYI
We are working on the support.
This is fixed now. Please check latest release.