Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
update docs
Vasek Mlejnsky7fc61d17ce2f
diff --git a/apps/docs/src/app/sandbox/templates/premade/page.mdx b/apps/docs/src/app/sandbox/templates/premade/page.mdxindex 80c1fd416..3fee317a2 100644--- a/apps/docs/src/app/sandbox/templates/premade/page.mdx+++ b/apps/docs/src/app/sandbox/templates/premade/page.mdx@@ -66,62 +66,120 @@ You can use all the regular [Sandbox API](/api/envs) inside the Code Interpreter```js {{ language: 'js' }}import { DataAnalysis } from '@e2b/sdk'const sandbox = await DataAnalysis.create()++// Close sandbox once you're done+await sandbox.close()``````python {{ language: 'python' }}from e2b import DataAnalysissandbox = DataAnalysis()++# Close sandbox once you're done+sandbox.close()```</CodeGroup>- **Run Python code**<CodeGroup isRunnable={false}>```js {{ language: 'js' }}+import { DataAnalysis } from '@e2b/sdk'++// 1. Create sandbox+const sandbox = await DataAnalysis.create()++// 2. Get code that was generated by LLM and run itconst llmGeneratedPythonCode = 'print("Hello World")'- // `artifacts` are chart files created by matplotlib-const { stdout, stderr, artifacts } = await DataAnalysis.runPython(llmGeneratedPythonCode)+// `artifacts` are chart files created by matplotlib+const { stdout, stderr, artifacts } = await sandbox.runPython(llmGeneratedPythonCode)-// Retrieve chart files:+// 3. Retrieve chart files:for (const artifact of artifacts) {- const downloadedChart = await artifact.download()// Now you can save this file, send it to frontend, or anything else+ const downloadedChart = await artifact.download()}++// 4. Close sandbox+await sandbox.close``````python {{ language: 'python' }}-// Now you can save this file, send it to frontend, or anything else-const downloadedChart = await artifact.download()+from e2b import DataAnalysis+# 1. Create sandbox+sandbox = DataAnalysis()-await sandbox.close()-```-```python {{ language: 'python' }}+# 2. Get code that was generated by LLM and run itllm_generated_python_code = 'print("Hello World")'-stdout, stderr, artifacts = DataAnalysis.run_python(llm_generated_python_code)+# `artifacts` are chart files created by matplotlib+stdout, stderr, artifacts = sandbox.run_python(llm_generated_python_code)++# 3. Retrieve chart files:+for artifact in artifacts:+ # Now you can save this file, send it to frontend, or anything else+ downloaded_chart = artifact.download()++# 4. Close sandboxsandbox.close()```</CodeGroup>- **Install Python packages**++Installs Python packages using `pip`.<CodeGroup isRunnable={false}>```js {{ language: 'js' }}-await DataAnalysis.installPythonPackages('s3transfer')+import { DataAnalysis } from '@e2b/sdk'++// 1. Create sandbox+const sandbox = await DataAnalysis.create()++// 2. Install Python package+await DataAnalysis.installPythonPackages('ffmpeg')++// 3. Close sandboxawait sandbox.close()``````python {{ language: 'python' }}-sandbox = DataAnalysis.install_python_packages('s3transfer')+from e2b import DataAnalysis++# 1. Create sandbox+sandbox = DataAnalysis()++# 2. Install Python package+sandbox.install_python_packages('ffmpeg')++# 3. Close sandboxsandbox.close()```</CodeGroup>- **Install system packages**++Installs system packages using `apt-get`.<CodeGroup isRunnable={false}>```js {{ language: 'js' }}+import { DataAnalysis } from '@e2b/sdk'++// 1. Create sandbox+const sandbox = await DataAnalysis.create()++// 2. Install system packageawait DataAnalysis.installSystemPackages('ffmpeg')++// 3. Close sandboxawait sandbox.close()``````python {{ language: 'python' }}-sandbox = DataAnalysis.install_system_packages('ffmpeg')+from e2b import DataAnalysis++# 1. Create sandbox+sandbox = DataAnalysis()++# 2. Install system package+sandbox.install_system_packages('ffmpeg')++# 3. Close sandboxsandbox.close()```</CodeGroup>