Support multiple participants in a single AgentSession with a shared chat context
Feature Request: Support multiple participants in a single AgentSession
Problem
The current SDK assumes a single active participant per AgentSession. While the existing workarounds are sufficient for transcription, they don't support a single-session, multi-participant conversation with a shared chat context.
Use case
We're building AI-conducted interviews with human takeover.
- An AI agent interviews a candidate in a 1:1 conversation.
- A human interviewer joins the room and takes over questioning.
- The agent switches to a silent "observer" modeβit stops speaking but continues listening.
- While silent, it must continue hearing both the interviewer and the candidate, appending both to the same chat context.
- When the interviewer leaves or hands control back, the agent resumes the interview with the complete conversation history.
The requirement is therefore:
N participants β 1 AgentSession β 1 shared chat context β 1 LLM/TTS, with the agent's speaking ability toggleable independently of its listening.
Why the current approaches don't work
-
RoomIO.set_participant()/toggle_io.py- Only one participant can be attached at a time.
- Participants that are not currently attached are not included in the conversation history, resulting in a one-sided context.
-
Multiple
AgentSessions- This creates one session per participant, which also means one chat context per participant.
- Our use case requires a single shared context and a single LLM/TTS pipeline.
SDK limitation (agents 1.6.7)
From our investigation, the current implementation appears to make two single-participant assumptions:
_participant_available_futlatches onto the first participant (room_io.py:378-396)._ParticipantInputStreammaintains a single_stream/_publication(_input.py:202-204), so a second participant's track replaces the existing one instead of being added alongside it.
Expected behavior
It should be possible for a single AgentSession to receive audio from multiple participants while maintaining a single conversation context. Each completed user turn should also include the speaker identity so the application can attribute transcripts correctly while preserving one shared chat history.
This would enable use cases such as:
- AI interviews with human takeover
- Meeting copilots
- Customer support escalations
- Collaborative conversations where the agent needs to listen to multiple participants while speaking selectively
@longcw I've opened #6855 implementing this via participant audio mixing (AudioInputOptions.mix_participants=True), can you pls review it
@longcw pls suggest if you have any other approach https://github.com/livekit/agents/pull/6855 has one limitation: it publishes the transcript on behalf of the linked participant
thanks for the pr, but I think the composition point should be an AudioInput instead of mixing in RoomIO.
audio_input: AudioInput
ββ 1 participant β _ParticipantAudioInputStream (unchanged)
ββ N β _MultiParticipantAudioInput
ββ _ParticipantAudioInputStream(A) β unchanged
ββ _ParticipantAudioInputStream(B)
ββ strategy: mix | pick
RoomIO keeps the participant lifecycle it already owns (_on_participant_connected/_disconnected plus the kind and ATTRIBUTE_PUBLISH_ON_BEHALF filtering) and just calls add(participant)/remove(identity).
@longcw can u pls check this https://github.com/livekit/agents/pull/6884 PR, pls suggest if any changes needed
@Darshak03 before moving forward, I'd like to understand why you don't want to run STT separately and feed the transcripts from multiple participants to the AgentSession. Mixing the audio lost the participant info per stream, and you may need STT diarization in that case.
Thanks for the report! This looks like the same root cause as #391, so I'm closing it as a duplicate to keep the discussion in one place. Please follow #391 for updates, and if your case differs (different provider, version, or repro), add the details there and we'll reopen if needed.