Skip to content

Agent stops responding if interrupted during a tool call with self.session.say #4413

@aumeshm

Description

@aumeshm

Bug Description

If the agent has a self.session.say inside of a tool call, and you interrupt right before it. The agent will be stuck and unable to respond. All events are blocked and only until the participant leaves will the agent continue, but it will run into an error because the AgentSession has been terminated.

I found the culprit PR: 6439f60

The agent keeps waiting for user silence but the event is never emitted. I don't know if it's because it's detected differently within the context of a tool call.

Expected Behavior

If the tool call has a session.say, the agent should be able to gracefully handle interruptions in a tool call without manually checking https://docs.livekit.io/agents/logic/tools/#interruptions.

Reproduction Steps

1. 
2.
3.
...
- Sample code snippet, or a GitHub Gist link -

Operating System

macOS

Models Used

No response

Package Versions

livekit-agents[cartesia,deepgram,openai,rime,silero,turn-detector]~=1.3 (1.3.10 at the time)

Session/Room/Call IDs

No response

Proposed Solution

Investigate why waiting for user silence locks out the agent from responding and why this happens specifically when trying to do self.session.say inside a tool call.

Additional Context

No response

Screenshots and Recordings

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions