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

# Coding environments

> Define a reusable execution environment for your repositories so CodeRabbit coding tasks start with the toolchains, packages, variables, and setup they need.

export const OpenBetaBadge = ({tip = "This feature is currently in open beta. We are actively improving it based on your feedback. If you encounter any issues or have suggestions, please share them on our Discord community or visit the support page.", title = "Open Beta", cta = "Contact support", href = "/support", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="badge-alert" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const AdminRoleBadge = ({tip = "This feature requires an organization owner, an admin role or the corresponding permission. Regular Members do not have access.", title = "Admin Only", cta = "View roles", href = "/management/roles", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="lock" color="orange" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const GitLabBadge = ({tip = "This feature is available on GitLab.", title = "GitLab", cta, href, disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="gitlab" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const GitHubBadge = ({tip = "This feature is available on GitHub and GitHub Enterprise.", title = "GitHub", cta, href, disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="github" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<GitHubBadge /> <GitLabBadge /> | <AdminRoleBadge tip="Coding environments are configured by organization administrators." /> <OpenBetaBadge tip="Coding Agent is in beta." />

## Overview

Every coding task runs in a sandbox holding a prepared checkout of your repository. A **coding environment** is how you tell CodeRabbit what that sandbox should contain: which language toolchains to install, which setup to run, and which environment variables to expose.

Define one once, assign your repositories to it, and every task on those repositories starts from it. Set one up when tasks on a repository need a specific language version, a private dependency source, or a build step that has to run before the agent can do anything useful.

Find coding environments at [app.coderabbit.ai/code/environments](https://app.coderabbit.ai/code/environments).

## Install toolchains

Choose the language runtimes the environment should install, and a version for each.

| Toolchain | Versions         |
| --------- | ---------------- |
| Node.js   | 24, 22, 20       |
| Python    | 3.13, 3.12, 3.11 |
| Go        | 1.24, 1.23, 1.22 |
| Java      | 23, 21, 17       |
| Ruby      | 3.4, 3.3, 3.2    |
| Rust      | 1.86, 1.85, 1.84 |
| Bun       | 1.2, 1.1         |

Each toolchain you add counts as one of the environment's 12 package slots.

## Choose a setup method

| Method        | What it does                                                                                |
| ------------- | ------------------------------------------------------------------------------------------- |
| **Automatic** | CodeRabbit detects the repository's dependencies and prepares it without a script from you. |
| **Custom**    | CodeRabbit runs the setup script you supply.                                                |

Use a custom script when the repository needs something detection can't infer — a private registry, a code generation step, a database to migrate, a monorepo bootstrap.

You can also supply **startup instructions**: notes describing how the project is meant to be built, tested, or run.

## Set environment variables

Environment variables are exposed to the task's sandbox. Use them for anything the build or test suite needs to read from the environment.

An environment holds at most 100 variables. A variable name is capped at 255 characters and its value at 4,000.

<Warning>
  A coding task runs in a sandbox where the agent can read its own environment and run commands. Give an environment only what its tasks genuinely need.
</Warning>

## Assign repositories

An environment applies to the repositories you assign to it. Assign between 1 and 50 repositories per environment.

<Info>
  Environment assignment covers GitHub and GitLab repositories. Coding tasks still run on Azure DevOps and Bitbucket Cloud; they just can't be given a configured environment.
</Info>

Each assignment reports its own state:

| Repository state | Meaning                                                       |
| ---------------- | ------------------------------------------------------------- |
| **Preparing**    | Setup for this repository is still running.                   |
| **Active**       | The repository is assigned and ready to use this environment. |
| **Failed**       | Setup for this repository did not complete.                   |
| **Removed**      | The assignment was removed.                                   |
| **Replaced**     | A newer assignment superseded this one.                       |

## Environment states

| State         | Meaning                                                               |
| ------------- | --------------------------------------------------------------------- |
| **Preparing** | The environment is still being built.                                 |
| **Ready**     | The environment is available to its assigned repositories.            |
| **Failed**    | Environment preparation did not complete.                             |
| **Archived**  | The environment is kept for reference but can't take new assignments. |

## Archive an environment

Archive an environment you no longer want to use. It is retained, but excluded from new repository assignments.

## Limits

| Limit                         | Value             |
| ----------------------------- | ----------------- |
| Repositories per environment  | 1 to 50           |
| Package slots per environment | 12                |
| Environment variables         | 100               |
| Variable name length          | 255 characters    |
| Variable value length         | 4,000 characters  |
| Setup script length           | 50,000 characters |
| Startup instructions length   | 10,000 characters |

## What's next

<CardGroup cols={1}>
  <Card title="Start a coding task" href="/code/start-a-task" icon="play" horizontal>
    Every way to start a task against a repository you've configured.
  </Card>

  <Card title="Access and billing" href="/code/access-and-billing" icon="credit-card" horizontal>
    Which turns are free, how agent minutes are metered, and how the monthly cap behaves.
  </Card>

  <Card title="Coding Agent overview" href="/code/index" icon="square-code" horizontal>
    How a coding task works, from the first request to delivered code.
  </Card>
</CardGroup>
