Skip to main content

Code Environment

In Bosun, a "code environment" is the isolated space where your automated tasks, specifically the code written or modified by agents, are executed. This environment provides a secure and consistent setting for all operations.

Here are the key characteristics of a Bosun code environment:

  • Universal Docker Images: Each task runs within a standardized Docker image. These images come pre-equipped with common development tools and runtimes—including Node.js, Ruby, Rust, Java, Bun, Python, and PHP support—so agents have what they need without extra setup.

  • External Communication: The code environment can communicate with the external world. This means agents can make outbound network calls to interact with APIs, fetch data, or perform Git operations on your connected repository.

  • Service Environment Isolation: Service-level environment variables that Bosun manages (for example, credentials used to bring services online) do not leak into task execution. Agents only see the task inputs and environment variables you explicitly provide.

  • Isolated Execution: Every code environment is strictly isolated. This prevents any interaction or interference between different tasks running concurrently or with the Bosun platform itself, ensuring security and reliability.

  • Ephemeral Nature: Code environments are temporary. Once a task completes, or after a maximum of 24 hours, the entire environment—including generated code and data—is securely cleaned up and deleted. This ensures no residual data persists.

  • Additional Services: You can define additional services (like databases or caches) to run alongside your code environment. These services are isolated from the Bosun platform and can be configured via a .bosun/config.toml file in your repository.

This setup provides a robust and secure sandbox for your automated workflows, allowing agents to operate effectively while maintaining strict boundaries.

Customising

The environment can be customized by providing a .bosun/config.toml in your repository. You can provide services that will be started alongside the code environment, and you can provide environment variables that will be available.

An example:

[code-environment.env]
DATABASE_URL = "postgres://postgres:password@localhost:5432/test"
RAILS_ENV = "test"
RUST_LOG = "debug"

[code-environment.services.postgres]
image = "postgres:15-alpine"
env = { POSTGRES_USER = "postgres", POSTGRES_PASSWORD = "password", POSTGRES_DB = "test" }
options = """
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
"""
[code-environment.services.qdrant]
image = "qdrant/qdrant:v1.15"

[code-environment.services.redis]
image = "redis:7-alpine"