Pick an environment for a session
- In Code mode, open the environment button in the workspace bar under the composer.
- Under Cloud environments, pick the one you want. This computer runs the session locally instead.
- Start the session.
Edit an environment
The editor has these fields. Click Save changes to store them. Changes apply to sessions you start afterward, not to sessions already running.Name
Up to 80 characters. It’s the name you see in the picker.Network access
Network access decides what the session’s tools (the shell, package managers, test runners) can connect to.
New environments start with this allowed list. You can remove any of it or add your own hosts. A host can be a plain name like
api.example.com or a wildcard like *.example.com.
Network secrets
Secrets let a session call an API without anyone seeing the key. Add a secret with a name, a value and, if you want, the hosts it’s for.- The name must be in capitals, digits and underscores, starting with a letter or underscore, for example
NPM_TOKEN. - After you save a secret, its value can’t be viewed again, here or anywhere in the app. You can replace it by adding a secret with the same name, or delete it.
- The session’s tools get the secret as an environment variable with that name.
- Wherever the value would show up in tool output, the transcript, or what is sent to the model, it is replaced with
[secret:NAME]. - Under Limited network access, the hosts you set on a secret are allowed too.
Setup script
A Bash script that runs in the session’s workspace when a new session starts, before the agent launches. Use it to install dependencies, for example:Environment variables
Plain.env text, one NAME=value per line, up to 64 KB. These are set for the session’s tools.
Repos
The repos to clone into the workspace, each with an optional branch. Each repo gets its own folder. URLs can behttps://, ssh:// or git@host:owner/repo. You can list up to 20.
A session can also name its own repos when it starts. Those replace the environment’s list for that session.
Session status
While a cloud session gets ready, it shows where it is:Archive an environment
Click Archive environment at the bottom of the editor. It leaves the picker, and if it was your default, it no longer is. Sessions already running in it keep running. If you archive every environment, the next time you open the list you get a fresh Default. Archived environments can be brought back from the API (see below).For developers
The environments live in the cloud API under/api/v1/code-environments. Sign in with a Clerk session, an API token with the compute scope, or a runtime device token. The full reference, including the runtime-only resolve route that returns secret values to your own paired devices, is in Code environments API.
Related pages
- How a cloud session starts: cloning, the setup script, secret redaction and the network proxy, step by step.
- Code session list
- Linked pull requests in Code
- Session panel: the Environment card shows the environment and its status for each session.