Daytona Client for Rust
A Rust client library for the Daytona API, providing secure sandbox environments for code execution and development.
Status
This project is under active development and not yet ready for production use.
Current Features
- ✅ Sandboxes: Create, list, get, delete, start, stop, archive operations
- ✅ Workspaces: Full workspace lifecycle management
- ✅ Basic Process Execution: Execute commands in sandboxes
- ✅ Session Management: Create and manage persistent command sessions
- ✅ File Operations: Basic upload via bulk-upload endpoint
- 🚧 Git Operations: Basic clone, status, commit functionality (partial)
- ✅ Type Safety: Strongly typed models with comprehensive error handling
Known Issues & Limitations
- ⚠️ File API: Upload works but some endpoints have routing issues
- ⚠️ Git API: Limited functionality, some endpoints not fully implemented
- ⚠️ Process Execution: Environment variables and working directory support incomplete
- ⚠️ Code Execution: Language-specific execution helpers need refinement
- ❌ WebSockets: Real-time connections not yet implemented
- ❌ LSP Support: Language server protocol integration not implemented
Installation
Add this to your Cargo.toml:
[]
= "0.2"
Quick Start
use ;
async
Environment Variables
The client can be configured using environment variables:
DAYTONA_API_KEY— Daytona API key (required)DAYTONA_BASE_URL— API base URL (default:https://app.daytona.io/api)DAYTONA_ORGANIZATION_ID— Organization ID for multi-org accounts (optional)
Implementation Status
API Endpoints
- ✅ Sandbox Management: Create, list, get, delete, start, stop, archive
- ✅ Workspace Management: Create, list, get, delete, start, stop, archive
- ✅ Process Execution: Execute commands, session management
- 🚧 File Operations: Basic upload via bulk-upload endpoint (some routing issues)
- 🚧 Git Operations: Basic clone, status, commit (limited functionality)
- ❌ Organization Management: Not yet implemented
- ❌ Port Forwarding: Not yet implemented
- ❌ WebSocket Connections: Not yet implemented
- ❌ LSP Integration: Not yet implemented
Testing Status
- ✅ Sandbox Integration Tests: Comprehensive lifecycle testing
- ✅ Workspace Integration Tests: Full workflow testing
- ✅ Process Integration Tests: Command execution testing
- ✅ Session Integration Tests: Persistent session testing
- 🚧 File Integration Tests: Currently disabled due to API routing bugs
- 🚧 Git Integration Tests: Currently disabled due to API issues
Examples
Basic Sandbox Operations
use ;
async
File Upload
// Upload a file
client.files
.upload
.await?;
Session Management
use SessionExecuteRequest;
// Create a persistent session
let session_id = "my-session";
client.process
.create_session
.await?;
// Execute commands in the session
let response = client.process
.execute_session_command
.await?;
println!;
Workspace Management
use ;
// Create a workspace
let workspace = client.workspaces
.create
.await?;
// Wait for it to start
let workspace = client.workspaces
.wait_for_state
.await?;
println!;
Error Handling
The client provides comprehensive error types:
use ;
match client.sandboxes.create.await
Testing
Prerequisites
Set your Daytona API key:
Running Tests
Tests that create sandboxes are automatically run sequentially using the serial_test crate to avoid exceeding Daytona's 30GB quota limit:
# Run all tests (resource-intensive tests run sequentially)
# Run specific test suites
Note: File and Git integration tests are currently disabled due to an API routing bug.
Cleanup Utilities
If tests fail or are interrupted, sandboxes may not be cleaned up. Use the provided utilities:
# Check current resource usage
# Clean up test sandboxes only (safer)
# Force cleanup all resources (interactive)
Contributing
Contributions are welcome. Please feel free to submit a Pull Request.
License
This project is licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at the option of the licensee.
Acknowledgments
This client is not officially affiliated with Daytona. For official SDKs, visit Daytona's documentation.