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
This page shows how to use netra.evaluation to manage datasets, run test suites, and programmatically evaluate your AI applications.

Getting Started

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

createDataset

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

Parameters

Response: CreateDatasetResponse


addDatasetItem

Add a single test item to an existing dataset.

Parameters

DatasetEntry

Response: AddDatasetItemResponse


getDataset

Retrieve a dataset and all its items by ID.

Parameters

Response: GetDatasetItemsResponse

DatasetRecord


runTestSuite

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 expectedOutput by evaluators.

Local Evaluators

A local evaluator is an object that scores each item’s output in your own process. runTestSuite 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. A local evaluator is any object with a config property and an evaluate method.
The package doesn’t export these evaluator types or the ScoreType enum. Define the interfaces in your own code, as shown in the Signature tab, or use object literals. Pass scoreType as a string.
evaluate can return the output directly or return a Promise. The SDK awaits promises automatically.

EvaluatorConfig

Score Types

EvaluatorContext

The SDK passes this context to evaluate for each item.

EvaluatorOutput

How local evaluators run

  • runTestSuite 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 threw an error 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 array order. Different items are evaluated concurrently.
  • runTestSuite resolves after every evaluator has finished.
Local evaluator failures are silent. If evaluate throws, or returns an evaluatorName 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 objects 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 runTestSuite.

When to Use Which API

Dataset Management

createDataset / addDatasetItem / getDatasetBuild and manage test datasets programmatically. Use for CI/CD pipelines or when generating test cases from production data.

Test Execution

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

Advanced Workflows

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

Local Evaluators

config + evaluatePass local evaluator objects to runTestSuite to score outputs in code. Configure platform evaluators in the Netra dashboard.

Complete Example

Next Steps

Last modified on September 28, 2026