Skip to main content
When you connect a new repository, Twill doesn’t require manual configuration. A specialized Dev Environment Agent analyzes your codebase and creates a complete sandbox environment automatically.

How It Works

The Dev Environment Agent runs when:
  1. First task on a repository — No environment exists yet
  2. Environment failure detected — Existing setup has errors
The agent inspects your repository structure, detects your stack, and generates an idempotent entrypoint script that bootstraps everything needed to run your project.

What the Agent Analyzes

The agent examines your repository to understand:
  • Package manager — Lockfiles like pnpm-lock.yaml, package-lock.json, poetry.lock
  • Framework — Next.js, Django, Rails, FastAPI, etc.
  • Infrastructuredocker-compose.yml, database requirements
  • CI/CD workflows — GitHub Actions, GitLab CI for environment hints
  • Config files.env.example, framework configs, build scripts

The Bootstrap Process

The generated entrypoint script follows five phases:
  1. System dependencies — Installs missing packages and version managers
  2. Project dependencies — Runs the appropriate install command for your package manager
  3. Infrastructure services — Starts Docker Compose and waits for healthy status
  4. Database setup — Runs migrations and seeds test data
  5. Development server — Starts your dev server in the background with logging

Self-Healing

If the environment fails—missing dependencies, crashed services, misconfigured databases—the Dev Environment Agent automatically diagnoses and fixes the issue. The SWE agent checks environment health before every task:
  1. Reviews logs in $TWILL_ENTRYPOINT_LOG_DIR
  2. Looks for error indicators (failures, crashes, missing packages)
  3. Calls the Dev Environment Agent if problems are detected
  4. Proceeds with implementation only after environment is healthy

Learning and Persistence

Environment fixes aren’t throwaway. When the agent updates the configuration:
  1. Changes are written to special files in the sandbox
  2. Twill detects and validates these updates
  3. New configuration is persisted to the database
  4. Future tasks use the improved environment
This creates a learning loop—each fix makes the environment more robust for future runs.

Supported Stacks

The Dev Environment Agent handles most common stacks out of the box:
CategorySupported
LanguagesNode.js, Python, Go, Rust
Package Managerspnpm, npm, yarn, poetry, uv, cargo
DatabasesPostgreSQL, MySQL, Redis, MongoDB (via Docker)
FrameworksNext.js, React, Django, FastAPI, Rails, and more
InfrastructureDocker, Docker Compose
For complex or non-standard setups, you can always manually configure the environment.