I need to automate conversations to perform tests....
# ask-ai
s
I need to automate conversations to perform tests. Can I add a second agent to the room to play the "user" role? How would that be implemented?
t
Thanks for reaching out, Roman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! You can totally add a second agent to a LiveKit room to simulate a user for automated testing. Let me walk you through how to do it: 1. Run Both Agents: First, start up the agent you want to test and the evaluation agent using the command line:
Copy code
python agent_to_test.py start
python agent_evals.py start
2. Dispatch Both Agents to the Same Room: Next, use the LiveKit CLI to send both agents into the same room:
Copy code
lk dispatch create \
  --agent-name agent_to_test \
  --room my-room \
  --metadata 'my_job_metadata'

lk dispatch create \
  --agent-name agent_evaluator \
  --room my-room \
  --metadata 'my_job_metadata'
3. Configure the Evaluation Agent: Then, tweak the
RoomInputOptions
so the agents can interact with each other:
Copy code
await session.start(
    agent=EvaluationAgent(),
    room=ctx.room,
    room_input_options=RoomInputOptions(
        participant_kinds=[
            rtc.ParticipantKind.PARTICIPANT_KIND_AGENT,
        ]
    ),
)
If you prefer, you can also use a participant filter that accepts everyone:
Copy code
room_io = RoomIO(
    session,
    room=room,
    input_options=RoomInputOptions(
        participant_filter=lambda p: True  # Accept all participants including agents
    )
)
Optional: For an even easier setup, try the
agent-load-test
tool to spin up an echo participant that copies user responses:
Copy code
lk perf agent-load-test \
  --rooms 5 \
  --agent-name test-agent \
  --echo-speech-delay 10s \
  --duration 5m
This method helps you automate and scale your testing smoothly. If you hit any bumps or want to chat more about it, just let me know—I’m here to help! Sources: README.md | Agent Testing & Evaluation | livekit/livekit_composite | DeepWiki | evaluating-agents/README.md | How to test your agent using another agent | Speech & Audio Processing | livekit/livekit_composite | DeepWiki
s
I don't want to run it through the terminal. It needs to be some setting in the frontend that can toggle between manual and automatic answers
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!