@@ -10,47 +10,50 @@ a start command that will be already running when you spawn the sandbox.
1010This way, you can have fully configured sandboxes with running processes ready to use with zero wait time for your users.
1111
1212There are two ways how you can start creating a new template:
13+
1314- using the CLI
1415- manually using the SDK
1516
1617## CLI
1718
1819<Warning >
19- This CLI command is not yet available, it will be released soon.
20+ This CLI command is not yet available, it will be released soon.
2021</Warning >
2122
2223You can use the E2B CLI to create a new template.
2324
2425<Steps >
25- <Step title = " Install the E2B CLI" >
26- Install the latest version of the [ E2B CLI] ( https://e2b.dev/docs/cli )
27- </Step >
28- <Step title = " Create a new template" >
26+ <Step title = " Install the E2B CLI" >
27+ Install the latest version of the [ E2B CLI] ( https://e2b.dev/docs/cli )
28+ </Step >
29+ <Step title = " Create a new template" >
2930 ``` bash
30- e2b template init
31+ e2b template init-v2
3132 ```
32- </Step >
33- <Step title = " Follow the prompts" >
34- Follow the prompts to create a new template.
35- </Step >
36- <Step title = " Done" >
37- Check the generated ` README.md ` file to see how to build and use your new template.
38- </Step >
33+ </Step >
34+ <Step title = " Follow the prompts" >
35+ Follow the prompts to create a new template.
36+ </Step >
37+ <Step title = " Done" >
38+ Check the generated ` README.md ` file to see how to build and use your new template.
39+ </Step >
3940</Steps >
4041
4142## Manual
4243
4344### Install the packages
45+
4446<Warning >
45- Requires the E2B version at least 2.1.0
47+ Requires the E2B version at least 2.1.0
4648</Warning >
4749
48- <CodeGroup dropdown >
50+ <CodeGroup >
4951
5052``` typescript Terminal
5153npm install e2b dotenv
5254```
5355
56+
5457``` python Terminal
5558pip install e2b dotenv
5659```
@@ -64,9 +67,10 @@ E2B_API_KEY=e2b_***
6467```
6568
6669### Create a new template file
70+
6771Create a template file with the following name and content
6872
69- <CodeGroup dropdown >
73+ <CodeGroup >
7074
7175``` typescript template.ts
7276import { Template , waitForTimeout } from " e2b" ;
@@ -79,6 +83,7 @@ export const template = Template()
7983 .setStartCmd (" echo $HELLO" , waitForTimeout (5_000 ));
8084```
8185
86+
8287``` python template.py
8388from e2b import Template, wait_for_timeout
8489
@@ -95,10 +100,9 @@ template = (
95100
96101</CodeGroup >
97102
98-
99103### Create a development build script
100104
101- <CodeGroup dropdown >
105+ <CodeGroup >
102106
103107``` typescript build.dev.ts
104108import " dotenv/config" ;
@@ -113,6 +117,7 @@ Template.build(template, {
113117});
114118```
115119
120+
116121``` python build_dev.py
117122from dotenv import load_dotenv
118123from e2b import Template
@@ -133,12 +138,13 @@ Template.build(
133138
134139Build the development template
135140
136- <CodeGroup dropdown >
141+ <CodeGroup >
137142
138143``` typescript Terminal
139144npx tsx build .dev .ts
140145```
141146
147+
142148``` python Terminal
143149python build_dev.py
144150```
@@ -147,7 +153,7 @@ python build_dev.py
147153
148154### Create a production build script
149155
150- <CodeGroup dropdown >
156+ <CodeGroup >
151157
152158``` typescript build.prod.ts
153159import " dotenv/config" ;
@@ -162,6 +168,7 @@ Template.build(template, {
162168});
163169```
164170
171+
165172``` python build_prod.py
166173from dotenv import load_dotenv
167174from e2b import Template
@@ -182,12 +189,13 @@ Template.build(
182189
183190Build the production template
184191
185- <CodeGroup dropdown >
192+ <CodeGroup >
186193
187194``` typescript Terminal
188195npx tsx build .prod .ts
189196```
190197
198+
191199``` python Terminal
192200python build_prod.py
193201```
@@ -196,7 +204,7 @@ python build_prod.py
196204
197205## Create a new Sandbox from the Template
198206
199- <CodeGroup dropdown >
207+ <CodeGroup >
200208
201209``` typescript
202210import " dotenv/config" ;
@@ -209,6 +217,7 @@ const sandbox = await Sandbox.create("template-tag-dev");
209217const sandbox = await Sandbox .create (" template-tag" );
210218```
211219
220+
212221``` python
213222from dotenv import load_dotenv
214223from e2b import Sandbox
@@ -225,5 +234,5 @@ sbx = Sandbox(template="template-tag")
225234</CodeGroup >
226235
227236<Note >
228- The template alias is the identifier that can be used to create a new Sandbox.
229- </Note >
237+ The template alias is the identifier that can be used to create a new Sandbox.
238+ </Note >
0 commit comments