The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
/*
* Copyright 2025 Daytona Platforms Inc.
* Modified by BoxLite AI, 2025-2026
* SPDX-License-Identifier: AGPL-3.0
*/
import { IsEnum, IsObject, IsOptional, IsString, IsNumber, IsBoolean, IsArray, IsInt, Min } from 'class-validator'
import { ApiPropertyOptional, ApiSchema } from '@nestjs/swagger'
import { BoxClass } from '../enums/box-class.enum'
import { CpuAllocation } from '../utils/cpu-allocation'
import { BoxSecret, BoxVolume } from './box.dto'
@ApiSchema({ name: 'CreateBox' })
export class CreateBoxDto {
@ApiPropertyOptional({
description: 'The name of the box. If not provided, the box ID will be used as the name',
example: 'MyBox',
})
@IsOptional()
@IsString()
name?: string
@ApiPropertyOptional({
description:
'Image to boot the box from: a curated image name (e.g. "base"), or any OCI ref on an allowed public registry. Omit for the default.',
example: 'base',
})
@IsOptional()
@IsString()
image?: string
@ApiPropertyOptional({
description: 'The user associated with the project',
example: 'boxlite',
})
@IsOptional()
@IsString()
user?: string
@ApiPropertyOptional({
description:
'User the container process runs as (OCI process.user), as <name|uid>[:<group|gid>]. ' +
"Omit to keep the image's USER directive. Distinct from `user`, which is a warm-pool label.",
example: '1000:1000',
})
@IsOptional()
@IsString()
runAsUser?: string
@IsOptional()
@IsBoolean()
privileged?: boolean
@ApiPropertyOptional({
description: 'Working directory inside the container',
example: '/workspace',
})
@IsOptional()
@IsString()
workingDir?: string
@ApiPropertyOptional({
description: "Override the image's ENTRYPOINT",
type: [String],
example: ['python'],
})
@IsOptional()
@IsArray()
@IsString({ each: true })
entrypoint?: string[]
@ApiPropertyOptional({
description: "Override the image's CMD",
type: [String],
example: ['-c', 'print(1)'],
})
@IsOptional()
@IsArray()
@IsString({ each: true })
cmd?: string[]
@ApiPropertyOptional({
description: 'Environment variables for the box',
type: 'object',
additionalProperties: { type: 'string' },
example: { NODE_ENV: 'production' },
})
@IsOptional()
@IsObject()
env?: { [key: string]: string }
@ApiPropertyOptional({
description: 'Labels for the box',
type: 'object',
additionalProperties: { type: 'string' },
example: { 'boxlite.io/public': 'true' },
})
@IsOptional()
@IsObject()
labels?: { [key: string]: string }
@ApiPropertyOptional({
description: "Whether inbound access is enabled, subject to each exposed tunnel's access policy",
default: false,
})
@IsOptional()
@IsBoolean()
inboundEnabled?: boolean
@ApiPropertyOptional({
description: "Whether outbound access is enabled; unset follows the organization's limited-egress default",
})
@IsOptional()
@IsBoolean()
outboundEnabled?: boolean
@ApiPropertyOptional({
description: 'Hosts and CIDRs outbound traffic may reach; unset allows every destination',
type: [String],
example: ['api.openai.com', '10.0.0.0/8'],
})
@IsOptional()
@IsArray()
@IsString({ each: true })
outboundAllowNet?: string[]
@ApiPropertyOptional({
description: 'The box class type',
enum: BoxClass,
example: Object.values(BoxClass)[0],
})
@IsOptional()
@IsEnum(BoxClass)
class?: BoxClass
@ApiPropertyOptional({
description: 'The target (region) where the box will be created',
example: 'us',
})
@IsOptional()
@IsString()
target?: string
@ApiPropertyOptional({
description: 'CPU allocation in cores, in increments of 0.001; fractional allocations require Linux',
example: 0.5,
type: 'number',
minimum: 0.125,
maximum: 16,
multipleOf: 0.001,
})
@IsOptional()
@CpuAllocation()
cpu?: number
@ApiPropertyOptional({
description: 'GPU units allocated to the box',
example: 1,
type: 'integer',
})
@IsOptional()
@IsNumber()
gpu?: number
@ApiPropertyOptional({
description: 'Memory allocated to the box in GiB, in whole MiB increments',
example: 1,
type: 'number',
minimum: 0.125,
multipleOf: 1 / 1024,
})
@IsOptional()
@IsNumber()
memory?: number
@ApiPropertyOptional({
description: 'Disk space allocated to the box in GB',
example: 3,
type: 'integer',
})
@IsOptional()
@IsNumber()
disk?: number
@ApiPropertyOptional({
description: 'Auto-stop interval in seconds (0 means disabled, otherwise at least 60)',
example: 900,
type: 'integer',
})
@IsOptional()
@IsInt()
@Min(0)
autoStop?: number
@ApiPropertyOptional({
description: 'Auto-delete interval in seconds (0 means disabled)',
example: 604800,
type: 'integer',
})
@IsOptional()
@IsInt()
@Min(0)
autoDelete?: number
@ApiPropertyOptional({
description: 'Whether the box should be automatically resumed on proxy access',
example: true,
})
@IsOptional()
@IsBoolean()
autoResume?: boolean
@ApiPropertyOptional({
description: 'Array of volumes to attach to the box',
type: [BoxVolume],
required: false,
})
@IsOptional()
@IsArray()
volumes?: BoxVolume[]
@ApiPropertyOptional({
description: 'Secrets injected into outbound HTTPS request headers',
type: [BoxSecret],
required: false,
})
@IsOptional()
@IsArray()
secrets?: (BoxSecret | { secret: string })[]
}