agents icon indicating copy to clipboard operation
agents copied to clipboard

SIP Agent Not Starting Fresh Call - Resuming Old State/ Stale LLM context?

Open zt9 opened this issue 10 months ago • 2 comments

After stopping SIP agent tests last night (~8 PM), I reconnected the agent today and dialed its number after 10 hours.

Instead of playing a greeting and starting a new call, the agent immediately responded as if continuing a previous conversation. It completely bypassed the initial greeting state.

Why would the agent resume like this after being inactive overnight, instead of starting fresh? Could there be leftover state in the agent, the LiveKit room, or the SIP connection itself?

Logs below (numbers changed). Looking for possible causes for this stale state behavior: https://gist.github.com/zt9/aac8ee7d7e9556a852b495346b6a8057

Would you be able to provide any internal logs for :

  1. Job ID: AJ_iNLAJJzcH7Gu
  2. worker ID: AW_BkTWrdB8sqMR
  3. Room: RM_9AsrnJqh29gs

For your reference:

https://cloud.livekit.io/projects/p_483jqb1ll5s/sessions/RM_9AsrnJqh29gs https://cloud.livekit.io/projects/p_483jqb1ll5s/telephony/SCL_qxSiaiN4bfno/inbound

{
project_id: "p_483jqb1ll5s"
room_id: "RM_9AsrnJqh29gs"
timestamp: "2025-04-13T11:27:19Z"
type: "Track published"
participant_id: "PA_SfQXSEEFU2Dk"
participant_identity: "agent-AJ_iNLAJJzcH7Gu"
node_id: "NM_OASHBURN1A_MicdRXsFf9Lq"
timestamp_us: 1744543639585698
}

This morning, I connected a new agent to an existing room (inadvertently - was was using agent playground but not SIP), and the same behavior occurred—the agent continued the previous conversation. Although it makes sense that a new agent joining an existing room would maintain context, I’m perplexed that a brand new SIP call, which should create a separate room, still carried over context from an older call.

I'm still interested in finding out what happened with the logs I posted and the call ids I posted

zt9 avatar Apr 15 '25 13:04 zt9

there is no state stored anywhere here.. the example session you linked to shows a fresh agent joining the room.

do you load any data from the DB anywhere?

davidzhao avatar Apr 18 '25 06:04 davidzhao

@davidzhao There is no DB at all what so ever (have not gotten there yet)

That is what makes it so strange.

If you are able to pull the transactions for chat completions, you will see what I am taking about . BTW this is the same code that I have deployed and this happened once where I was able to capture all the relevant information.

I am uncertain about what to do next - Any recommendations (looks like ignore this for now is on the top of the list, not liking that)?

zt9 avatar Apr 20 '25 15:04 zt9