adorable-bear-14321
02/23/2026, 1:29 PMtall-airline-16756
02/23/2026, 1:29 PMtall-airline-16756
02/23/2026, 1:29 PMAgentSession or whatever test harness you use with the relevant prompt (e.g., "Book an appointment for tomorrow").
1. Assert the next event is a function call.
◦ Use the test helper expect.next_event().is_function_call() to confirm the agent made a function/tool call and to check the function name and arguments.
◦ Example:
result = await sess.run(user_input="Book an appointment for tomorrow")
await result.expect.next_event().is_function_call(
name="book_appointment",
arguments={"date": "tomorrow"}
)
1. Verify the function call output.
◦ After confirming the call, verify the tool’s response using is_function_call_output() to ensure the tool returned the expected result.
◦ Example:
await result.expect.next_event().is_function_call_output(
output="Appointment confirmed for tomorrow"
)
1. Inspect the event sequence if you need more detail.
◦ The RunResult contains the ordered events (messages, function calls, outputs). Walk through these events if you need to confirm where and when the tool was invoked or to debug mismatches.
1. (Optional) Use qualitative judgment if you want behavior assessment.
◦ You can run .judge() on results to get a qualitative assessment of whether the agent’s actions matched intent after tool usage.
Notes and tips
• Make sure the LLM model/plugin you’re testing with supports the testing flow (e.g., compatible LLM plugin or RealtimeModel in text mode) for reliable results.
• If the assertion fails, inspect the event list to see what happened instead (e.g., a plain message from the agent rather than a function call or different arguments).
• If you have multiple possible implementations (e.g., sync vs async tool invocation), tell me which one you’re using and I’ll show the precise test snippet for that case.
If you'd like, share:
• The test harness you use (Python pytest, Vitest/Node, or something else)
• The function/tool name and expected arguments
I can then provide an exact test snippet tailored to your setup.
Sources: Using the Testing Framework with Realtime Models | LiveKit | Testing and evaluation | LiveKit Documentation