fierce-zoo-69908
08/19/2025, 10:07 AMtall-airline-16756
08/19/2025, 10:07 AMtall-airline-16756
08/19/2025, 10:08 AMroomServiceClient.getParticipant
, you'll need to pass in the participant's identity as a parameter. This method doesn’t give you the identity back—it expects you to provide it. Think of the identity as a unique string you, the developer, assign to each participant in the room.
If you’re working with agents, you can set a fixed participant identity. For example, when setting up agent audio processing, you might do something like this:
room_io = RoomIO(session, room=ctx.room, participant="participant-identity")
But if you don’t know the agent identities ahead of time, no worries! You can use listParticipants
to get all participants in the room and then filter for agents by checking the participant’s kind
field for the AGENT
type.
Feel free to reach out if you want me to walk you through this or if you have any other questions!fierce-zoo-69908
08/19/2025, 10:09 AMtall-airline-16756
08/19/2025, 10:09 AMagent_name
parameter in WorkerOptions
to give your agent a fixed name. This is especially handy for telephony integrations and helps avoid any unexpected automatic dispatch:
agents.cli.run_app(agents.WorkerOptions(
entrypoint_fnc=entrypoint,
agent_name="my-telephony-agent"
))
2. Setting Fixed Participant for Audio Processing: Another option is to specify a fixed participant identity when creating RoomIO
for audio processing:
room_io = RoomIO(session, room=ctx.room, participant="participant-identity")
await room_io.start()
3. Agent Dispatch with Room Configuration: You can also configure agent dispatch via access tokens by setting the room configuration with agent definitions like this:
at.roomConfig = new RoomConfiguration({
agents: [
new RoomAgentDispatch({
agentName: agentName,
metadata: '{"mydata": "myvalue"}',
}),
],
});
4. Fixed Participant ID in Agent Logic: Lastly, you might want to define a fixed participant ID constant in your agent logic to keep things consistent throughout your implementation:
FIXED_PARTICIPANT_ID = "your-fixed-participant-id"
session = AgentSession[NutritionUserData](
userdata=NutritionUserData(participant_identity=FIXED_PARTICIPANT_ID, ctx=ctx),
)
If you'd like me to walk you through any of these or if you have any questions, just let me know—I'm here to help!
Sources: How to set a fixed participant for agent audio processing | examples/agent-dispatch/index.ts | complex-agents/nutrition-assistant/agent.py