# Get Your First Metrics in ReSim

In this tutorial you'll get data into ReSim and see real metrics in the dashboard — without Docker, without a container registry, and without running anything in ReSim's infrastructure. You'll use the ReSim Python SDK to create a batch, emit structured data from two tests, and view the results.

**Time:** about 10 minutes

**Before you start:**

- You have a ReSim account. Sign up at [app.resim.ai](https://app.resim.ai) if you don't have one.
- You have Python 3.10+ installed.
- You can authenticate in a browser (the script will prompt you with a URL the first time).

______________________________________________________________________

## What you're building

The [resim-sdk-example](https://github.com/resim-ai/resim-sdk-example) repo contains a minimal Python script that:

1. Creates a batch in your ReSim project
1. Runs two tests, each emitting a series of `(x, y)` position data points
1. Uploads the data to ReSim and triggers metrics processing

You'll end up with a batch in the ReSim app showing a line chart of `y over time` per test, and a batch-level table of min/avg/max values across both tests.

______________________________________________________________________

## Step 1: Create a project

If you don't have a ReSim project yet, create one:

Go to [app.resim.ai/projects/create](https://app.resim.ai/projects/create) and create a project.

Shell

```
resim projects create --name "my-project" --description "My project"
```

Note the project name — you'll need it in Step 4.

______________________________________________________________________

## Step 2: Clone the example repo

Shell

```
git clone https://github.com/resim-ai/resim-sdk-example.git
cd resim-sdk-example
```

______________________________________________________________________

## Step 3: Install dependencies

Shell

```
pip install -r requirements.txt
```

Or, if you're using `uv`:

Shell

```
uv sync
```

This installs `resim-sdk`.

______________________________________________________________________

## Step 4: Set your project name

Open `main.py` and update `PROJECT_NAME` to match the project you created in Step 1:

main.py

```
PROJECT_NAME = "my-project"
```

______________________________________________________________________

## Step 5: Look at what you're running

Before running, take a look at the two files that matter:

**`main.py`** — creates the batch and emits test data:

main.py

```
client = DeviceCodeClient()

with Batch(
    client=client,
    project_name=project_name,
    branch="metrics-test-branch",
    metrics_set_name="my metrics",
    metrics_config_path="resim/config.resim.yml",
) as batch:

    with Test(client, batch, "test 1") as test:
        for i in range(10):
            test.emit("position", {"x": float(i), "y": float(i)}, i)

    with Test(client, batch, "test 2") as test:
        for i in range(10):
            test.emit("position", {"x": float(i), "y": float(i * 2)}, i)
```

**`resim/config.resim.yml`** — defines the data schema and metrics:

resim/config.resim.yml

```
version: 1

topics:
  position:
    schema:
      x: float
      y: float

metrics:
  y over time:
    type: test
    query_string: select 'y', timestamp, y from position order by timestamp
    template_type: system
    template: line

  min/avg/max:
    type: batch
    query_string: select min(y) as min, avg(y) as avg, max(y) as max from position
    template_type: system
    template: table

metrics sets:
  my metrics:
    metrics:
      - y over time
      - min/avg/max
```

The config defines one topic (`position` with `x` and `y` floats), two metrics (a per-test line chart and a batch-level table), and a metrics set that groups them.

______________________________________________________________________

## Step 6: Run it

Shell

```
python main.py
# or
uv run main.py
```

The first time you run it, you'll be prompted to authenticate in a browser:

Output

```
Authenticating by Device Code

Please navigate to: https://resim.us.auth0.com/activate?user_code=XXXX-XXXX

Created batch rejoicing-aquamarine-starfish with id dc71ebee-...
test 1 done
test 2 done
Batch done. After a few minutes, you can view your metrics here: https://app.resim.ai/projects/.../batches/...
```

Visit the URL, authenticate with your ReSim account, and the script will continue automatically. Subsequent runs reuse the cached token. The script exits as soon as the data is uploaded; metrics processing runs in ReSim and takes a couple of minutes.

Running in CI

For non-interactive environments (CI pipelines), replace `DeviceCodeClient` with `UsernamePasswordClient` and pass ReSim API credentials as secrets. Contact [info@resim.ai](mailto:info@resim.ai) if you need API credentials.

Python

```
from resim.sdk.auth.username_password_client import UsernamePasswordClient
client = UsernamePasswordClient(username="...", password="...")
```

______________________________________________________________________

## Step 7: View results in the dashboard

Open the URL printed by the script, or navigate to your project in [app.resim.ai](https://app.resim.ai) and find the batch.

For each test you'll see:

- **y over time** — a line chart of `y` values across the 10 data points

At the batch level:

- **min/avg/max** — a table comparing the minimum, average, and maximum `y` values across both tests

`test 2` has `y = i * 2` (steeper slope) so its values will be higher than `test 1` (`y = i`), which you'll see clearly in the batch table.

______________________________________________________________________

## What's next

You've now pushed data into ReSim and seen it as metrics — without any Docker or cloud infrastructure setup.

The natural next steps are:

- **[Adapt this to your own data](../../guides/resim-sdk/)** — swap out the `position` topic for your own data schema and write SQL metrics that match your system
- **[Run your first test batch](../first-batch/)** — when you're ready to run your system inside ReSim's infrastructure for full execution management
