Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Enable overriding the CodeInterpreter template in JS SDK

Tomas Valentaf60fdb71663b
diff --git a/.changeset/thin-turtles-fry.md b/.changeset/thin-turtles-fry.md
new file mode 100644
index 000000000..8ce31f6ef
--- /dev/null
+++ b/.changeset/thin-turtles-fry.md
@@ -0,0 +1,5 @@
+---
+"@e2b/sdk": patch
+---
+
+Enable overriding template in CodeInterpreter
diff --git a/packages/js-sdk/src/templates/dataAnalysis.ts b/packages/js-sdk/src/templates/dataAnalysis.ts
index 3668cdfb6..f63ca52bc 100644
--- a/packages/js-sdk/src/templates/dataAnalysis.ts
+++ b/packages/js-sdk/src/templates/dataAnalysis.ts
@@ -27,8 +27,8 @@ export class DataAnalysis extends Sandbox {
* @internal
* @access protected
*/
- constructor(opts: Omit<SandboxOpts, 'template'>) {
- super({ template: DataAnalysis.template, ...opts })
+ constructor(opts: SandboxOpts) {
+ super({ template: opts.template || DataAnalysis.template, ...opts })
}
/**
@@ -41,8 +41,8 @@ export class DataAnalysis extends Sandbox {
* @param opts Sandbox options
* @returns New Sandbox
*/
- static override async create(opts: Omit<SandboxOpts, 'template'>): Promise<DataAnalysis>;
- static override async create(opts?: Omit<SandboxOpts, 'template'>) {
+ static override async create(opts: SandboxOpts): Promise<DataAnalysis>;
+ static override async create(opts?: SandboxOpts) {
const sandbox = new DataAnalysis({ ...opts ? opts : {} })
await sandbox._open({ timeout: opts?.timeout })