Skip to content

Commit

Permalink
add config for mount_docker_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Feb 6, 2025
1 parent 7e169cc commit a97bd3c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
7 changes: 6 additions & 1 deletion openhands/core/config/app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class AppConfig(BaseModel):
"""Configuration for the app.
Attributes:
# custom configs
mount_docker_socket: Whether to mount the docker socket.
# original configs
llms: Dictionary mapping LLM names to their configurations.
The default configuration is stored under the 'llm' key.
agents: Dictionary mapping agent names to their configurations.
Expand Down Expand Up @@ -53,8 +57,9 @@ class AppConfig(BaseModel):
"""
# custom configs
workspace_base: str | None = './workspace'
mount_docker_socket: bool = Field(default=True)

# litellm configs
# original configs
llms: dict[str, LLMConfig] = Field(default_factory=dict)
agents: dict = Field(default_factory=dict)
default_agent: str = Field(default=OH_DEFAULT_AGENT)
Expand Down
4 changes: 2 additions & 2 deletions openhands/core/config/llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LLMConfig(BaseModel):
enable_cache: Whether to enable caching.
seed: The seed to use for the LLM.
# litellm configs
# original configs
model: The model to use.
api_key: The API key to use.
base_url: The base URL for the API. This is necessary for local LLMs. It is also used for Azure embeddings.
Expand Down Expand Up @@ -59,7 +59,7 @@ class LLMConfig(BaseModel):
enable_cache: bool = False
seed: int | None = 42

# litellm configs
# original configs
model: str = Field(default='claude-3-5-sonnet-20241022')
api_key: SecretStr | None = Field(default=None)
base_url: str | None = Field(default=None)
Expand Down
11 changes: 6 additions & 5 deletions openhands/runtime/impl/docker/docker_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,12 @@ def _init_container(self):
'mode': 'rw',
}
}
# mount sock
volumes['/var/run/docker.sock'] = {
'bind': '/var/run/docker.sock',
'mode': 'rw',
}
if self.config.mount_docker_socket:
# mount sock
volumes['/var/run/docker.sock'] = {
'bind': '/var/run/docker.sock',
'mode': 'rw',
}
logger.debug(f'Mount dir: {self.config.workspace_mount_path}')
else:
logger.debug(
Expand Down

0 comments on commit a97bd3c

Please sign in to comment.