Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix CLI code snippets
Tomas Valenta71ec17530eeb
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.tsindex 82e71b334..43eb9dbc7 100644--- a/packages/cli/src/commands/template/build.ts+++ b/packages/cli/src/commands/template/build.ts@@ -292,10 +292,7 @@ export const buildCommand = new commander.Command('build')}const template = await requestBuildTemplate(- accessToken,body,- !!config,- relativeConfigPath,templateID,)templateID = template.templateID@@ -374,7 +371,6 @@ export const buildCommand = new commander.Command('build')console.log('Waiting for build to finish...')await waitForBuildFinish(- accessToken,templateID,template.buildID,name,@@ -389,7 +385,6 @@ export const buildCommand = new commander.Command('build'))async function waitForBuildFinish(- accessToken: string,templateID: string,buildID: string,name?: string,@@ -418,32 +413,22 @@ async function waitForBuildFinish()breakcase 'ready': {- const pythonExample = asPython(`from e2b import Sandbox+ const pythonExample = asPython(`from e2b import Sandbox, AsyncSandbox-# Start sandbox+# Create sync sandboxsandbox = Sandbox("${aliases?.length ? aliases[0] : template.templateID}")-# Interact with sandbox. Learn more here:-# https://e2b.dev/docs/sandbox/overview--# Kill sandbox once done-sandbox.kill()`)+# Create async sandbox+sandbox = await AsyncSandbox.create("${aliases?.length ? aliases[0] : template.templateID}")`)const typescriptExample = asTypescript(`import { Sandbox } from 'e2b'-// Start sandbox-const sandbox = await Sandbox.create('${aliases?.length ? aliases[0] : template.templateID}')--// Interact with sandbox. Learn more here:-// https://e2b.dev/docs/sandbox/overview--// Kill sandbox once done-await sandbox.kill()`)+// Create sandbox+const sandbox = await Sandbox.create('${aliases?.length ? aliases[0] : template.templateID}')`)- const examplesMessage = `You can use E2B Python or JS SDK to create sandboxes now.-Find more here - ${asPrimary(- 'https://e2b.dev/docs/guide/custom-sandbox',- )} in ${asBold('Create and control your sandbox')} section.`+ const examplesMessage = `You can now use the template to create custom sandboxes.\nLearn more on ${asPrimary(+ 'https://e2b.dev/docs',+ )}`const exampleHeader = boxen.default(examplesMessage, {padding: {@@ -561,10 +546,7 @@ function getDockerfile(root: string, file?: string) {}async function requestBuildTemplate(- accessToken: string,args: e2b.paths['/templates']['post']['requestBody']['content']['application/json'],- hasConfig: boolean,- configPath: string,templateID?: string,): Promise<Omit<diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.tsindex 84fec54df..dc7cbe02a 100644--- a/packages/cli/src/config/index.ts+++ b/packages/cli/src/config/index.ts@@ -10,19 +10,17 @@ export const configName = 'e2b.toml'function getConfigHeader(config: E2BConfig) {return `# This is a config for E2B sandbox template.-# You can use 'template_id' (${config.template_id}) ${- config.template_name ? `or 'template_name (${config.template_name}) ` : ''- }from this config to spawn a sandbox:+# You can use template ID (${config.template_id}) ${config.template_name ? `or template name (${config.template_name}) ` : ''+ }to create a sandbox:# Python SDK-# from e2b import Sandbox-# sandbox = Sandbox(template='${config.template_name || config.template_id}')+# from e2b import Sandbox, AsyncSandbox+# sandbox = Sandbox("${config.template_name || config.template_id}") # Sync sandbox+# sandbox = await AsyncSandbox.create("${config.template_name || config.template_id}") # Async sandbox# JS SDK# import { Sandbox } from 'e2b'-# const sandbox = await Sandbox.create({ template: '${- config.template_name || config.template_id- }' })+# const sandbox = await Sandbox.create('${config.template_name || config.template_id}')`}