How Devin’s environment works
Devin runs on its own VM. Each session boots from a machine image — a saved snapshot with your tools, repos, and dependencies pre-installed. You control what goes into that image by editing your environment configuration in Settings > Devin’s Environment.Writing your configuration
Your environment.yaml has three sections:| Section | Purpose | When it runs | Executed? |
|---|---|---|---|
initialize | Install tools and compile dependencies | Build only — results are saved in the machine image | Yes |
maintenance | Keep dependencies up to date, write credential configs | Build + start of every session | Yes |
knowledge | Short notes tied to the environment setup (e.g., lint/test commands) | Loaded at session start | No — reference notes only |
initialize — one-time setup
Use initialize for anything slow or that only needs to happen once: installing package managers, global CLI tools, compiling native dependencies, or adding system packages.
Results are saved in the machine image and do not run again at session start.
set -e, so any failing line stops the build. Use \ for line continuation, or switch to the expanded form for named steps that show up individually in build logs.
Expanded form
When you need named steps, use the list form. Named steps make build logs easier to debug — when something fails, you’ll see which step broke instead of just a line number.run are skipped.
Setting environment variables
To set environment variables for subsequent steps, writeKEY=VALUE lines to the $ENVRC file (like GitHub Actions’ $GITHUB_ENV). All variables written to $ENVRC are automatically exported for subsequent steps and the Devin session.
maintenance — every session
Use maintenance to keep dependencies up to date and to write credential config files.
It runs during the build (after initialize) and at the start of every session, after pulling the latest code. Because it runs on every session start, commands should be fast and incremental.
Credential configuration
Any step that writes secrets into config files (.npmrc, settings.xml, pip.conf) belongs in maintenance, not initialize. This keeps credentials fresh at the start of every session.
knowledge — environment-specific notes (optional)
Use knowledge for small pieces of setup information that Devin needs to actually use the environment you just built — things like the lint command, the test command, or how to start the dev server.
Entries are reference notes — they are not executed. Keep them short:
Configuration levels
Devin supports three configuration tiers. Each tier’s commands are strictly additive — they run in sequence during builds, and lower levels cannot override or modify what higher levels configure.| Level | Where to configure | What to put here | Examples |
|---|---|---|---|
| Account-wide (Enterprise) | Enterprise Settings > Environment | Infrastructure that all orgs need | CA certificates, corporate proxy, VPN, DNS |
| Org-wide | Settings > Environment > Organization-wide setup | Tools and setup shared across all repos | Language runtimes (pnpm, uv), Docker auth, shared CLI tools |
| Repo-specific | Settings > Environment > [repo] | Project-specific setup and knowledge | npm install, lint/test/build commands, architecture notes |
- If every org in your enterprise needs it → account-wide
- If every repo in your org needs it → org-wide
- If only one repo needs it → repo-specific
Enterprise users: For detailed guidance on enterprise-level configuration — permissions, build cascading, multi-org management, and enterprise migration — see the Enterprise Environment Setup page.
How it works
The machine image
Your organization has one machine image — a VM snapshot with your tools, repos, and dependencies pre-installed. All configured repos are cloned and set up in that single image. Every session boots from a fresh copy.How builds work
A build creates a new machine image in this order:How sessions work
Each session boots a fresh copy of the machine image. When the session ends, all changes are discarded. At session start:- Enterprise and org-wide
maintenanceruns (in~). - The latest code is pulled for the relevant repo(s).
- That repo’s
maintenanceruns again to catch dependency changes since the last build. - That repo’s
knowledgeentries are loaded into Devin’s context.
Build statuses
| Status | Meaning |
|---|---|
| Success | All steps completed. Machine image is ready. |
| Partial | Some repos failed but the core build succeeded. Sessions will work but some repos may not be fully set up. |
| Failed | Core build failed (e.g., clone failure, enterprise/org setup failed). |
| Cancelled | Superseded by a newer build. |
| Skipped | No configuration changes detected. |
Repository states
In the Environment Settings UI, repositories appear in three states:| State | Meaning |
|---|---|
| Configured | Has YAML configuration with initialize/maintenance/knowledge. Fully set up in the machine image. |
| Included | Cloned into the machine image but has no custom configuration. Devin can access the code. |
| Available | Accessible to the org but not added to the environment. Not cloned. |
What triggers a rebuild?
A new build is triggered when:- You save a configuration in Settings > Devin’s Environment
- You click Rebuild in Settings
- You apply a Devin-suggested environment update from your timeline
Secrets
Reference secrets with$VARIABLE_NAME syntax. Add them in Settings > Secrets.
initialize, that expanded value may persist in the image. Always write credentials in maintenance instead, where they’re freshly loaded each session.
For more on secrets management, see Secrets & Site Cookies.
Repo patterns
Multiple repositories
When you configure multiple repos, each one gets its own YAML in Settings. During a build, all of them are set up in the same image — cloned into separate directories, dependencies installed independently. During a session, only the active repo’s maintenance and knowledge are relevant. What if two repos conflict? Each repo’s commands run in its own directory, so dependency conflicts are rare. If two repos install different versions of a global tool or modify shared files (like~/.bashrc), the last one to run wins. Put shared tool installs in the org-wide config to avoid this.
Monorepos
For a monorepo, you write a single YAML that covers all the sub-projects. Use subshells to run commands in subdirectories without changing the working directory for subsequent steps:(cd ... && ...) are important — they run the command in a subshell so the working directory resets for the next step.
When to use multi-repo vs. monorepo config: If the code lives in one Git repository, use one YAML with subshells. If it’s spread across multiple Git repositories, configure each repo separately in Settings.
Next steps
YAML Reference
Field reference tables, execution details, pre-installed tools, and glossary.
Configuration Examples
Copy-paste examples for Node.js, Python, Java, Go, monorepos, enterprise patterns, and more.
Troubleshooting & FAQ
Debug build failures, migrate from interactive setup, and find answers to common questions.
Enterprise Environment Setup
Permissions, build cascading, multi-org management, and enterprise migration.
