Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions livekit-agents/livekit/agents/voice/agent_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2690,6 +2690,10 @@ def _create_assistant_message(
if fnc_executed_ev._handoff_required and new_agent_task and not ignore_task_switch:
self._session.update_agent(new_agent_task)
draining = True
# Skip chat context update and reply creation - the new agent will handle this.
# The old realtime session is being closed by update_agent(), so we cannot
# continue using self._rt_session after this point.
return

if len(new_fnc_outputs) > 0:
# wait all speeches played before updating the tool output and generating the response
Expand Down
7 changes: 6 additions & 1 deletion livekit-agents/livekit/agents/voice/agent_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,12 @@ async def _update_activity_task(
if old_task is not None:
await old_task

await self._update_activity(agent)
# If the target agent has an existing activity (was paused), resume it
# Otherwise, start a new activity
if agent._activity is not None:
await self._update_activity(agent, new_activity="resume")
else:
await self._update_activity(agent)

def _on_error(
self,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
__version__ = "1.4.1"

Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def __init__(
user_transcription=input_audio_transcription is not None,
auto_tool_reply_generation=True,
audio_output=types.Modality.AUDIO in modalities,
manual_function_calls=False,
manual_function_calls=True,
)
)

Expand Down