Deployment configuration objects
These configuration objects can be used to configure deployments.
For example:
from swerex.deployment.config import DockerDeploymentConfig
config = DockerDeploymentConfig(image="python:3.11")
deployment = config.get_deployment()
DeploymentConfig
module-attribute
DeploymentConfig = LocalDeploymentConfig | DockerDeploymentConfig | ModalDeploymentConfig | FargateDeploymentConfig | RemoteDeploymentConfig | DummyDeploymentConfig | DaytonaDeploymentConfig
Union of all deployment configurations. Useful for type hints.
LocalDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running locally.
Config:
extra:forbid
Fields:
-
type(Literal['local'])
type
pydantic-field
type: Literal['local'] = 'local'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
DockerDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running locally in a Docker or Podman container.
Config:
extra:forbid
Fields:
-
image(str) -
port(int | None) -
docker_args(list[str]) -
startup_timeout(float) -
pull(Literal['never', 'always', 'missing']) -
remove_images(bool) -
python_standalone_dir(str | None) -
platform(str | None) -
remove_container(bool) -
container_runtime(Literal['docker', 'podman']) -
exec_shell(list[str]) -
docker_internal_host(str) -
type(Literal['docker'])
Validators:
image
pydantic-field
image: str = 'python:3.11'
The name of the container image to use.
port
pydantic-field
port: int | None = None
The port that the container connects to. If None, a free port is found.
docker_args
pydantic-field
docker_args: list[str] = []
Additional arguments to pass to the container run command. If --platform is specified here, it will be moved to the platform field.
startup_timeout
pydantic-field
startup_timeout: float = 180.0
The time to wait for the runtime to start.
pull
pydantic-field
pull: Literal['never', 'always', 'missing'] = 'missing'
When to pull container images.
remove_images
pydantic-field
remove_images: bool = False
Whether to remove the image after it has stopped.
python_standalone_dir
pydantic-field
python_standalone_dir: str | None = None
The directory to use for the python standalone.
platform
pydantic-field
platform: str | None = None
The platform to use for the container image.
remove_container
pydantic-field
remove_container: bool = True
Whether to remove the container after it has stopped.
container_runtime
pydantic-field
container_runtime: Literal['docker', 'podman'] = 'docker'
The container runtime to use (docker or podman).
exec_shell
pydantic-field
exec_shell: list[str] = ['/bin/sh', '-c']
The shell executable and arguments to use for running commands.
docker_internal_host
pydantic-field
docker_internal_host: str = 'http://127.0.0.1'
The host to use for connecting to the runtime. In most cases you can leave this as-is, however for docker-in-docker setups you might have to set it to http://host.docker.internal/ (see https://github.com/SWE-agent/SWE-ReX/issues/253 for more information).
type
pydantic-field
type: Literal['docker'] = 'docker'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
validate_platform_args
pydantic-validator
validate_platform_args(data: dict) -> dict
ModalDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running on Modal.
Config:
extra:forbid
Fields:
-
image(str | PurePath) -
startup_timeout(float) -
runtime_timeout(float) -
deployment_timeout(float) -
modal_sandbox_kwargs(dict[str, Any]) -
type(Literal['modal']) -
install_pipx(bool)
image
pydantic-field
image: str | PurePath = 'python:3.11'
Image to use for the deployment.
startup_timeout
pydantic-field
startup_timeout: float = 180.0
The time to wait for the runtime to start.
runtime_timeout
pydantic-field
runtime_timeout: float = 60.0
Runtime timeout (default timeout for all runtime requests)
deployment_timeout
pydantic-field
deployment_timeout: float = 3600.0
Kill deployment after this many seconds no matter what. This is a useful killing switch to ensure that you don't spend too much money on modal.
modal_sandbox_kwargs
pydantic-field
modal_sandbox_kwargs: dict[str, Any] = {}
Additional arguments to pass to modal.Sandbox.create
type
pydantic-field
type: Literal['modal'] = 'modal'
Discriminator for (de)serialization/CLI. Do not change.
install_pipx
pydantic-field
install_pipx: bool = True
Whether to install pipx with apt in the container. This is enabled by default so we can fall back to installing swe-rex with pipx if the image does not have it. However, depending on your image, installing pipx might fail (or be slow).
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
FargateDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running on AWS Fargate.
Config:
extra:forbid
Fields:
-
image(str) -
port(int) -
cluster_name(str) -
execution_role_prefix(str) -
task_definition_prefix(str) -
log_group(str | None) -
security_group_prefix(str) -
fargate_args(dict[str, str]) -
container_timeout(float) -
runtime_timeout(float) -
type(Literal['fargate'])
image
pydantic-field
image: str = 'python:3.11'
port
pydantic-field
port: int = 8880
cluster_name
pydantic-field
cluster_name: str = 'swe-rex-cluster'
execution_role_prefix
pydantic-field
execution_role_prefix: str = 'swe-rex-execution-role'
task_definition_prefix
pydantic-field
task_definition_prefix: str = 'swe-rex-task'
log_group
pydantic-field
log_group: str | None = '/ecs/swe-rex-deployment'
security_group_prefix
pydantic-field
security_group_prefix: str = 'swe-rex-deployment-sg'
fargate_args
pydantic-field
fargate_args: dict[str, str] = {}
container_timeout
pydantic-field
container_timeout: float = 60 * 15
runtime_timeout
pydantic-field
runtime_timeout: float = 60
type
pydantic-field
type: Literal['fargate'] = 'fargate'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
RemoteDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for RemoteDeployment, a wrapper around RemoteRuntime that can be used to connect to any
swerex server.
Config:
extra:forbid
Fields:
-
auth_token(str) -
host(str) -
port(int | None) -
timeout(float) -
type(Literal['remote'])
auth_token
pydantic-field
auth_token: str
The token to use for authentication.
host
pydantic-field
host: str = 'http://127.0.0.1'
The host to connect to.
port
pydantic-field
port: int | None = None
The port to connect to.
timeout
pydantic-field
timeout: float = 0.15
type
pydantic-field
type: Literal['remote'] = 'remote'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
DummyDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for DummyDeployment, a deployment that is used for testing.
Config:
extra:forbid
Fields:
-
type(Literal['dummy'])
type
pydantic-field
type: Literal['dummy'] = 'dummy'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
DaytonaDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for Daytona deployment.
Fields:
-
api_key(str) -
target(str) -
port(int) -
container_timeout(float) -
runtime_timeout(float) -
image(str)
api_key
pydantic-field
api_key: str = ''
Daytona API key for authentication
target
pydantic-field
target: str = 'us'
Daytona target region (us, eu, etc.)
port
pydantic-field
port: int = 8000
Port to expose for the SWE Rex server
container_timeout
pydantic-field
container_timeout: float = 60 * 15
Timeout for the container
runtime_timeout
pydantic-field
runtime_timeout: float = 60
Timeout for the runtime
image
pydantic-field
image: str = 'python:3.11'
Image to use for the sandbox