DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to write tests for your agent's behavior with Agents

Use AgentSession in pytest to check that the agent calls the right tool for a user message.

Short answer: Install pytest and your agent's dependencies; then write an async test that starts AgentSession with your agent, as in the README; send a user_input with sess.run and assert the expected function call. All steps.

Who it is forA team shipping a voice agent that must behave predictably.

The problemVoice Agents change behavior silently when prompts or models change.

The outcomePytest tests that fail when the agent stops calling the expected tool.

What you need first

  • Python with pip
  • A LiveKit server or LiveKit Cloud project
  • API keys for the model providers you choose

Steps

  1. Install pytest and your agent's dependencies
  2. Write an async test that starts AgentSession with your agent, as in the README
  3. Send a user_input with sess.run and assert the expected function call
  4. Run the suite with uv run pytest --unit in the repo, or pytest in your project

Prompt for your agent

Using livekit/agents, write a pytest test like the README's test_no_availability that checks my agent calls <my tool> when the user says <phrase>, and run it.

Caveat. Tests that use a real LLM call the provider and can be slow or flaky.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for livekit/agents and "Write tests for your agent's behavior"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer