Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add init example

Vasek Mlejnsky9bb9920d2b9a
diff --git a/apps/docs/src/app/page.mdx b/apps/docs/src/app/page.mdx
index 5ce7788e6..e99060507 100644
--- a/apps/docs/src/app/page.mdx
+++ b/apps/docs/src/app/page.mdx
@@ -59,4 +59,7 @@ pip install e2b
```ts {{ language: 'ts', snippet: 'ts/quickstart.ts' }}
```
+
+```python {{ language: 'python', snippet: 'python/quickstart.ts' }}
+```
</CodeGroup>
diff --git a/apps/docs/src/code/python/basics/init.py b/apps/docs/src/code/python/basics/init.py
index d74abdec0..5a4c03bbe 100644
--- a/apps/docs/src/code/python/basics/init.py
+++ b/apps/docs/src/code/python/basics/init.py
@@ -1,6 +1,23 @@
import asyncio
from e2b import Session
+banner = """import { Box, Text, Link } from "@chakra-ui/react";
+import { FaStar } from 'react-icons/fa';
+
+const Banner = () => {
+ return (
+ <Box w="100%" p={2} color="white" bgColor="blackAlpha.400">
+ <Link href="https://github.com/sweepai/sweep" isExternal>
+ <Text fontSize="lg" display="flex" justifyContent="center" alignItems="center" color="lightgrey">
+ <FaStar />&nbsp;Star us on GitHub&nbsp;&nbsp;<img src="https://img.shields.io/github/stars/sweepai/sweep?style=social" alt="GitHub stars badge" style={{ display: 'inline-block', marginBottom: '2px' }} />
+ </Text>
+ </Link>
+ </Box>
+ );
+};
+
+export default Banner;"""
+
async def main():
session = await Session.create(id="Nodejs")
diff --git a/apps/docs/src/code/python/quickstart.py b/apps/docs/src/code/python/quickstart.py
new file mode 100644
index 000000000..1049c4333
--- /dev/null
+++ b/apps/docs/src/code/python/quickstart.py
@@ -0,0 +1,11 @@
+import asyncio
+from e2b import Session
+
+async def main():
+ # `id` can also be one of:
+
+ # We're working on customizable envs.
+ session = await Session.create(id="Nodejs")
+ await session.close()
+
+asyncio.new_event_loop().run_until_complete(main())
\ No newline at end of file