Session status
The session shows one of four states while the environment is applied:
A failed setup only stops that session. Fix the cause (for example the setup script or a repo URL), then send another message in the session to try again, or start a new session.
What runs, in order
- Load the environment. The runtime asks Allternit for the environment, including secret values. Only a runtime paired to the environment’s owner can do this, using its own device credential. If the runtime isn’t signed in, setup fails with a message saying so.
- Clone the repos. Each repo goes into its own folder in the session’s workspace, named after the repo. If you picked a branch, that branch is checked out. If the branch doesn’t exist yet, the runtime clones the default branch and creates the new branch from it. Repos chosen for the session replace the environment’s own repo list.
- Load variables and secrets. The environment’s variables and secrets are added to the environment of every shell command the agent runs.
- Turn on the network policy for the session’s tools (see below).
- Run the setup script with bash in the workspace folder. It can run for up to 10 minutes. A script that exits with a non-zero code, or runs longer than 10 minutes, fails setup.
- Start the agent. The agent is told which repos were cloned, that the setup script ran, which secret names it can use, and what network access it has.
Private repos
For a private GitHub repo, add a secret namedGITHUB_TOKEN (or GH_TOKEN) to the environment. The runtime uses it to clone over HTTPS and never puts it on the command line. Without one, cloning uses whatever git credentials the runtime machine already has.
Variables
The environment variables field takes the same text as a.env file:
- Lines can start with
export. - Double quotes understand
\n,\tand\". Single quotes and backticks keep text as written. - Quoted values can span several lines.
${OTHER_VAR}is not expanded.- Lines that aren’t
NAME=valueare skipped, and the Setup step lists them.
Secrets
Secret values are only sent to the runtime that runs the session, and only kept in its memory. They are added to the environment of the agent’s shell commands and the setup script. Before any command output is saved, shown to you or sent to the model, every secret value is replaced with[secret:NAME]. The base64 form of each value is replaced too.
Limits worth knowing:
- Values shorter than 4 characters can’t be hidden this way, so the Setup step warns about them.
- A secret that a command transforms (reverses, hashes, splits) is no longer recognisable, so it isn’t hidden.
- Secrets are hidden from what the agent and you see. A command the agent runs can still use them, for example by sending them to a host the network policy allows.
Network policy
Network access applies to the session’s tool processes: the shell commands the agent runs and the setup script. It does not limit the runtime itself, which still needs to reach Allternit and the model provider.
The proxy runs inside the runtime, one per session, on
127.0.0.1, and closes when the session is deleted. Requests to localhost skip it, so local dev servers keep working.
Host patterns in the allowed list:
How strongly this is enforced depends on how commands run on the runtime:
- Sandboxed commands (the default on macOS and Linux): the OS sandbox enforces the policy. With None, the sandbox blocks all outbound connections. With Limited, connections can only go through the sandbox’s allowlisting proxy, which matches the allowed domains and their subdomains. On Linux this needs
socaton the runtime. - Unsandboxed commands (the sandbox turned off, or Windows): the policy is set through the
HTTP_PROXY,HTTPS_PROXYandALL_PROXYvariables. Tools that respect those variables (curl, git, npm, pip, cargo and most SDKs) are held to the policy. A program that opens network connections directly can get around it.
For developers
- Create the session with
POST /v1/sessionand includeenvironmentId, plusrepos([{ url, branch? }]) to override the environment’s repos. GET /v1/session/:idreturnsenvironment: { id, name, status, error? }, where status isconnecting,setting_up,readyorfailed. The same object is sent on the event stream assession.environment.updated.- The Setup step is an assistant message whose
modeisenvironment-setup, with one tool part namedsetup. Its output streams instate.metadata.output. When setup fails, the message carries anEnvironmentSetupError. This message is never sent to the model. - The runtime loads the environment from
GET /api/v1/code-environments/:id/resolveon the cloud API (ALLTERNIT_CLOUD_API_URL), authenticated with its paired device token. - Sessions without
environmentIdrun exactly as before.
Related pages
- Cloud environments: create and edit environments, secrets and network access.
- Code environments API