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

# Optimize startup times

> Fast startup times enable humans and agents to work effectively and autonomously across multiple tasks in parallel.

Optimized environments start in 1-3 minutes. Without optimization, startup can take 10+ minutes. This page covers the strategies that close that gap.

## Optimization strategies

### Use prebuilds

[Prebuilds](/ona/projects/prebuilds) run your environment setup ahead of time: container builds, dependency installation, and startup tasks. When an environment starts, it loads from a prebuild snapshot instead of running setup from scratch.

This is the single biggest optimization. Configure prebuilds to run on a daily schedule before your team or agents start work. You can also run a prebuild manually after important dependency or setup changes.

### Enable Dev Container image caching

For runners in your VPC, enable image caching to avoid rebuilding containers:

* **[AWS runners](/ona/runners/devcontainer-image-cache#aws-runners)**: Caches built Dev Container images automatically
* **[GCP runners](/ona/runners/devcontainer-image-cache#gcp-runners)**: Supports image caching through Artifact Registry

[Ona Cloud](/ona/runners/ona-cloud) includes image caching by default.

### Optimize your Dockerfile

Structure your Dockerfile for caching efficiency:

* **Put stable dependencies first**: System packages, build tools, and runtimes that rarely change should be early in the Dockerfile.
* **Put volatile dependencies last**: Application dependencies that change frequently go at the end.
* **Use prebuilt base images**: Push your base image to a registry and reference it in `devcontainer.json`.

### Use tasks for dynamic setup

For setup that must happen at runtime (database seeding, environment-specific config), use [Tasks](/ona/configuration/tasks-and-services/overview) rather than baking everything into the image.

## Use one environment per task

Create a fresh environment for each piece of work rather than reusing environments across tasks. This matches how agents operate:

1. Agent receives a task
2. Agent starts a clean environment
3. Agent completes the work and creates a PR
4. Environment is discarded

This isolation gives you:

* **No state conflicts**: Each task gets a clean slate
* **Parallel execution**: Multiple agents work simultaneously without interference
* **Mistakes are free**: If something goes wrong, discard the environment and start fresh

With the optimizations above, startup stays under a few minutes.

## Measure startup time

Track these metrics to identify bottlenecks:

* **Container build time**: How long does the Dev Container image take to build?
* **Dependency installation**: How long do startup tasks take to run?
* **Prebuild freshness**: Are prebuilds running often enough to stay current?

If environments take more than 3 minutes to start, check your prebuild configuration first.
