Skip to main content

Benchmarks

Benchmarks

toothfairyai@latest…

Manager for benchmarks operations.

This manager provides methods to create, update, and manage benchmarks, as well as run benchmarks and track run status.

Example:

>>> client = ToothFairyClient(api_key="...", workspace_id="...")
>>> benchmark = client.benchmarks.create(...)
>>> run = client.benchmarks.run(benchmark_id="...", agent_id="...")
>>> run = client.benchmarks.wait_for_run(run.id)
>>> print(run.score)

Accessed via client.benchmarks.

Methods

MethodHTTPEndpoint
createPOSTPOST /benchmark/create
updatePOSTPOST /benchmark/update
deleteDELETEDELETE /benchmark/delete/{benchmark_id}
getGETGET /benchmark/get/{benchmark_id}
listGETGET /benchmark/list
searchderived
runPOSTPOST /benchmark/run
get_runGETGET /benchmark/run/{run_id}
list_runsGETGET /benchmark/runs
cancel_runDELETEDELETE /benchmark/run/{run_id}
wait_for_runderived

create

Create a new benchmark.

def create(
name: str,
description: Optional[str] = None,
questions: Optional[List[Dict[str, str]]] = None,
files: Optional[List[str]] = None
) -> Benchmark

Endpoint: POST /benchmark/create · API service

Request fields

FieldTypeRequiredDescription
idstringnoUnique identifier
workspaceidstringyesUnique workspace identifier (UUID v4)
namestringyesName of the resource
descriptionstringnoDetailed description of purpose and capabilities
questionsstringnoJSON-encoded list of benchmark questions
filesstringnoList of file keys associated with the benchmark
metadatastringnoArbitrary metadata key-value pairs (JSON)
createdBystringnoID of the user who created this resource
updatedBystringnoID of the user who last updated this resource
createdAtstringnoTimestamp when this resource was created
creationTimestringnoUnix timestamp when the resource was created
updatedAtstringnoTimestamp when this resource was last updated

The Python SDK accepts snake_case keyword arguments and converts them to the camelCase wire fields shown above.

Response fields

FieldTypeDescription
idstringUnique identifier for the benchmark
namestringName of the resource
descriptionstringBenchmark description
questionsarray<object>List of benchmark questions
workspaceIDstringUnique workspace identifier (UUID v4)
createdAtstringTimestamp when this resource was created
creationTimeintegerUnix timestamp when the resource was created
updatedAtstringTimestamp when this resource was last updated
metadataobjectArbitrary metadata key-value pairs (JSON)
filesarray<string>Associated file paths

Example

client.benchmarks.create(name="…")

update

Update a benchmark.

def update(benchmark_id: str) -> Benchmark

Endpoint: POST /benchmark/update · API service

Request fields

FieldTypeRequiredDescription
idstringyesUnique identifier
workspaceidstringnoUnique workspace identifier (UUID v4)
namestringnoName of the resource
descriptionstringnoDetailed description of purpose and capabilities
questionsstringnoJSON-encoded list of benchmark questions
filesstringnoList of file keys associated with the benchmark
metadatastringnoArbitrary metadata key-value pairs (JSON)
createdBystringnoID of the user who created this resource
updatedBystringnoID of the user who last updated this resource
createdAtstringnoTimestamp when this resource was created
creationTimestringnoUnix timestamp when the resource was created
updatedAtstringnoTimestamp when this resource was last updated

The Python SDK accepts snake_case keyword arguments and converts them to the camelCase wire fields shown above.

Response

Returns the Benchmark object — fields documented in the create section above.

Example

client.benchmarks.update(benchmark_id="agent-id")

delete

Delete a benchmark.

def delete(benchmark_id: str) -> Dict[str, bool]

Endpoint: DELETE /benchmark/delete/{benchmark_id} · API service

Example

client.benchmarks.delete(benchmark_id="agent-id")

get

Get a benchmark by ID.

def get(benchmark_id: str) -> Benchmark

Endpoint: GET /benchmark/get/{benchmark_id} · API service

Response

