Codegen lets you configure custom setup commands that run once when initializing a repository’s sandbox environment. The resulting file system snapshot serves as the starting point for all future agent runs, ensuring consistency.
The most common use cases for setup commands is installing dependencies, e.g.
npm install
Codegen sandboxes are built on a custom Docker image that provides a comprehensive development environment. For detailed information about the base image, including the complete Dockerfile and available tools, see the Base Image documentation.
To configure setup commands for a repository:
https://www.codegen.com/repos/{arepo_name}/setup-commands
Set setup commands at codegen.com/repos
Enter your desired setup commands in the provided text area, with one command per line. These commands will be executed in sequence within the sandbox environment.
For example, you might want to:
After the commands are executed successfully, Codegen takes a snapshot of the sandbox’s file system. This snapshot then serves as the base environment for future agent interactions with this repository, meaning your setup commands don’t need to be re-run every time, saving time and ensuring consistency.
Here are a few common use cases for setup commands:
The sandbox comes with Python 3.13 by default, but some packages may not yet be compatible with this version. Here are strategies for handling different Python versions:
If you need to work with a different Python version, you can install and use pyenv
:
The uv
package manager (already installed) can also manage Python versions:
When working with packages that require older Python versions:
Remember to activate your virtual environment in your setup commands if you need specific Python versions for your project dependencies.
Ensure your setup commands are non-interactive and can run to completion without user input.
The environment variables listed in the “Env Variables” section are available during the execution of these setup commands.