-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Refactor live SequentialAgent worklow and live event handling for reliability and cleaner session history #2295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ffe480f to
e25e725
Compare
…or reliability and cleaner session history
e25e725 to
923f57d
Compare
|
Can you check here as well? I’ve added a number of fixes related to events in live streaming and improvements to the sequential agents in live streaming, making them more deterministic. If everything looks good to you, I can proceed with implementing the |
|
@hangfei Could you please take a look? This can potentially solve multiple issues with the Live API usage raised across users. |
|
Hi, |
|
Thanks for the contribution. need to get this in first: #1867 and then we merge this change. |
Any updates here? |
|
@ac-machache Could you resolve the conflicts? |
|
@hangfei I’ve updated the code and resolved the previous conflicts, but there are still a few issues to address:
Let me know if you want me to focus on fixing a specific part next. |
|
2 and 3 should be fixed by other PRs. Please take another look and resolve merge conflicts. For 1, the purpose of task_completed is to ensure that the first agent knows when the task are completed. In bi-di streaming, as it's continuous streaming, it's not clear when it's completed. So that's why we need this function. the user needs to trigger this function by saying something like the task is completed. Without this, we will have another model where when the turn is complete, we transfer to next task. For both of the two design options, i'd like to learn more about your use cases to see which make more sense. We can also consider support both if both cases are reasonable. |
Let's focus on fixing the sequential agent issues first. |
|
Let's focus on solving one problem in one PR so it's easier and faster to merge. Thanks! |
|
Closing due to inactivity. Let's propose a new PR with a single focus. |
Architectural Improvements for Live-Running (BIDI) in ADK
1. SequentialAgent Transition Refactor #2261
task_completedtool injection insequential_agent.py.gemini_llm_connection.pyto listen for the Gemini API’sgeneration_completesignal.LlmResponsewithgeneration_complete=Trueandpartial=True._run_live_implto break the current sub-agent loop ongeneration_completeevents, enabling reliable sequential agent transitions based on deterministic signals.2. Capturing User Text Messages as Events #2175, #2045
run_liveinbase_llm_flow.pyto use anasyncio.Queueas a unified event bus for both user and model events._send_to_modeldetects user text messages, creates proper Event objects (author='user'), and enqueues them.send_handlerandreceive_handlertasks feed events into the queue.run_liveloop consumes the queue, yielding user text messages alongside other events for proper session recording.3. Preventing Session Clutter from Partial Events, #2162
gemini_llm_connection.py, setpartial=TrueforLlmResponseinstances with audioinline_datato avoid saving transient audio chunks.partial=False) is yielded.