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
*/
type AppMode = 'api' | 'worker' | 'all'
let appMode = process.env.APP_MODE as AppMode
// Default to all mode if no app mode is set
if (!appMode) {
appMode = 'all'
}
// Validate app mode
if (!Object.values(['api', 'worker', 'all']).includes(appMode)) {
throw new Error(`Invalid app mode: ${appMode}`)
}
/**
* Returns true if the API should be started
*/
export function isApiEnabled(): boolean {
return appMode === 'api' || appMode === 'all'
}
/**
* Returns true if the worker should be started
*/
export function isWorkerEnabled(): boolean {
return appMode === 'worker' || appMode === 'all'
}
/**
* Returns the component this process reports to telemetry as. `all` runs the
* API and the worker in one process, which reports as the API.
*/
export function getServiceType(): 'api' | 'worker' {
return appMode === 'worker' ? 'worker' : 'api'
}