Daemon Toolbox & Process Execution
Relevant source files
The following files were used as context for generating this wiki page:
The Daemon Toolbox is a core component of the Daytona ecosystem, providing a comprehensive set of API endpoints for interacting with isolated sandbox environments. It acts as the bridge between high-level agents or SDKs and the low-level system operations required to manage files, execute code, and control graphical interfaces within a sandbox.
Process Execution within the toolbox allows for both synchronous command execution and long-running managed sessions. This system enables AI agents and developers to install dependencies, run development servers, and execute arbitrary scripts with full access to standard output, error streams, and exit codes.
System Architecture
The Toolbox is integrated into the Daytona Daemon and exposed via a REST API, typically defaulting to port 22221. It is categorized into several functional domains: File System, Process, Git, LSP (Language Server Protocol), and Computer Use.
The architecture facilitates a decoupled interaction model where external tools can programmatically manipulate the sandbox environment.
Sources: libs/toolbox-api-client-python/README.md, libs/computer-use/README.md
Process Execution & Session Management
The Process API supports two primary modes of operation: direct command execution and session-based execution. Sessions are particularly useful for long-running tasks like development servers that need to persist across multiple API calls.
Execution Modes
- Direct Execution: Used for quick, synchronous tasks such as
ls,mkdir, or short scripts. - Persistent Sessions: Allows creating a named session (e.g.,
start-dev-server-cmd) where commands can run asynchronously. This is essential for health monitoring and background services.
Key API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/process/execute | POST | Synchronously execute a command and return results. |
/process/session | POST | Create a new named process session. |
/process/session/{sessionId}/exec | POST | Execute a command within a specific session (supports async). |
/process/session/{sessionId}/command/{commandId}/logs | GET | Retrieve stdout and stderr logs for a session command. |
Sources: libs/toolbox-api-client-python/README.md, guides/typescript/agentkit-inngest/coding-agent/anthropic/src/index.ts:168-190
Session Command Flow
The following diagram illustrates how a development server is started and monitored using the session API.
Computer Use & Graphical Interaction
The Computer Use module provides a specialized process management stack for VNC desktop environments. It allows AI agents to interact with a virtual display using mouse and keyboard events.
Managed GUI Processes
The module automatically manages four critical processes in a specific priority order to ensure a stable VNC environment:
- Xvfb: Virtual framebuffer providing the display. (Priority 100)
- xfce4: The desktop environment. (Priority 200)
- x11vnc: The server exposing the desktop via VNC. (Priority 300)
- novnc: A web-based client for browser access. (Priority 400)
Sources: libs/computer-use/README.md
Interaction Capabilities
The API provides granular control over the virtual desktop:
- Mouse: Click, drag, scroll, and move cursor.
- Keyboard: Type text, press individual keys, or trigger hotkeys.
- Visuals: Take full screenshots or compressed region screenshots.
- Windows: Retrieve information about currently open windows using
wmctrl.
Sources: libs/toolbox-api-client-python/README.md, libs/computer-use/README.md
File System Operations
The Toolbox provides a robust File System API that abstracts complex OS-level file operations into simple REST calls. It supports batch operations to minimize network overhead during project scaffolding.
Core File Operations
- Bulk Upload: Uploading multiple files simultaneously using
Bufferor file paths. - Search and Replace: Searching for files by pattern or replacing specific text across multiple files.
- Metadata: Retrieving file size, permissions (e.g.,
755), and timestamps.
API Summary Table
| Feature | Endpoint | Parameters |
|---|---|---|
| List Files | GET /files | path |
| Bulk Upload | POST /files/bulk-upload | List of {path, content} |
| Replace Text | POST /files/replace | files, pattern, replacement |
| Set Permissions | POST /files/permissions | path, mode |
Sources: libs/toolbox-api-client-python/README.md, guides/typescript/agentkit-inngest/coding-agent/anthropic/src/index.ts:77-110, guides/typescript/mastra/coding-agent/openai/src/mastra/agents/coding-agent.ts:162-175
Development & Build Integration
The Toolbox is built and packaged as part of the Daytona Daemon. The build process involves generating OpenAPI documentation and embedding static assets for the terminal and GUI plugins.
Build Configuration
The apps/daemon/project.json defines how the toolbox related components are prepared:
- OpenAPI Generation: Uses
swagto generateswagger.jsonfrom the Go source files inpkg/toolbox. - Asset Embedding: The
preparetarget executesxterm.goto generate static terminal assets. - Cross-Platform: Specifically builds for
amd64/linuxto ensure compatibility with containerized runners.
Sources: apps/daemon/project.json, apps/runner/project.json
Summary
The Daemon Toolbox provides the fundamental primitives for autonomous software development. By exposing file management, persistent process sessions, and graphical interaction via a unified API, it enables complex workflows such as multi-agent collaboration and automated application scaffolding. Its structured approach to process priority (in Computer Use) and session persistence (in Process Execution) ensures reliability in dynamic sandbox environments.