> ## Documentation Index
> Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Started

> Author a dataset, write a task and a scorer, and run your first eval

## 1. Install the SDK

> [tab] Python
>
> ```bash theme={null}
> pip install traceroot
> ```

> [tab] TypeScript
>
> ```bash theme={null}
> npm install @traceroot-ai/traceroot
> ```

## 2. Define a dataset

A `Dataset` holds your cases. Each case has an `input` and an optional `expected` answer.

Set `key` explicitly on any dataset you'll re-run — it's what identifies the dataset, so you can rename it later without starting a new history.

> [tab] Python
>
> ```python theme={null}
> from traceroot import Dataset, evaluate
>
> ds = Dataset("Capitals QA", key="capitals-qa")
> ds.add({"country": "France"}, expected="Paris")
> ds.add({"country": "Japan"}, expected="Tokyo")
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import { Dataset, evaluate } from "@traceroot-ai/traceroot";
>
> const ds = new Dataset("Capitals QA", null, { key: "capitals-qa" });
> ds.add({ country: "France" }, { expected: "Paris" });
> ds.add({ country: "Japan" }, { expected: "Tokyo" });
> ```

## 3. Write a task

The task is the system under evaluation. It maps an `input` to an `output`, and it may be async.

> [tab] Python
>
> ```python theme={null}
> CAPITALS = {"France": "Paris", "Japan": "Tokyo"}
>
> def task(input):
>     return CAPITALS.get(input["country"], "")
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> const CAPITALS: Record<string, string> = { France: "Paris", Japan: "Tokyo" };
>
> function task(input: unknown) {
>   return CAPITALS[(input as { country: string }).country] ?? "";
> }
> ```

## 4. Write a scorer

A scorer receives the case's `input`, `output`, `expected`, and `metadata`, and returns a value. The metric takes the function's name.

> [tab] Python
>
> ```python theme={null}
> def matches_expected(input, output, expected=None):
>     return output == expected
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import type { ScorerContext } from "@traceroot-ai/traceroot";
>
> function matchesExpected({ output, expected }: ScorerContext) {
>   return output === expected;
> }
> ```

## 5. Run it

`local=True` runs the eval in full and reports nowhere, so you can try it without an API key.

> [tab] Python
>
> ```python theme={null}
> result = evaluate(
>     name="capitals",
>     dataset=ds,
>     task=task,
>     scorers=[matches_expected],
>     candidate_version="capitals-v1",
>     local=True,
> )
> print(result.summary())
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> const result = await evaluate({
>   name: "capitals",
>   dataset: ds,
>   task,
>   scorers: [matchesExpected],
>   candidateVersion: "capitals-v1",
>   local: true,
> });
> console.log(result.summary());
> ```

Drop `local` and the run reports to traceroot, using the same credentials as the tracing SDK. Export them in your shell:

```bash theme={null}
export TRACEROOT_API_KEY="your-api-key"
export TRACEROOT_HOST_URL="https://app.traceroot.ai"  # self-hosted: your API's origin, e.g. http://localhost:8000
```

*(Prefer a `.env` file? Unless your runtime loads it for you, load it yourself — `load_dotenv()` in Python, `config()` from `dotenv` in TypeScript — as the [tracing quickstart](https://traceroot.ai/docs/tracing/get-started.md) shows.)*

`candidate_version` labels what you're testing in each run: a model id, a prompt version, or a git sha. Runs are grouped into one history by `evaluation_key`, which defaults to `name`.

![Evaluations list showing five runs of Support agent golden set with run name, dataset, cost, average cost and duration](https://mintcdn.com/tracerootai/TLv21OVXbJzkJk5L/images/evals_list_v1.png?fit=max\&auto=format\&n=TLv21OVXbJzkJk5L\&q=85\&s=53a53ccbb5c04d300e531da8a2f17e17)

Evaluations: evaluation name, run name, dataset, cost and duration

## Next steps

> [card] [Datasets](https://traceroot.ai/docs/evals/datasets.md)
>
> Author, version, and publish datasets.

> [card] [Scorers](https://traceroot.ai/docs/evals/scorers.md)
>
> Code scorers and LLM-as-a-judge.

> [card] [Running Evals](https://traceroot.ai/docs/evals/running-evals.md)
>
> Every option of `evaluate()`.

> [card] [Reading Results](https://traceroot.ai/docs/evals/reading-results.md)
>
> Per-metric summaries and per-case results.

## Run the example

Clone the repo and run a complete tool-agent eval end-to-end.

> [card] [Python](https://github.com/traceroot-ai/traceroot/tree/main/examples/python/agent-eval)
>
> Run the Python example

> [card] [TypeScript](https://github.com/traceroot-ai/traceroot/tree/main/examples/typescript/agent-eval)
>
> Run the TypeScript example


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.