Skip to content

fix(live): transfer to the target agent regardless of function response order - #6608

Merged
wuliang229 merged 1 commit into
v1from
port-v1-live-transfer
Aug 6, 2026
Merged

fix(live): transfer to the target agent regardless of function response order#6608
wuliang229 merged 1 commit into
v1from
port-v1-live-transfer

Conversation

@wuliang229

@wuliang229wuliang229 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Ports the fix for #6541 to the v1 branch.

…se order
In Live mode, `BaseLlmFlow.run_live()` gated agent transfer on whether the
`transfer_to_agent` function response was `event.content.parts[0]`. When the
model issues `transfer_to_agent` alongside other function calls, the responses
are merged into a single event in call order, so a non-transfer tool's response
can land first and the transfer is silently ignored: both tools run, the merged
event carries the correct `actions.transfer_to_agent`, but the target agent
never starts and the user keeps talking to the parent.
The positional check was originally only a connection-teardown heuristic, while
the transfer itself was correctly gated on `actions.transfer_to_agent` in
`_postprocess_live`. When the transfer moved into `run_live` to stop the parent
and child from both processing the same function response, it was nested under
that heuristic and inherited its assumption that `transfer_to_agent` is the only
call in the turn.
Gate the transfer on `event.actions.transfer_to_agent`, which restores the
original predicate and matches `run_async`. Besides the ordering case, this
fixes two related Live-only gaps:
- A tool that requests a transfer by setting `actions.transfer_to_agent`
directly, rather than calling `transfer_to_agent`, now transfers in Live as
it already does in `run_async`.
- A `transfer_to_agent` response whose action was suppressed, for example by
a `before_tool_callback` overriding the transfer tool, no longer closes the
parent connection. Previously the connection was closed and `send_task`
cancelled with no child agent taking over, stranding the Live session.
Behavior is unchanged for a lone `transfer_to_agent` call and for parallel calls
that do not transfer. The sibling `task_completed` gate still keys off
`parts[0]` and has the same order dependency; it is left for a follow-up.
@adk-botadk-bot added the live [Component] This issue is related to live, voice and video chat label Aug 6, 2026
@wuliang229
wuliang229 marked this pull request as ready for review August 6, 2026 02:01
@wuliang229
wuliang229 merged commit 302885b into v1Aug 6, 2026
15 checks passed
@wuliang229
wuliang229 deleted the port-v1-live-transfer branch August 7, 2026 21:14
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

live[Component] This issue is related to live, voice and video chat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@wuliang229@adk-bot