mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Agent server image from env (#12003)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
parent
d772dd65a5
commit
d57880f849
@ -14,9 +14,9 @@ from openhands.app_server.sandbox.sandbox_spec_models import (
|
||||
SandboxSpecInfo,
|
||||
)
|
||||
from openhands.app_server.sandbox.sandbox_spec_service import (
|
||||
AGENT_SERVER_IMAGE,
|
||||
SandboxSpecService,
|
||||
SandboxSpecServiceInjector,
|
||||
get_default_agent_server_image,
|
||||
)
|
||||
from openhands.app_server.services.injector import InjectorState
|
||||
|
||||
@ -34,7 +34,7 @@ def get_docker_client() -> docker.DockerClient:
|
||||
def get_default_sandbox_specs():
|
||||
return [
|
||||
SandboxSpecInfo(
|
||||
id=AGENT_SERVER_IMAGE,
|
||||
id=get_default_agent_server_image(),
|
||||
command=['--port', '8000'],
|
||||
initial_env={
|
||||
'OPENVSCODE_SERVER_ROOT': '/openhands/.openvscode-server',
|
||||
|
||||
@ -10,9 +10,9 @@ from openhands.app_server.sandbox.sandbox_spec_models import (
|
||||
SandboxSpecInfo,
|
||||
)
|
||||
from openhands.app_server.sandbox.sandbox_spec_service import (
|
||||
AGENT_SERVER_IMAGE,
|
||||
SandboxSpecService,
|
||||
SandboxSpecServiceInjector,
|
||||
get_default_agent_server_image,
|
||||
)
|
||||
from openhands.app_server.services.injector import InjectorState
|
||||
|
||||
@ -20,7 +20,7 @@ from openhands.app_server.services.injector import InjectorState
|
||||
def get_default_sandbox_specs():
|
||||
return [
|
||||
SandboxSpecInfo(
|
||||
id=AGENT_SERVER_IMAGE,
|
||||
id=get_default_agent_server_image(),
|
||||
command=['python', '-m', 'openhands.agent_server'],
|
||||
initial_env={
|
||||
# VSCode disabled for now
|
||||
|
||||
@ -10,9 +10,9 @@ from openhands.app_server.sandbox.sandbox_spec_models import (
|
||||
SandboxSpecInfo,
|
||||
)
|
||||
from openhands.app_server.sandbox.sandbox_spec_service import (
|
||||
AGENT_SERVER_IMAGE,
|
||||
SandboxSpecService,
|
||||
SandboxSpecServiceInjector,
|
||||
get_default_agent_server_image,
|
||||
)
|
||||
from openhands.app_server.services.injector import InjectorState
|
||||
|
||||
@ -20,7 +20,7 @@ from openhands.app_server.services.injector import InjectorState
|
||||
def get_default_sandbox_specs():
|
||||
return [
|
||||
SandboxSpecInfo(
|
||||
id=AGENT_SERVER_IMAGE,
|
||||
id=get_default_agent_server_image(),
|
||||
command=['/usr/local/bin/openhands-agent-server', '--port', '60000'],
|
||||
initial_env={
|
||||
'OPENVSCODE_SERVER_ROOT': '/openhands/.openvscode-server',
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import os
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from openhands.app_server.errors import SandboxError
|
||||
@ -57,3 +58,11 @@ class SandboxSpecServiceInjector(
|
||||
DiscriminatedUnionMixin, Injector[SandboxSpecService], ABC
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
def get_default_agent_server_image():
|
||||
agent_server_image_repository = os.getenv('AGENT_SERVER_IMAGE_REPOSITORY')
|
||||
agent_server_image_tag = os.getenv('AGENT_SERVER_IMAGE_TAG')
|
||||
if agent_server_image_repository and agent_server_image_tag:
|
||||
return f'{agent_server_image_repository}:{agent_server_image_tag}'
|
||||
return AGENT_SERVER_IMAGE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user