Skip to content

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

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')

get_deployment

get_deployment() -> AbstractDeployment

DockerDeploymentConfig pydantic-model

Bases: BaseModel

Configuration for running locally in a Docker container.

Config:

  • extra: 'forbid'

Fields:

image pydantic-field

image: str = 'python:3.11'

The name of the docker image to use.

port pydantic-field

port: int | None = None

The port that the docker container connects to. If None, a free port is found.

docker_args pydantic-field

docker_args: list[str] = []

Additional arguments to pass to the docker run command.

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 docker images.

remove_images pydantic-field

remove_images: bool = False

Whether to remove the image after it has stopped.

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')

get_deployment

get_deployment() -> AbstractDeployment

ModalDeploymentConfig pydantic-model

Bases: BaseModel

Configuration for running on Modal.

Config:

  • extra: 'forbid'

Fields:

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 = 1800.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')

get_deployment

get_deployment() -> AbstractDeployment

FargateDeploymentConfig pydantic-model

Bases: BaseModel

Configuration for running on AWS Fargate.

Config:

  • extra: 'forbid'

Fields:

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 = 30

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')

get_deployment

get_deployment() -> AbstractDeployment

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 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')

get_deployment

get_deployment() -> AbstractDeployment

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')

get_deployment

get_deployment() -> AbstractDeployment

get_deployment

get_deployment(config: DeploymentConfig) -> AbstractDeployment