# How it works
<subtitle>How the template building process works</subtitle>

## Overall process

Every time we build a sandbox template, we create a container based on the definition. We extract the container's filesystem, configure and install dependencies, run layer commands and start the sandbox.

Then, perform the following steps:
1. Get the running sandbox.
2. (Only if you specify [start command](/docs/agent-sandbox/template/start-ready-command.md#start command), otherwise skip this step) Execute the start command.
3. Wait for ready (if a startup command is specified, the default wait is 20 seconds; otherwise, it is ready immediately). You can use [ready command](/docs/agent-sandbox/template/start-ready-command.md#ready command) to configure readiness checking.
4. Snapshot the sandbox so it can be launched via the SDK.

We call this sandbox snapshot a **sandbox template**.

> **Sandbox Snapshot**
>
> A snapshot is a saved running sandbox. We serialize and save the entire sandbox's file system and all running processes so that it can be loaded later.
>
> This allows us to load the sandbox in ~80ms, with all processes already running and the filesystem exactly as it was then.

##Default user and working directory

To learn more about the default user and workdir, see the [User and Workdir](/docs/agent-sandbox/template/user-and-workdir.md) section.

## cache

To learn more about caching, see the [caching](/docs/agent-sandbox/template/caching.md) section.

## Kernel

UCloud Sandbox sandbox runs on **LTS 6.1 Linux kernel**.

> Kernel version is fixed at template build time. If you need to use a newer kernel version, rebuild the template.