Returns the Benchmark object — fields documented in the create section above.

Example

client.benchmarks.get(benchmark_id="agent-id")

list

List all benchmarks.

def list(
limit: Optional[int] = None,
offset: Optional[int] = None
) -> ListResponse

Endpoint: GET /benchmark/list · API service

Example

client.benchmarks.list()

Search benchmarks by name.

def search(search_term: str) -> List[Benchmark]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.benchmarks.search(search_term="…")

run

Start a benchmark run.

def run(
benchmark_id: str,
agent_id: str,
type: str = 'bm',
mode: Optional[str] = None,
reviewer_agent_id: Optional[str] = None,
weights: Optional[Dict[str, float]] = None,
passing_score: Optional[float] = None,
num_questions: Optional[int] = None,
name: Optional[str] = None,
userid: Optional[str] = None
) -> BenchmarkRun

Endpoint: POST /benchmark/run · API service

Request fields

FieldTypeRequiredDescription
benchmark_idstringyesID of the benchmark to run
agent_idstringyesID of the agent to test
typestringnoRun type: 'bm' (standard evaluation) or 'abm' (consistency check)

Allowed: bm, abm | | mode | string | no | ABM mode - only for type='abm': 'static' (scripted questions) or 'dynamic' (AI-generated probing)

Allowed: static, dynamic | | reviewer_agent_id | string | no | ID of the reviewer agent (default: 'sorcerer') | | weights | object | no | Category weights for scoring, e.g. {"correctness": 0.5, "reasoning": 0.3, "context_usage": 0.2} | | passing_score | number | no | Minimum score to pass (0-1). Default: 0.9 | | num_questions | integer | no | Number of questions to use. Default: all questions in the benchmark | | name | string | no | Optional name for the run | | userid | string | no | Optional user ID for the run |

The Python SDK accepts snake_case keyword arguments and converts them to the camelCase wire fields shown above.

Response fields

FieldTypeDescription
idstringUnique identifier for the benchmark run
namestringName of the benchmark run
statusstringCurrent status of the run

Allowed: dispatched, inProgress, completed, inError, cancelled, cancellationRequested | | type | string | Run type: 'bm' (standard evaluation) or 'abm' (consistency check)

Allowed: bm, abm | | benchmark_id | string | ID of the benchmark that was run | | agent_id | string | ID of the agent that was tested | | reviewer_agent_id | string | ID of the reviewer agent used for scoring | | duration | number | Run duration in seconds | | score | number | Overall score (0-1 for BM: average_overall_score, 0-1 for ABM: average_consistency_score) | | batch_meta | object | Parsed batch metadata from a benchmark run | | created_at | string | ISO 8601 timestamp when the run was created | | updated_at | string | ISO 8601 timestamp when the run was last updated |

Example

client.benchmarks.run(benchmark_id="agent-id", agent_id="agent-id")

get_run

Get a benchmark run by ID.

def get_run(run_id: str) -> BenchmarkRun

Endpoint: GET /benchmark/run/{run_id} · API service

Response

Returns the BenchmarkRun object — fields documented in the run section above.

Example

client.benchmarks.get_run(run_id="agent-id")

list_runs

List benchmark runs for the workspace.

def list_runs(
agent_id: Optional[str] = None,
benchmark_id: Optional[str] = None,
type: Optional[str] = None,
status: Optional[str] = None,
limit: Optional[int] = None
) -> ListResponse

Endpoint: GET /benchmark/runs · API service

Example

client.benchmarks.list_runs()

cancel_run

Cancel a benchmark run.

def cancel_run(run_id: str) -> Dict[str, bool]

Endpoint: DELETE /benchmark/run/{run_id}

Field-level schema not available in the API spec for this endpoint.

Example

client.benchmarks.cancel_run(run_id="agent-id")

wait_for_run

Wait for a benchmark run to complete.

def wait_for_run(
run_id: str,
poll_interval: float = 10.0,
timeout: float = 1800.0
) -> BenchmarkRun

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.benchmarks.wait_for_run(run_id="agent-id")