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

# Manage Environments with AI Agents

> Use MCP tools to create staging and production environments, list resources per environment, and delete unused environments — all through conversation.

export const RuncrateStyles = () => {
  if (typeof document !== 'undefined' && !document.getElementById('runcrate-overrides')) {
    const s = document.createElement('style');
    s.id = 'runcrate-overrides';
    s.textContent = `
      /* Match Runcrate's rounding scale (--radius: 0.75rem) */
      .rounded-sm { border-radius: 0.5rem !important; }   /* 8px */
      .rounded-md { border-radius: 0.625rem !important; } /* 10px */
      .rounded-lg { border-radius: 0.75rem !important; }  /* 12px */
      .rounded-l-sm { border-top-left-radius: 0.5rem !important; border-bottom-left-radius: 0.5rem !important; }
      .rounded-r-sm { border-top-right-radius: 0.5rem !important; border-bottom-right-radius: 0.5rem !important; }
      .rounded-l-md { border-top-left-radius: 0.625rem !important; border-bottom-left-radius: 0.625rem !important; }
      .rounded-r-md { border-top-right-radius: 0.625rem !important; border-bottom-right-radius: 0.625rem !important; }
      .rounded-l-lg { border-top-left-radius: 0.75rem !important; border-bottom-left-radius: 0.75rem !important; }
      .rounded-r-lg { border-top-right-radius: 0.75rem !important; border-bottom-right-radius: 0.75rem !important; }

      /* Cards: never pure white in light mode */
      .card { background-color: #fcfcfc !important; border-radius: 0.75rem !important; }
      html.dark .card { background-color: #141414 !important; }

      /* Docs hero box */
      .rc-hero { background-color: #fcfcfc; border: 1px solid #e0e0e0; }
      html.dark .rc-hero { background-color: #141414; border-color: #242424; }
      html.dark .rc-hero h1 { color: #f5f5f5; }

      /* Runcrate scrollbar — thin, transparent track, hide-until-hover thumb */
      ::-webkit-scrollbar { width: 6px; height: 6px; background-color: transparent; }
      ::-webkit-scrollbar-track { background-color: transparent; }
      ::-webkit-scrollbar-thumb { background-color: rgba(155, 155, 155, 0.5); border-radius: 10px; transition: opacity 0.3s ease; opacity: 0; }
      ::-webkit-scrollbar-thumb:hover { background-color: rgba(155, 155, 155, 0.7); }
      *:hover::-webkit-scrollbar-thumb,
      *:focus::-webkit-scrollbar-thumb,
      *:active::-webkit-scrollbar-thumb { opacity: 1; }
      * { scrollbar-width: thin; scrollbar-color: rgba(155, 155, 155, 0.5) transparent; }
    `;
    document.head.appendChild(s);
  }
  return null;
};

<RuncrateStyles />

Environments let you organize resources within a workspace. Your AI agent can create, list, and delete environments, and show you what's running in each one.

***

## "Set up staging and production environments for our ML pipeline."

The agent creates both environments:

1. **`list_environments`** — checks what already exists
2. **`create_environment`** — creates `staging`
3. **`create_environment`** — creates `production`

> You already have the default **main** environment.
>
> Created two new environments:
>
> * **staging** — for testing model updates before promotion
> * **production** — for live inference workloads
>
> Your workspace now has 3 environments: main, staging, production.
> Deploy instances to a specific environment from the dashboard or specify it when creating resources.

***

## "What resources are running in each environment?"

The agent maps instances and storage to environments:

1. **`list_environments`** — lists all environments
2. **`list_instances`** — lists all instances with their environment assignments
3. **`list_volumes`** — lists all volumes with their environment assignments

> **main** (default)
>
> * dev-box (RTX 4090) — running, \$0.35/hr
> * scratch-volume (100 GB)
>
> **staging**
>
> * staging-inference (A100) — running, \$1.60/hr
> * staging-models (200 GB)
>
> **production**
>
> * prod-inference-1 (H100) — running, \$2.50/hr
> * prod-inference-2 (H100) — running, \$2.50/hr
> * model-weights (500 GB)
>
> **Total burn rate:** \$6.95/hr
> Production is 72% of your spend.

***

## "Delete the staging environment — we're done testing."

The agent checks for active resources first:

1. **`list_instances`** — checks for instances in the staging environment
2. **`ssh_execute`** — optionally checks if the instance is mid-task

> **staging** has 1 running instance (staging-inference) and 1 volume (staging-models).
> Environments can't be deleted while they have active resources. Want me to:
>
> 1. Terminate the instance and delete the volume, then delete the environment
> 2. Just terminate the instance and keep the volume

After you choose option 1:

3. **`delete_instance`** — terminates `staging-inference`
4. **`delete_volume`** — deletes `staging-models`
5. **`delete_environment`** — deletes the `staging` environment

> Terminated **staging-inference**, deleted **staging-models** (200 GB), and removed the **staging** environment.
> Your workspace now has 2 environments: main, production.
> Saving \$1.60/hr on the instance.

<Note>The default `main` environment cannot be deleted. This is enforced at the database level.</Note>

***

## Tools used in this workflow

| Tool                                                              | Purpose                              |
| ----------------------------------------------------------------- | ------------------------------------ |
| `list_environments` / `create_environment` / `delete_environment` | Manage environments                  |
| `list_instances` / `list_volumes`                                 | Check resources per environment      |
| `delete_instance` / `delete_volume`                               | Clean up before environment deletion |
