Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Update vercel proxy setup; Merge latest docs changes

Tomas Valentac23a5f67945b
diff --git a/apps/docs/src/app/getting-started/basic-usage/page.mdx b/apps/docs/src/app/getting-started/basics/page.mdx
similarity index 99%
rename from apps/docs/src/app/getting-started/basic-usage/page.mdx
rename to apps/docs/src/app/getting-started/basics/page.mdx
index 11a5b1f79..768b83e18 100644
--- a/apps/docs/src/app/getting-started/basic-usage/page.mdx
+++ b/apps/docs/src/app/getting-started/basics/page.mdx
@@ -3,6 +3,7 @@ export const metadata = {
description: 'SDK Usage',
}
+
# Basic Usage
Following code snippets should get you going fast with our SDK.
diff --git a/apps/docs/src/app/getting-started/installation/page.mdx b/apps/docs/src/app/getting-started/installation/page.mdx
index fbd75c346..b340bda6d 100644
--- a/apps/docs/src/app/getting-started/installation/page.mdx
+++ b/apps/docs/src/app/getting-started/installation/page.mdx
@@ -9,7 +9,7 @@ We offer SDKs for **JavaScript**, **TypeScript**, and **Python**. The SDKs are r
You can install them using the following commands:
<CodeGroup>
-```bash {{ language: 'js', title: 'JavaScript & TypeScript' }}
+```bash {{ language: 'js', title: 'JavaScript/TypeScript' }}
npm install @e2b/sdk
```
@@ -18,4 +18,4 @@ pip install e2b
```
</CodeGroup>
-Once installed head over to the [Basic Usage](/getting-started/basic-usage) section.
+Once installed head over to the [Basics](/getting-started/basics) or [Examples](/examples/overview) section. {{ className: 'lead' }}
diff --git a/apps/docs/src/app/page.mdx b/apps/docs/src/app/page.mdx
index 2fd9dfad0..9a3341dc5 100644
--- a/apps/docs/src/app/page.mdx
+++ b/apps/docs/src/app/page.mdx
@@ -1,8 +1,6 @@
import { Guides } from '@/components/Guides'
import { UseCases } from '@/components/UseCases'
import { HeroPattern } from '@/components/HeroPattern'
-import { Code } from '@/components/Code'
-
export const metadata = {
title: 'E2B Documentation',
@@ -21,9 +19,8 @@ export const sections = [
**E2B is a cloud operating system for AI agents.**{{ className: 'lead' }}
-With a single line of our SDK, you can give your AI agent a sandboxed cloud environment where your agent can do any of the following:
-- Run any code
-- Run any terminal command
+With a single line of our SDK, you can give your AI agent a sandboxed cloud environment where your agent can do any of the following (and more):
+- Run any code and terminal command in a sandboxed environment
- Install dependencies and programs
- Use filesystem
- Upload and download files
@@ -34,7 +31,7 @@ With a single line of our SDK, you can give your AI agent a sandboxed cloud envi
This just a few examples of what can be done with our agent cloud environments.
-Our SDK works with any AI agent (no matter what framework, you're using), and without the need to manage any infrastructure.
+Our SDK works with any AI agent (no matter what framework you're using), and without the need to manage any infrastructure.
<div className="not-prose mb-16 mt-6 flex gap-3">
<Button href="/getting-started/installation" arrow="right" children="Getting Started" />
diff --git a/apps/docs/src/code/python/fs_ls.py b/apps/docs/src/code/python/fs_ls.py
new file mode 100644
index 000000000..06e5a7d0b
--- /dev/null
+++ b/apps/docs/src/code/python/fs_ls.py
@@ -0,0 +1,14 @@
+import asyncio
+from e2b import Session
+
+async def main():
+ session = await Session.create(id="Nodejs")
+
+ # List directory
+ dir_content = await session.filesystem.list('/')
+ for item in dir_content:
+ print(item)
+
+ await session.close()
+
+asyncio.new_event_loop().run_until_complete(main())
\ No newline at end of file
diff --git a/apps/docs/src/code/python/fs_read.py b/apps/docs/src/code/python/fs_read.py
new file mode 100644
index 000000000..a07e3bdff
--- /dev/null
+++ b/apps/docs/src/code/python/fs_read.py
@@ -0,0 +1,13 @@
+import asyncio
+from e2b import Session
+
+async def main():
+ session = await Session.create(id="Nodejs")
+
+ # Read file
+ file_content = await session.filesystem.read('/etc/hosts')
+ print(file_content)
+
+ await session.close()
+
+asyncio.new_event_loop().run_until_complete(main())
\ No newline at end of file
diff --git a/apps/docs/src/code/python/init.py b/apps/docs/src/code/python/init.py
new file mode 100644
index 000000000..84d05b8f3
--- /dev/null
+++ b/apps/docs/src/code/python/init.py
@@ -0,0 +1,15 @@
+import asyncio
+from e2b import Session
+
+# You can use some of the predefined environments by using specific id:
+# 'Nodejs', 'Bash', 'Python3', 'Java', 'Go', 'Rust', 'PHP', 'Perl', 'DotNET'
+# We'll support custom environments soon.
+session_id = "Nodejs"
+
+async def main():
+ session = await Session.create(id=session_id)
+
+ # Close the session once you're done.
+ await session.close()
+
+asyncio.new_event_loop().run_until_complete(main())
\ No newline at end of file
diff --git a/apps/docs/src/code/python/main.py b/apps/docs/src/code/python/main.py
new file mode 100644
index 000000000..02bf710ac
--- /dev/null
+++ b/apps/docs/src/code/python/main.py
@@ -0,0 +1,12 @@
+from e2b import Session
+# You can use some of the predefined environments by using specific id:
+# 'Nodejs', 'Bash', 'Python3', 'Java', 'Go', 'Rust', 'PHP', 'Perl', 'DotNET'
+session = Session(id="Nodejs", on_scan_ports=lambda ports: print("Open ports", ports))
+
+# Start a session and create a connection to it
+await session.open()
+
+...
+
+# Close the session after you are done
+await session.close()
\ No newline at end of file
diff --git a/apps/docs/src/code/python/pyproject.toml b/apps/docs/src/code/python/pyproject.toml
new file mode 100644
index 000000000..f61e8dd22
--- /dev/null
+++ b/apps/docs/src/code/python/pyproject.toml
@@ -0,0 +1,16 @@
+[tool.poetry]
+name = "e2b-docs-python-code"
+version = "0.1.0"
+description = ""
+authors = ["Your Name <[email protected]>"]
+readme = "README.md"
+packages = [{include = "e2b_docs_python_code"}]
+
+[tool.poetry.dependencies]
+python = "^3.10"
+e2b = "^0.1.10"
+
+
+[build-system]
+requires = ["poetry-core"]
+build-backend = "poetry.core.masonry.api"
diff --git a/apps/docs/src/components/Navigation.jsx b/apps/docs/src/components/Navigation.jsx
index 23958c0d5..e5c5ae861 100644
--- a/apps/docs/src/components/Navigation.jsx
+++ b/apps/docs/src/components/Navigation.jsx
@@ -198,7 +198,8 @@ export const navigation = [
title: 'Getting Started',
links: [
{ title: 'Installation', href: '/getting-started/installation' },
- { title: 'Basic Usage', href: '/getting-started/basic-usage' },
+ { title: 'Basics', href: '/getting-started/basics' },
+ { title: 'Use with AI Agents & Copilots', href: '/getting-started/how-to' },
],
},
// {
diff --git a/apps/reverse-proxy/README.md b/apps/reverse-proxy/README.md
new file mode 100644
index 000000000..84a51fa45
--- /dev/null
+++ b/apps/reverse-proxy/README.md
@@ -0,0 +1,3 @@
+# Reverse Proxy
+
+Reverse proxying via Vercel that handles redirects and rewrites for E2B websites.
diff --git a/apps/reverse-proxy/vercel.json b/apps/reverse-proxy/vercel.json
index 01a483329..c830ef9ff 100644
--- a/apps/reverse-proxy/vercel.json
+++ b/apps/reverse-proxy/vercel.json
@@ -44,8 +44,18 @@
]
},
{
- "source": "/blog(/.*)?",
- "destination": "https://e2b-blog.framer.website$1",
+ "source": "/blog",
+ "destination": "https://e2b-blog.framer.website",
+ "has": [
+ {
+ "type": "host",
+ "value": "e2b.dev"
+ }
+ ]
+ },
+ {
+ "source": "/blog/:path*",
+ "destination": "https://e2b-blog.framer.website/:path*",
"has": [
{
"type": "host",
@@ -56,36 +66,74 @@
],
"redirects": [
{
- "source": "/(.*)?",
+ "source": "/log/:path*",
+ "destination": "https://e2b.dev/blog/log/:path*",
+ "permanent": true
+ },
+ {
+ "source": "/:path*",
"has": [
{
"type": "host",
"value": "blog.e2b.dev"
}
],
- "destination": "https://e2b.dev/blog/$1",
+ "destination": "https://e2b.dev/blog/:path*",
"permanent": true
},
{
- "source": "/(.*)?",
+ "source": "/:path*",
"has": [
{
"type": "host",
"value": "changelog.e2b.dev"
}
],
- "destination": "https://e2b.dev/changelog/$1",
+ "destination": "https://e2b.dev/changelog/:path*",
"permanent": true
},
{
- "source": "/(.*)?",
+ "source": "/:path*",
+ "has": [
+ {
+ "type": "host",
+ "value": "docs.e2b.dev"
+ }
+ ],
+ "destination": "https://e2b.dev/docs/:path*",
+ "permanent": true
+ },
+ {
+ "source": "/",
+ "has": [
+ {
+ "type": "host",
+ "value": "blog.e2b.dev"
+ }
+ ],
+ "destination": "https://e2b.dev/blog",
+ "permanent": true
+ },
+ {
+ "source": "/",
+ "has": [
+ {
+ "type": "host",
+ "value": "changelog.e2b.dev"
+ }
+ ],
+ "destination": "https://e2b.dev/changelog",
+ "permanent": true
+ },
+ {
+ "source": "/",
"has": [
{
"type": "host",
"value": "docs.e2b.dev"
}
],
- "destination": "https://e2b.dev/docs/$1",
+ "destination": "https://e2b.dev/docs",
"permanent": true
}
]