Skip to main content
The Netra SDK exposes an evaluation client that lets you:
  • Manage datasets - Create datasets and add test items
  • Run test suites - Execute tasks against datasets with automatic tracing
  • Apply evaluators - Score outputs using built-in or custom evaluators
  • Fetch results - Retrieve detailed run results programmatically
This page shows how to use Netra.evaluation to manage datasets, run test suites, fetch results, and programmatically evaluate your AI applications.

Getting Started

The evaluation client is available on the main Netra entry point after initialization.

create_dataset

Create an empty dataset that can hold test items for evaluation runs.

Parameters

Response: CreateDatasetResponse


add_dataset_item

Add a single test item to an existing dataset.

Parameters

DatasetItem

Response: AddDatasetItemResponse


get_all_datasets

Fetch all datasets, optionally filtered by a specific tag.

Parameters

Response: GetAllDatasetsResponse

CreateDatasetResponse


get_dataset

Retrieve a dataset and all its items by ID.

Parameters

Response: GetDatasetItemsResponse

DatasetRecord


run_test_suite

Execute a test suite against a dataset, running your task function on each item and optionally applying evaluators.

Parameters

Response

Item Result

The task function receives the input field from each dataset item. Return the output that should be compared against expected_output by evaluators.

Local Evaluators

A local evaluator is a Python class that scores each item’s output in your own process. run_test_suite then sends the scores to Netra, and they appear in the test run next to the platform evaluator scores. Use local evaluators for checks you want to keep in code, such as exact matching, JSON parsing, or calls to your own scoring model. Subclass BaseEvaluator, implement evaluate, and create an instance with an EvaluatorConfig.
The SDK stores the config on the instance as self.config. evaluate can be a regular method or an async def method. The SDK awaits async evaluators automatically.

EvaluatorConfig

ScoreType

EvaluatorContext

The SDK passes an EvaluatorContext to evaluate for each item.

EvaluatorOutput

How local evaluators run

  • run_test_suite registers each evaluator’s config with the test run when it creates the run.
  • Evaluators run only on items whose task completed. Items whose task raised an exception are marked failed and are not evaluated.
  • For each item, the SDK waits up to 60 seconds for the item’s span to be ingested. It then runs the evaluators one after another, in list order. Different items are evaluated concurrently.
  • run_test_suite returns after every evaluator has finished.
Local evaluator failures are silent. If evaluate raises an exception, or returns an evaluator_name that doesn’t match config.name, the SDK drops that evaluator’s result for the item and continues the run. Check the test run in the Netra dashboard to confirm that each evaluator produced scores.
The evaluators parameter accepts evaluator instances only. The SDK ignores strings such as evaluator names or IDs. Evaluators configured in the Netra dashboard are attached to the dataset and run on the platform, so you don’t pass them to run_test_suite.

get_run_results

Fetch detailed results for a completed test run by its run ID. Use this after run_test_suite to retrieve evaluation scores, item-level outcomes, and other run metadata from the backend.

Parameters

Response

Returns the JSON response from the backend containing the full run results, including evaluation scores and item-level details. Returns None if the run_id is empty or the request fails. The top-level response wraps the run data:

RunResult

TestRunSummary

Pair get_run_results with run_test_suite to programmatically inspect evaluation outcomes. The run_id is available in the runId field of the run_test_suite response. Use redirectUrl from the response to jump directly to the run in the Netra dashboard.

When to Use Which API

Dataset Management

create_dataset / add_dataset_item / get_all_datasets / get_datasetBuild and manage test datasets programmatically. Use for CI/CD pipelines or when generating test cases from production data.

Test Execution

run_test_suiteExecute your AI task against a dataset with automatic tracing and evaluation. Use for regression testing and model comparisons.

Results Retrieval

get_run_resultsFetch detailed results for a completed run, including evaluation scores and item-level outcomes. Use for post-run analysis and CI/CD assertions.

Advanced Workflows

create_runCreate runs without immediate execution. Use when you need custom orchestration or want to manage run lifecycle separately.

Local Evaluators

BaseEvaluator / EvaluatorConfigPass local evaluator instances to run_test_suite to score outputs in code. Configure platform evaluators in the Netra dashboard.

Complete Example

Next Steps

Last modified on September 28, 2026