Skip to content

Commit c253a29

Browse files
committed
Update exec.py
1 parent 4a37ca6 commit c253a29

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

  • openhands/runtime/impl/daytona

openhands/runtime/impl/daytona/exec.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
import os
2-
from daytona_sdk import Daytona, DaytonaConfig
2+
from daytona_sdk import CreateSandboxParams, Daytona, DaytonaConfig
33
from dotenv import load_dotenv
44

55
load_dotenv()
66

7-
daytona = Daytona(DaytonaConfig(api_key=os.getenv('DAYTONA_ API_KEY')))
8-
sandbox_id = 'd58beaad-49d3-4bf0-ad0b-3d0cd40dcf3e'
9-
sandbox = daytona.get_current_sandbox(sandbox_id)
7+
daytona = Daytona(DaytonaConfig(api_key=os.getenv('DAYTONA_API_KEY')))
8+
image = 'docker.all-hands.dev/all-hands-ai/runtime:0.40-nikolaik'
9+
image = 'ghcr.io/smartmanoj/kevin-sandbox:oh_v0.40.0_p3hl9v56jrfymbsz_y49eklt66h256yhr'
10+
if 1:
11+
sandbox = daytona.create(
12+
CreateSandboxParams(
13+
image=image,
14+
public=True,
15+
env_vars={
16+
'DEBUG': 'true',
17+
},
18+
)
19+
)
20+
else:
21+
sandbox_id = 'd58beaad-49d3-4bf0-ad0b-3d0cd40dcf3e'
22+
sandbox = daytona.get_current_sandbox(sandbox_id)
1023

1124
def exec_command(command):
12-
while 1:
13-
command = input('Enter command: ')
14-
response = sandbox.process.exec(
15-
command, timeout=10
16-
)
17-
print(response.result)
25+
response = sandbox.process.exec(
26+
command, timeout=10
27+
)
28+
print(response.result)
1829

1930
if __name__ == "__main__":
2031
exec_command('pwd')

0 commit comments

Comments
 (0)