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

# Tutorial

Learn contree-cli by building a real workflow – from zero to automated
scripting in nine short sections.

## What you’ll build

By the end of this tutorial you will:

* Spin up sandboxes from images and run arbitrary commands
* Track sandbox state through sessions with branching and rollback
* Inject local files, edit remote configs, and tag working images
* Script everything with JSON output, detached runs, and operation monitoring

## Before you start

You need two things:

* **Python 3.10+** installed on your machine
* **A ConTree API token** — get one from your [project dashboard](https://contree.dev)

## The path

> [card] [1. Install & Authenticate](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/installation.md)
>
> Install contree-cli, save your API token, and set up named profiles for
> different environments.

> [card] [2. Your First Sandbox](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/first-steps.md)
>
> Browse images, run commands, inspect the filesystem, and download files.
> Understand how each run creates a new checkpoint.

> [card] [3. Interactive Shell](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/shell.md)
>
> Use the REPL for rapid iteration: tab completion for paths, images, and
> branches, command aliases, and persistent history.

> [card] [4. Sessions & Branches](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/sessions.md)
>
> Branch off to experiment, roll back mistakes, share sessions across
> terminals, and start fresh when needed.

> [card] [5. Working with Files](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/files.md)
>
> Inject local code into sandboxes, edit remote files in-place, and stage
> changes that auto-attach on the next run.

> [card] [6. Images & Tags](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/images.md)
>
> Tag working images for reuse, import from registries, and search by
> prefix. Build reusable base environments.

> [card] [7. Building from a Dockerfile](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/build.md)
>
> Turn a `Dockerfile` into a tagged ConTree image. Layer caching,
> build args, `.dockerignore`, and URL streaming for `ADD`.

> [card] [8. Scripting & Automation](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/workflows.md)
>
> Shell mode, shebang scripts, detached runs, operation monitoring, and
> machine-readable output formats for pipelines.

> [card] [9. Configuration & Profiles](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/configuration.md)
>
> Create and switch between profiles for different projects, understand
> how profiles affect sessions, and configure environment variables.

## Quick taste

If you just want to see contree-cli in action before diving in:

> [tab] CLI
>
> ```bash theme={null}
> # install
> git clone https://github.com/nebius/contree-cli.git
> cd contree-cli && uv sync
>
> # authenticate (token prompted securely)
> contree auth
>
> # start a session and run a command
> eval $(contree use tag:ubuntu:latest)
> contree run uname -a
>
> # inspect the result
> contree ls /
> contree cat /etc/os-release
> ```

> [tab] Shell
>
> ```bash theme={null}
> # install and authenticate first (see CLI tab)
> contree auth
>
> # start the interactive shell
> contree shell
> ```
>
> Once inside the shell:
>
> ```text theme={null}
> contree use tag:ubuntu:latest
> uname -a
> ls /
> cat /etc/os-release
> ```

Ready? Start with [Install & Authenticate](https://docs.tokenfactory.nebius.com/sandboxes/cli/tutorial/installation.md).
