File tree Expand file tree Collapse file tree 3 files changed +153
-275
lines changed Expand file tree Collapse file tree 3 files changed +153
-275
lines changed Original file line number Diff line number Diff line change 1
- from e2b import Sandbox
2
-
3
- from e2b_code_interpreter import CodeInterpreter
1
+ from e2b_code_interpreter import Sandbox
4
2
5
3
from astra_assistants .tools .tool_interface import ToolInterface
6
4
@@ -13,18 +11,16 @@ def __init__(self):
13
11
running_sandboxes = Sandbox .list ()
14
12
# Find the sandbox by metadata
15
13
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 ()
18
16
else :
19
17
# Sandbox not found
20
18
pass
21
- self .code_interpreter = CodeInterpreter ()
19
+ self .code_interpreter = Sandbox ()
22
20
23
21
print ("initialized" )
24
22
25
23
def call (self , arguments ):
26
24
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
You can’t perform that action at this time.
0 commit comments