broad-painter-9222
11/16/2025, 5:22 PMtall-airline-16756
11/16/2025, 5:22 PMtall-airline-16756
11/16/2025, 5:23 PMpytest with async support to simulate agent sessions and user inputs. This way, you can check that your workflows produce the right outputs and handle any exceptions smoothly.
• Run Locally: Start by installing the necessary dependencies with pip install -r requirements.txt or uv sync. Then, you can run your tests easily using python -m pytest -sv ./tests.
• CI Integration: Don’t forget to include your tests in the GitHub Actions pipeline. This ensures your unit tests run automatically, your workflows are evaluated, and your code quality stays top-notch.
If you’d like, I’m here to provide specific examples or walk you through any part of this. Just let me know!
Sources: Agent Testing & CI/CD | livekit/livekit_composite | DeepWiki | tests/test_workflows.py | sample-livestream/src/test/java/io/livekit/android/sample/livestream/Exampl... | .circleci/config.ymlbroad-painter-9222
11/16/2025, 5:24 PMtall-airline-16756
11/16/2025, 5:24 PMAgentTask workflow like CollectConsent, here’s a friendly guide to help you through the process:
• Set Up: Start by using AgentSession with a compatible LLM, such as OpenAI GPT models.
• Simulate Task: Kick off the task by running await sess.start(CollectConsent()).
• Provide Input: You can simulate user responses easily with await sess.run(user_input="Yes, you can record").
• Assert Results: Finally, check the task’s output with assertions like assert result.final_output is True if consent was given, or assert result.final_output is False if it was denied.
Here’s a simple example to illustrate:
import pytest
from livekit.agents import AgentSession
from livekit.plugins import openai
@pytest.mark.asyncio
async def test_collect_consent():
async with openai.LLM(model="gpt-4o") as llm, AgentSession(llm=llm) as sess:
await sess.start(CollectConsent())
result = await sess.run(user_input="Yes, I agree to be recorded")
assert result.final_output is True
# Test denial case
await sess.start(CollectConsent())
result = await sess.run(user_input="No, I do not want to be recorded")
assert result.final_output is False
If you have any questions or want to explore specific scenarios, please don’t hesitate to reach out—I’m here to help!
Sources: Workflows | LiveKit docs | examples/frontdesk/test_agent.pybroad-painter-9222
11/16/2025, 7:05 PMtall-airline-16756
11/16/2025, 7:05 PMbroad-painter-9222
11/16/2025, 7:06 PM