Models API Reference¶
A multi-turn evaluation transcript.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
Unique identifier used as the pytest test name. |
required |
turns
|
list[Turn]
|
Ordered list of turns. |
required |
threshold
|
float
|
Fraction of runs that must pass (0.0-1.0). |
0.8
|
runs
|
int
|
Number of times to execute this transcript. |
1
|
tags
|
list[str]
|
Optional quality-gate tags (e.g. ["gate:booking"]). |
list()
|
Source code in src/pytest_agent_eval/models.py
A single turn in a transcript.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
str
|
The user message (also used as the transcript when |
required |
audio
|
_PathLike | None
|
Optional path to a WAV file for voice adapters. Resolved relative to the YAML file's directory when loaded from YAML. |
None
|
expect
|
Expect
|
Expectations for the agent's reply. |
Expect()
|
Source code in src/pytest_agent_eval/models.py
Expectations for a single transcript turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluators
|
list[Any]
|
Programmatic evaluators (Python API). |
list()
|
judge
|
JudgeConfig | None
|
YAML-defined judge config. |
None
|
tool_calls_include
|
list[str]
|
Tool names that must appear in tool_calls. |
list()
|
tool_calls_exclude
|
list[str]
|
Tool names that must NOT appear in tool_calls. |
list()
|
tool_calls_ordered
|
bool
|
If True, tool_calls_include must appear in the given order. |
False
|
tool_calls_args
|
list[ToolCallArgsConfig]
|
Assertions on the arguments of specific tool calls. |
list()
|
reply_contains_any
|
list[str]
|
Reply must contain at least one of these strings. |
list()
|
reply_contains_all
|
list[str]
|
Reply must contain all of these strings. |
list()
|
reply_matches_any
|
list[str]
|
Reply must match at least one of these regex patterns. |
list()
|
reply_matches_all
|
list[str]
|
Reply must match all of these regex patterns. |
list()
|
Source code in src/pytest_agent_eval/models.py
Bases: str
A tool-call name that optionally carries the arguments it was invoked with.
Subclasses str so name-based checks keep working unchanged: "book_slot"
in ctx.tool_calls, equality against plain strings, and hand-rolled agents
returning list[str] (the runner normalises those to ToolCall with
args=None).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
The tool name. |
required | |
args
|
The arguments the tool was called with, or None when the adapter could not capture them. |
required |
Example
Source code in src/pytest_agent_eval/models.py
One tool-argument assertion in a YAML transcript turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool
|
str
|
Name of the tool whose arguments to check. |
required |
args
|
dict[str, Any] | None
|
Expected arguments for the deterministic check, or None. |
None
|
mode
|
str
|
"subset" or "exact" (deterministic check only). |
'subset'
|
judge
|
JudgeConfig | None
|
Optional LLM-judge config for the arguments. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither args nor judge is provided. |
Source code in src/pytest_agent_eval/models.py
Context passed to every evaluator for a turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
str
|
The user message for this turn. |
required |
reply
|
str
|
The agent's reply. |
required |
tool_calls
|
list[ToolCall]
|
Tools called during the turn. Each entry is a ToolCall
(str-compatible); |
required |
history
|
list[dict[str, Any]]
|
Full conversation history in OpenAI message format, up to but not including the assistant reply for this turn. |
required |
Source code in src/pytest_agent_eval/models.py
Aggregated result across all runs of a transcript.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
passed
|
bool
|
True if score >= threshold. |
required |
score
|
float
|
Fraction of runs that passed (0.0-1.0). |
required |
threshold
|
float
|
Required pass fraction. |
required |
runs
|
list[RunResult]
|
Individual run results. |
required |