Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create and manage persistent code execution contexts.
ctx = sandbox.code_interpreter.create_code_context( cwd="/workspace", language="python", )
sandbox.code_interpreter.run_code("value = 10", context=ctx) result = sandbox.code_interpreter.run_code("value * 2", context=ctx) print(result.results[0].text)
contexts = sandbox.code_interpreter.list_code_contexts() for item in contexts: print(item.id, item.language, item.cwd) sandbox.code_interpreter.restart_code_context(ctx) sandbox.code_interpreter.remove_code_context(ctx)
sandbox.code_interpreter.interrupt_code_context(ctx)