feat: Add Daytona Deployment Support#288
Open
hyoungjun-noh wants to merge 3 commits into
Open
Conversation
added 3 commits
April 15, 2026 11:52
- Add api_url field to DaytonaDeploymentConfig for self-hosted deployments - Switch from sync Daytona to AsyncDaytona client for better async support - Add _poll_command method for async command execution polling - Add _check_server_health method to verify server readiness with auth - Support both cloud (target-based) and self-hosted (api_url-based) modes
Replace RemoteRuntime with DaytonaRuntime to communicate with the swerex server inside Daytona sandboxes. The new implementation uses the Daytona SDK's command execution capabilities instead of HTTP requests via Preview URLs, which bypasses OAuth authentication issues encountered with the previous approach. Changes: - Import and use DaytonaRuntime instead of RemoteRuntime - Create runtime sessions via SDK instead of extracting Preview URLs - Remove preview URL and token handling logic - Add new DaytonaRuntime class that wraps SDK command execution
Remove WIP status from README. Refactor health check and command execution logic in DaytonaDeployment for improved reliability and readability. Add unit tests for DaytonaRuntime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for running SWE-ReX agents in Daytona sandbox environments. Daytona is a sandbox environment platform that provides secure, isolated execution environments for AI agents.
Changes
New Components
DaytonaRuntime(runtime/daytona.py): SDK-based runtime that communicates with the swerex server running inside a Daytona sandbox. Uses the Daytona SDK's command execution capabilities instead of HTTP requests to bypass OAuth authentication issues with Preview URLs.DaytonaDeployment(deployment/daytona.py): Deployment class for creating and managing Daytona sandboxes. Supports both self-hosted Daytona servers and public Daytona cloud.Key Features
execute_session_commandto run commands inside the sandbox, avoiding OAuth authentication issues with Preview URLsapi_urlfor self-hosted ortargetfor Daytona cloudConfiguration
Installation
pip install 'swe-rex[daytona]'Implementation Details
Communication Flow
DaytonaDeploymentcreates a Daytona sandbox from the specified imageDaytonaRuntimewith a separate session for runtime commandsDaytonaRuntimeuses SDK command execution with base64-encoded Python scripts to call swerex API endpointsWhy SDK-based Communication?
Direct HTTP access to the swerex server via Preview URLs encounters OAuth authentication issues. By using the SDK's command execution to run Python scripts inside the sandbox, we can communicate with the swerex server on localhost without going through the OAuth layer.
Testing
Tested with:
Files Changed
src/swerex/runtime/daytona.py- New DaytonaRuntime classsrc/swerex/deployment/daytona.py- New DaytonaDeployment classsrc/swerex/deployment/config.py- Added DaytonaDeploymentConfigpyproject.toml- Added daytona-sdk dependency and [daytona] extraREADME.md- Updated installation instructionsCHANGELOG.md- Added Unreleased section with Daytona supportRelated