Skip to content

Conversation

@longcw
Copy link
Contributor

@longcw longcw commented Nov 26, 2025

  1. ensure agent_turn is under the agent_session span
  2. fix agent_speaking span when false interruption happens
  3. add agent_turn for tts_task

example: function call and paused agent speeches
image

@longcw longcw requested a review from a team November 26, 2025 07:55
@chenghao-mou
Copy link
Contributor

chenghao-mou commented Nov 26, 2025

There is another similar issue: when dealing with false interruption, agent_speaking (after the pause) is grouped under a user_turn. I am open to solving it in a different PR.

Screenshot 2025-11-26 at 10 40 45

@longcw
Copy link
Contributor Author

longcw commented Nov 26, 2025

There is another similar issue: when dealing with false interruption, agent_speaking (after the pause) is grouped under a user_turn. I am open to solving it in a different PR.

oh right, it's because the speaking state is updated in _start_false_interruption_timer. I'll create a fix.

) -> None:
from .agent import ModelSettings

turn_id = utils.shortuuid("agent_turn_")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named generation_id instead?

@longcw longcw changed the title ensure agent_turn is always under the agent_session turn fix agent_turn and agent_speaking spans hierarchy & add agent_turn for tts_task Nov 27, 2025
@longcw longcw requested review from a team and theomonnom November 27, 2025 06:53
@longcw
Copy link
Contributor Author

longcw commented Nov 27, 2025

There is another similar issue: when dealing with false interruption, agent_speaking (after the pause) is grouped under a user_turn. I am open to solving it in a different PR.

oh right, it's because the speaking state is updated in _start_false_interruption_timer. I'll create a fix.

fixed in this pr as well.

Copy link
Contributor

@chenghao-mou chenghao-mou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work!

Tested with false interruptions and session.say. Spans were created correctly.

@longcw longcw merged commit 13580b3 into main Nov 28, 2025
17 of 18 checks passed
@longcw longcw deleted the longc/fix-nested-agent-turn branch November 28, 2025 01:47
return self._id

@property
def generation_id(self) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this field private?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, #4124

arvindvs pushed a commit to arvindvs/livekit-agents that referenced this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants