Skip to content

Commit 89f562f

Browse files
committed
bump e2b and update tool
1 parent 8acee8b commit 89f562f

File tree

3 files changed

+153
-275
lines changed

3 files changed

+153
-275
lines changed
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from e2b import Sandbox
2-
3-
from e2b_code_interpreter import CodeInterpreter
1+
from e2b_code_interpreter import Sandbox
42

53
from astra_assistants.tools.tool_interface import ToolInterface
64

@@ -13,18 +11,16 @@ def __init__(self):
1311
running_sandboxes = Sandbox.list()
1412
# Find the sandbox by metadata
1513
for running_sandbox in running_sandboxes:
16-
sandbox = Sandbox.reconnect(running_sandbox.sandbox_id)
17-
sandbox.close()
14+
sandbox = Sandbox.connect(running_sandbox.sandbox_id)
15+
sandbox.kill()
1816
else:
1917
# Sandbox not found
2018
pass
21-
self.code_interpreter = CodeInterpreter()
19+
self.code_interpreter = Sandbox()
2220

2321
print("initialized")
2422

2523
def call(self, arguments):
2624
code = arguments['arguments']
27-
exec = self.code_interpreter.notebook.exec_cell(
28-
code,
29-
)
30-
return exec.text
25+
execution = self.code_interpreter.run_code(code)
26+
return execution.text

0 commit comments

Comments
 (0)