Skip to content

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 if you don't have one.
  • You have Python 3.10+ installed.
  • You have API credentials from ReSim (a username and password — these are separate from your login credentials; contact info@resim.ai if you don't have them yet).

What you're building

The external-batches-example repo contains a minimal Python script that:

  1. Creates a batch in your ReSim project
  2. Runs two tests, each emitting a series of (x, y) position data points
  3. 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 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/external-batches-example.git
cd external-batches-example

Step 3: Install dependencies

Shell
pip install -r requirements.txt

Or, if you're using uv:

Shell
uv sync

This installs resim-sdk and python-dotenv.


Step 4: Configure credentials

Create a .env file in the project root:

.env
RESIM_USERNAME=<your-api-username>
RESIM_PASSWORD=<your-api-password>
RESIM_PROJECT_NAME=<your-project-name>

RESIM_USERNAME and RESIM_PASSWORD are your ReSim API credentials, not your personal login. If you don't have them, contact info@resim.ai.


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 = UsernamePasswordClient(username=username, password=password)

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 script will print something like:

Output
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/...

The script exits as soon as the data is uploaded. Metrics processing runs in ReSim and takes a couple of minutes.


Step 7: View results in the dashboard

Open the URL printed by the script, or navigate to your project in 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: