Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
document E2B_SANDBOX env var
0div1c12bf8130f6
diff --git a/apps/web/src/app/(docs)/docs/sandbox/environment-variables/page.mdx b/apps/web/src/app/(docs)/docs/sandbox/environment-variables/page.mdxindex 3b303f184..be4e7049f 100644--- a/apps/web/src/app/(docs)/docs/sandbox/environment-variables/page.mdx+++ b/apps/web/src/app/(docs)/docs/sandbox/environment-variables/page.mdx@@ -82,4 +82,21 @@ sandbox.commands.run(} # $HighlightLine)```-</CodeGroup>\ No newline at end of file+</CodeGroup>++## Knowing if you are inside a sandbox++<Note>+Sometimes it's useful to know if you are inside a sandbox. Upon creating a sandbox, an environment variable `E2B_SANDBOX` is set to `true`.+</Note>++<CodeGroup>+```js+const sandbox = await Sandbox.create()+const result = await sandbox.commands.run('echo $E2B_SANDBOX')+```+```python+sandbox = Sandbox()+result = sandbox.run_code("import os; os.getenv('E2B_SANDBOX')")+```+</CodeGroup>