Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Merge branch 'main' into id-template
Tomas Valentab3ef45394851
diff --cc packages/js-sdk/src/sandbox/index.tsindex 879e5aae0,bcfb12066..2f4bd38eb--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@@ -490,17 -477,12 +477,12 @@@ export class Sandbox extends SandboxCon* ```*/static async create(opts: SandboxOpts): Promise<Sandbox>;- static async create(optsOrID?: string | SandboxOpts) {- const opts = typeof optsOrID === 'string' ? { id: optsOrID } : optsOrID+ static async create(optsOrTemplate?: string | SandboxOpts) {- const opts = typeof optsOrTemplate === 'string' ? { template: optsOrTemplate } : optsOrTemplate- return new Sandbox(opts)- ._open({ timeout: opts?.timeout })- .then(async (sandbox) => {- if (opts?.cwd) {- console.log(`Custom cwd for Sandbox set: "${opts.cwd}"`)- await sandbox.filesystem.makeDir(opts.cwd)- }- return sandbox- })++ const opts: SandboxOpts | undefined = typeof optsOrTemplate === 'string' ? { template: optsOrTemplate } : optsOrTemplate+ const sandbox = new Sandbox(opts)+ await sandbox._open({ timeout: opts?.timeout })++ return sandbox}/**diff --cc packages/js-sdk/src/templates/dataAnalysis.tsindex 18859e11f,df36ed6ef..998ee295d--- a/packages/js-sdk/src/templates/dataAnalysis.ts+++ b/packages/js-sdk/src/templates/dataAnalysis.ts@@@ -28,16 -28,11 +28,11 @@@ export class DataAnalysis extends Sandb}static override async create(): Promise<DataAnalysis>;- static override async create(opts?: Omit<SandboxOpts, 'id'>) {+ static override async create(opts?: Omit<SandboxOpts, 'template'>) {- return new DataAnalysis({ ...opts })- ._open({ timeout: opts?.timeout })- .then(async (sandbox) => {- if (opts?.cwd) {- console.log(`Custom cwd for Sandbox set: "${opts.cwd}"`)- await sandbox.filesystem.makeDir(opts.cwd)- }- return sandbox- })+ const sandbox = new DataAnalysis({ ...opts })+ await sandbox._open({ timeout: opts?.timeout })++ return sandbox}async runPython(code: string, opts: RunPythonOpts = {}) {diff --cc packages/python-sdk/e2b/sandbox/main.pyindex 7b61fed30,d94dc01fb..15f226ce2--- a/packages/python-sdk/e2b/sandbox/main.py+++ b/packages/python-sdk/e2b/sandbox/main.py@@@ -213,12 -212,13 +222,13 @@@ class Sandbox(SandboxConnection):param timeout: Specify the duration, in seconds to give the method to finish its execution before it times out (default is 60 seconds). If set to None, the method will continue to wait until it completes, regardless of time"""- logger.info(f"Opening sandbox {self._id}")+ logger.info(f"Opening sandbox {self._template}")super()._open(timeout=timeout)self._code_snippet._subscribe()- logger.info(f"Sandbox {self._id} opened")+ logger.info(f"Sandbox {self._template} opened")if self.cwd:self.filesystem.make_dir(self.cwd)+ self._handle_start_cmd_logs()def _close_services(self):self._terminal._close()