Skip to content

Environments

When you create a task in Cosine Cloud, you choose the environment and size the task should run in. The environment determines the operating system, tools, dependencies, and secrets available to the agent.

For the broader concept of local and remote execution across Cosine, see Locations and environments.

When you create a task in Cloud:

  1. You select an environment and size
  2. Cosine provisions a remote workspace using that environment
  3. The agent clones your repository and works inside that workspace
  4. Changes are returned to Cloud for review and can be pushed to your repository

Cloud workspaces are ephemeral. They are created when the task starts and cleaned up when the task ends. Your code changes, commits, branches, and review artifacts are what persist.

New projects can start with the default Ubuntu environment immediately, without creating a custom environment.

The default environment for most engineering work.

  • Use for: General-purpose development, code edits, builds, tests, and shell commands
  • Choose it when: You want a full Linux environment with broad language support

All Cloud environments can run at different resource tiers.

SizeCPUMemoryBest for
XS0.25512 MBLightweight tasks, quick scripts
S0.51 GBSmall services, focused edits
M12 GBDefault for most application work
L24 GBHeavier builds, larger test suites
XL48 GBLargest repositories, demanding workloads

Start with M for most work. Scale down for quick, focused tasks, or scale up for large builds, heavy indexing, and memory-intensive workloads.

Create or auto-generate a custom environment when your project needs dependencies, tools, browser or desktop access, or configuration that the default Ubuntu environment does not include.

Custom environments are useful when:

  • Your project requires specific language versions or system packages
  • You want dependencies baked in before the task starts
  • Your team needs consistent tooling across Cloud tasks
  • The task depends on services, databases, or private packages
  1. Open the project in Cloud.
  2. Go to Project Settings → Environments → Configure Environments.
  3. Click Create or Auto-generate.
  4. Select a base image, such as Ubuntu, Browser, Desktop, or VS Code.
  5. Edit the Dockerfile or let Cosine generate one from your repository.
  6. Add environment secrets if needed.
  7. Select a size preset and build the environment.

The built environment becomes available in the task environment picker.

Cosine Cloud environments settings page showing available base and custom environments and actions to configure them

Auto-generate analyses your repository and creates an environment tailored to your project:

  • Detects languages, frameworks, and package managers
  • Generates a Dockerfile with appropriate dependencies
  • Builds and validates the environment at runtime
  • Saves the Dockerfile in the .cosine folder in your repository

From the Cloud environments settings panel, you can:

  • View environments with build status and base image
  • Edit an environment Dockerfile or secrets
  • Rebuild an environment after making changes
  • Set as default for new tasks
  • Delete environments you no longer need
  • View build logs to debug failures

When you create custom environments, Cosine can save configuration in your repository:

  • .cosine/Dockerfile — The default environment Dockerfile
  • .cosine/<name>.Dockerfile — Named environment Dockerfiles
  • .cosine/defaults.json — Size preferences and default environment setting

These files can be committed to version control so your team can share the same environment setup.

Secrets are encrypted key-value pairs injected into environments at runtime. Use them for API keys, access tokens, database credentials, private registry authentication, and other sensitive configuration.

Secrets are always encrypted and stored per environment. They are never exposed in build logs or Dockerfiles.