Skip to main content
The vision_agents.testing module provides a lightweight testing layer for verifying agent behavior — tool calls, arguments, responses, and intent — without spinning up audio/video infrastructure.
This framework uses familiar pytest patterns. No custom test runner required.

Installation

The testing module is included with Vision Agents:
Configure pytest for async support in pytest.ini:

Core concepts

Basic usage

Testing a greeting

Testing tool calls

TestResponse assertions

TestResponse provides built-in assertion methods:

assert_function_called

Verifies a tool was called with expected arguments (partial match):

assert_function_output

Verifies tool output:

Accessing events directly

Mocking LLM functions

mock_functions

Use TestSession.mock_functions to wrap functions into AsyncMock for call tracking with standard unittest.mock assertions:

LLM-as-judge

LLMJudge uses a separate LLM instance to evaluate whether agent responses match target intents:
Use a separate LLM instance for the judge to avoid polluting the agent’s conversation history.

Event types

The framework captures three event types during a conversation turn:

Complete example

Run tests:

API reference

TestSession

Methods:
  • simple_response(text: str) -> TestResponse — Send user text and capture response
  • mock_functions(mocks: dict) -> ContextManager[dict[str, AsyncMock]] — Mock tools with call tracking

TestResponse

LLMJudge

Methods:
  • evaluate(event: ChatMessageEvent, intent: str) -> JudgeVerdict — Evaluate response against intent

JudgeVerdict

Next steps

MCP and function calling

Register tools for your agent

Simple agent example

Build a basic agent with tools