High-Level Architecture
Relevant source files
The following files were used as context for generating this wiki page:
Daytona is an open-source, secure, and elastic infrastructure designed for managing and running AI-generated code within isolated environments known as Sandboxes. The architecture is built to provide programmatically manageable, fully composable computers that support a wide range of development operations including file system management, process execution, and Language Server Protocol (LSP) integration.
The system follows a distributed model where a centralized API (orchestrated through the Daytona Dashboard or SDKs) interacts with specialized components like the Runner and the Daemon to lifecycle-manage isolated environments. These environments are used to execute code securely, monitor development workflows, and facilitate multi-agent AI systems.
Sources: libs/sdk-typescript/README.md:3-8, guides/typescript/anthropic/multi-agent-claude-sdk/README.md:5-12
Core Components
The architecture consists of several key layers that handle everything from user authentication to low-level process execution inside isolated containers.
Component Overview
| Component | Description | Primary Responsibility |
|---|---|---|
| SDK (TS/Python/Go) | Official libraries for programmatic access. | Sandbox management and automation. |
| API Server | Central gateway for all Daytona services. | Orchestration, authentication, and state management. |
| Runner | Host-side management service. | Managing the lifecycle of sandboxes on specific compute nodes. |
| Daemon | In-sandbox agent. | Executing commands and managing the internal sandbox state. |
| Toolbox | Auxiliary utility set. | Provides specialized tools for file operations and info retrieval. |
Sources: libs/api-client/src/api.ts:20-40, apps/runner/project.json:1-20, apps/daemon/project.json:1-15
The Runner and Daemon Relationship
The Runner acts as the host-level manager. It is responsible for building and deploying the Daemon binary into the sandbox environments. Specifically, the Runner build process includes a step to copy the daemon-amd64 binary into its own static assets to ensure that every sandbox it starts is equipped with the correct version of the internal agent.
The Daemon runs inside the sandbox (often a Linux-based environment) and exposes an API for the Runner and SDKs to interact with. It manages terminal sessions, file systems, and local process execution.
Sources: apps/runner/project.json:10-18, apps/daemon/cmd/daemon/main.go
Sandbox Lifecycle and Data Flow
Sandboxes are the primary unit of compute in Daytona. They can be created with specific resource constraints (CPU, memory, disk) or derived from existing snapshots.
Sandbox Creation Flow
The following diagram illustrates the sequence of creating a sandbox and executing code within it using the TypeScript SDK.
Development Workflows
Daytona supports advanced workflows such as "Ephemeral Sandboxes" which are automatically deleted after a specified interval or when stopped. It also integrates with Language Servers to provide IDE-like capabilities (completions, symbols) directly to AI agents or remote developers.
Sources: libs/sdk-typescript/README.md:71-80, libs/sdk-typescript/README.md:126-145
Multi-Agent Architecture
Daytona enables hierarchical agent structures where different components operate in different security contexts. In a typical two-agent system, a high-level "Project Manager" coordinates tasks while a "Developer Agent" performs the actual work inside a secured Daytona sandbox.
This separation ensures that potentially dangerous AI-generated code is confined to the sandbox while the orchestrating agent remains on a trusted host.
Sources: guides/typescript/anthropic/multi-agent-claude-sdk/README.md:38-55
Build and Packaging System
The project uses Nx to manage a monorepo containing Go (Runner, Daemon), TypeScript (Dashboard, SDK), and Python/Ruby SDKs.
Build Targets
| Target | Description | Output |
|---|---|---|
build-amd64 | Cross-compiles for Linux/amd64. | dist/apps/daemon-amd64, dist/apps/runner-amd64 |
copy-daemon-bin | Static asset injection. | Injects Daemon into Runner static pkg. |
package-deb | Creates Debian packages. | .deb installer for systemd integration. |
openapi | Generates Swagger/OpenAPI specs. | swagger.json for API clients. |
Sources: apps/runner/project.json:30-100, apps/daemon/project.json:20-60, nx.json
Summary
The Daytona high-level architecture is a robust, container-orchestrated platform designed for the AI era. By decoupling the management plane (API/SDK) from the execution plane (Runner/Daemon), it provides a secure environment for executing untrusted code while maintaining high-performance features like LSP support and real-time process monitoring. The use of specialized binaries for different architectures and the integration of a toolbox for filesystem operations ensure that Daytona sandboxes act as full-featured, programmatically controlled development environments.