I use Avatar Session (with all providers bey, siml...
# ask-ai
w
I use Avatar Session (with all providers bey, simli,...) then the agent only responds to the user the first time (first session). Then the user ends the call, a new user joins the room (or the user rejoins), the agent does not respond to the user anymore (checking the log, the agent is still listening to the user), the avatar is still displayed, still no error. When I do not start Avatar Session, when rejoining, the agent will respond to the user normally What can happen? I use the code agent-starter-python
t
Thanks for reaching out, son. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand the issue you're facing happens because the
agent-starter-python
is designed to handle just one session lifecycle per room. So, when a user leaves and then comes back, the agent doesn’t automatically restart or respond, even though it’s still listening. That can definitely be a bit confusing! To help you work through this, here are some steps you can try: • Dynamic Participant Handling: You can use
ctx.wait_for_participant()
along with room event listeners like
participant_connected
to detect when a user rejoins and then trigger a response from the agent. • Session State Tracking: It’s a good idea to keep track of session data—like chat history or agent settings—using a
SessionManager
pattern. This helps maintain continuity when users reconnect. • Restart Agent on Rejoin: When you detect a user has rejoined, manually restarting the agent session or generating a reply can make the experience smoother. • Frontend Coordination: Make sure your frontend lets the backend know when a user reconnects, so the agent can be reactivated appropriately. These tweaks should make your agent much better at handling users who leave and come back. If you’d like, I’m here to help you implement any of these—just let me know! Sources: Web and mobile frontends | LiveKit Docs | agent/main.py | Voice Assistants | livekit/livekit_composite | DeepWiki | templates.yaml | agent-examples/agent_examples/pipeline_agent.py
w
With code agent-starter-python, how to restart agent on rejoin?
t
Thanks for reaching out! Could you help me understand a bit more about what you mean by "rejoin" here? Are you talking about: • Joining a room again after leaving? • Getting reconnected to LiveKit after a disconnection? • Resuming the agent when a user disconnects and then reconnects? Also, are you hoping for an automatic restart when the rejoin happens, or would you prefer a manual restart process? I’m here to help you through this! Sources: cmd/lk/agent.go | Agent deployment CLI reference | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | Agent Deployment & Docker Configuration | livekit/livekit_composite | DeepW...
w
When user rejoin on reconnect pls continue session, when user as new connect, pls restart agent session for new user
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
a
When I use
AvatarSession
, the agent replies the first time I connect. But after disconnecting and reconnecting, the agent stops replying (take my voice print the text, avatar showing, but not responding) (I need to restart the agent). I’m using the OpenAI Realtime model with TTS fallback.
j
1
🙌 1
w
After using WorkerOptions the issue was resolved, thank you very much