red-dentist-96118
11/21/2025, 1:03 AMtall-airline-16756
11/21/2025, 1:03 AMtall-airline-16756
11/21/2025, 1:04 AMmock_tools), and/or run tests in text-only mode so the agent receives text input instead of audio.
• To verify TTS output, assert on the structured text generated by the LLM/tts nodes rather than on audio bytes.
How to mock (concise examples)
1. Mock downstream tools that depend on STT:
from livekit.agents import mock_tools
with mock_tools(Assistant, {"process_transcript": lambda text: "parsed intent"}):
result = await session.run(user_input="...") # use text input representing STT transcription
await result.expect.next_event(type="message").judge(llm, intent="parsed intent")
1. Use text-only testing to bypass STT:
• Feed the agent the transcript string directly as user_input so STT isn't involved.
1. Verify TTS behavior by inspecting LLM/tts node outputs:
• Assert the generated speech text or speech directives from the pipeline (structured output), not the audio file.
When you might need E2E audio
• For full audio pipeline tests (actual STT/TTS engines), use third-party audio providers or run integration tests against real STT/TTS services.
If you want, tell me:
• Whether you need example test code for a specific tool or node setup, or
• If you want an example that asserts structured TTS output vs. audio files. Sources: Testing and evaluation | LiveKit Docs | Tool definition and use | LiveKit docs