Environments
Set up repositories once with a setup script, the hosts they may reach, and the secrets they need.
An environment tells Kliff how to get repositories ready for work. It holds a setup script, the hosts an agent may reach beyond the defaults, and secrets such as API keys. Agents and runs on those repositories use it every time. Environments are on the Cloud page in the sidebar.
What an environment holds
| Field | What it is | Limit |
|---|---|---|
| Name | How the environment shows on the Cloud page. | 80 characters |
| Scope | Personal or Organization. | |
| Repositories | The repositories it sets up. | |
| Setup script | A bash script that runs in each repository before work starts, such as installing dependencies. | 16,000 characters |
| Allowed hosts | Hosts the computer may reach, one per line, such as registry.npmjs.org. | 50 hosts |
| Secrets | Environment variables for setup and the agent. | 50 secrets, 16,384 characters each |
Secret values are encrypted and never shown again. Paste a .env file into a secret's name to add many at once.
In an organization environment, each member can also add Your personal secrets. Only you can see them, only your runs and agents get them, and they replace environment secrets with the same name.
Let an agent write the setup script
Select Start agent in New environment to open a setup agent. It writes the setup script, tries it, and saves it to the environment when it passes. It works with one repository chosen, and it commits nothing to the repository. Select Skip and save to save the environment without one.
The composer on the Agents page also offers Set up cloud environment for chosen repositories that have no environment yet.
How agents use it
When an agent starts on a repository, it uses that repository's environment: your personal one first, then the newest organization one. The setup script runs after the repository is cloned, and can take up to 10 minutes.
If a setup script fails, the turn stops with Setup failed. Fix the script on the Cloud page, then send another message.
Related
- Computers: what is installed and which hosts a computer reaches by default.
- Plugins and repository MCP servers: a repository's MCP servers can use only its environment's secrets and hosts.