---
title: Sessions
description: What a session is, how it groups the data of one flight, drive, or robot run across files and datasets, and how to create and manage one.
sidebar:
  order: 18
---
## Overview

A **session** is one operational time window of a device, such as a drone flight, a vehicle drive, or a robot run. It groups the data recorded during that window, so you can find, read, and analyze an activity recorded across multiple files or datasets as a single run.

Recordings may not always line up neatly with activities: one run can produce a log, a ROS bag, and a video, uploaded to different datasets at different times. One file can also record more than one activity, such as a day of driving or every episode of a robot-learning dataset. A dataset records where files are stored and how they were uploaded; a session records what happened and when.

When you read a session's topic data, you get only the data the session holds, not the rest of each file. Code that analyzes one robot run can take the session's ID and read exactly that run's data, even when the data is split across files and datasets.

## What a session holds

A session is built from files, and each file can come from any dataset in your organization. For each file, the session holds one of the following:

- **The whole file.** All of the file's data.
- **A time window of the file.** Only the data whose timestamps fall between a start time and an end time, measured in the file's own timestamps. A time window is useful when the file's timestamps continue through several activities. For example, if a log records three robot runs after power-on and the second took place from 40 to 75 minutes after power-on, a session for that run holds the log's data from 40 to 75 minutes.
- **A range of the file.** Only a block of the file's rows, chosen by their position in the file, whatever their timestamps. A range is useful when timestamps can't tell the activities apart. For example, a robot-learning dataset can store 50 episodes one after another in one file, each 6,000 rows recorded over 30 seconds, with timestamps that start again at 0 for every episode. Every episode then covers the same 30 seconds, so no time window picks out one of them, but a session for the third episode can hold the 6,000 rows that start at row 12,000. A range holds a topic's data only when that data was declared over a range that falls inside the session's range, so when you add the file with the SDK, declare its topics range by range, such as one range per episode.

Several sessions can hold parts of the same file, each with its own time window or range. The sessions share the file's data; Roboto doesn't copy it.

A session's start and end times span all of the data it holds. Roboto recomputes them whenever you add or remove a file, change a file's time window or range, or change the [anchor](#wall-clock-time) of the session's data, so you never set them by hand.

## Devices

A session can have no device attached, one device, or several:

- **No device.** The session groups data that no registered device recorded, such as an activity on a test bench.
- **One device.** The session is one activity of one robot.
- **Several devices.** The session is one activity that several robots took part in, such as a formation flight, so you can analyze all of their data on one timeline.

Roboto infers a session's devices from its files. When a file in the session, or the dataset that holds the file, comes from a device, Roboto attaches that device to the session. An **inferred device** follows the session's files: when the session no longer holds a file from that device, Roboto detaches the device. Before you create a session in the web app, the **Create session** page lists the inferred devices of the files you choose.

You can also attach and detach devices yourself. A device you attach stays attached whatever files the session holds. If you detach a device that the session's files still come from, Roboto attaches it again the next time the session's files, or their devices, change.

A device's **Sessions** tab lists the sessions attached to it, so you can browse a robot's history one activity at a time. Search can also find a device's sessions.

## Properties

Every session has a unique identifier with the `se_` prefix, and the following properties:

- **Name and description.** An optional name of up to 120 characters, and an optional description.
- **Start time, end time, and duration.** Computed from the data the session holds.
- **Devices.** The devices attached to the session.
- **Tags, metadata, and custom fields.** Search can filter sessions by tag and by [custom field](/docs/learn/concepts#custom-fields-section), but not by metadata, so store an attribute that you want to search by in a custom field.
- **Metrics.** Named numeric values published for the session, such as the top speed of a robot run. A session's **Metrics** tab shows them, and search can find sessions by metric.

You can also add sessions to a [collection](/docs/learn/collections), and pass them as input to [actions](/docs/learn/actions).

## Creating sessions

In the web app, you can create a session from three places:

- **The Sessions page.** In the navigation menu, click **Sessions**, and then click **New session**. You choose the files that the session holds.
- **A dataset's Sessions tab.** Click **New session** to create a session that starts with every file of the dataset. You can remove files before you create it.
- **A dataset's Files tab.** Select files or folders, and then create a session from them, or add them to an existing session.

In the web app, a session holds the whole of each file you add. To hold a time window or a range of a file, use the SDK.

With the SDK, choose the method that fits how your data arrives:

- `Session.create` creates a session with any number of devices attached.
- `Device.create_session` creates a named session on one device, optionally with its files. The name identifies the session within the device, so an upload script that sends the same call twice gets the same session. `Device.create_sessions` creates many such sessions in one call, such as one for each episode of a robot-learning dataset.
- `Dataset.create_session` creates a session that holds a dataset's files.
- `Session.create_if_not_exists` returns the session that matches a [RoboQL](/docs/roboql/overview) query, and creates one when none matches. A process that handles one file at a time, such as a handler of upload notifications, can call it to put each file in the session the file belongs to. The query must match the session that the call creates, for example a query on the name that you set with the `name` argument; otherwise every later call creates another session.

## Managing sessions

### Adding and removing files

You can add files to a session at any time: from a dataset's **Files** tab in the web app, or with `Session.add_file` and `Session.add_files` in the SDK. To remove a file from a session, use `Session.remove_file` or `Session.remove_files`. Removing a file from a session doesn't delete the file. Adding or removing files also updates the devices that Roboto infers from them.

### Changing a file's bounds

To change the time window or range that a session holds of a file, add the file to the session again with the new bounds. The new bounds replace the old ones, and Roboto recomputes the session's start and end times.

### Wall-clock time

Many robots record timestamps that start at 0 when the robot powers on, instead of wall-clock time. Until the data is anchored, Roboto reads those timestamps as nanoseconds since the Unix epoch, so a session recorded from power-on appears to start on January 1, 1970.

An **anchor** is the wall-clock time at which time 0 of the data occurred. You can set an anchor when you add a file to a session, or later for all of the session's data with `Session.set_unix_offset`. When several sessions each hold a different range of a file, `set_unix_offset` anchors only the range of the session you call it on. Sessions that hold time windows of the same data share that data's anchor, so anchoring one session moves the others too.

For every method and argument, see the [sessions SDK reference](/docs/reference/python-sdk/roboto/experimental/sessions).
