File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,14 +77,14 @@ Create a sandbox with your Anthropic API key and pipe prompts to Claude. It can
7777``` typescript JavaScript & TypeScript
7878import { Sandbox } from ' e2b'
7979
80- const sbx = await Sandbox .create (' claude-code' , {
80+ const sandbox = await Sandbox .create (' claude-code' , {
8181 timeoutMs: 60_000 ,
8282 envs: {
8383 ANTHROPIC_API_KEY: ' <your api key>' ,
8484 },
8585})
8686
87- const result = await sbx .commands .run (
87+ const result = await sandbox .commands .run (
8888 ` echo 'Create a hello world index.html' | claude -p --dangerously-skip-permissions ` ,
8989 { timeoutMs: 0 }
9090)
@@ -94,15 +94,15 @@ console.log(result.stdout)
9494``` python Python
9595from e2b import Sandbox
9696
97- sbx = Sandbox(
97+ sandbox = Sandbox(
9898 ' claude-code' ,
9999 timeout = 60 ,
100100 envs = {
101101 ' ANTHROPIC_API_KEY' : ' <your api key>' ,
102102 },
103103)
104104
105- result = sbx .commands.run(
105+ result = sandbox .commands.run(
106106 " echo 'Create a hello world index.html' | claude -p --dangerously-skip-permissions" ,
107107 timeout = 0 ,
108108)
Original file line number Diff line number Diff line change @@ -188,18 +188,18 @@ Create a sandbox and open the URL in your browser. You'll see a full Ubuntu desk
188188``` typescript JavaScript & TypeScript
189189import { Sandbox } from ' e2b'
190190
191- const sbx = await Sandbox .create (' desktop' , { timeoutMs: 60_000 })
191+ const sandbox = await Sandbox .create (' desktop' , { timeoutMs: 60_000 })
192192
193- const url = sbx .getHost (6080 )
193+ const url = sandbox .getHost (6080 )
194194console .log (' Desktop available at:' , url )
195195```
196196
197197``` python Python
198198from e2b import Sandbox
199199
200- sbx = Sandbox(' desktop' , timeout = 60 )
200+ sandbox = Sandbox(' desktop' , timeout = 60 )
201201
202- url = sbx .get_host(6080 )
202+ url = sandbox .get_host(6080 )
203203print (' Desktop available at:' , url)
204204```
205205
Original file line number Diff line number Diff line change @@ -71,18 +71,18 @@ Spin up a sandbox and run any Docker image you need.
7171``` typescript JavaScript & TypeScript
7272import { Sandbox } from ' e2b'
7373
74- const sbx = await Sandbox .create (' e2b-docker-template' , { timeoutMs: 60_000 })
74+ const sandbox = await Sandbox .create (' e2b-docker-template' , { timeoutMs: 60_000 })
7575
76- const result = await sbx .commands .run (' sudo docker run --rm alpine echo "Hello from Alpine!"' )
76+ const result = await sandbox .commands .run (' sudo docker run --rm alpine echo "Hello from Alpine!"' )
7777console .log (result .stdout )
7878```
7979
8080``` python Python
8181from e2b import Sandbox
8282
83- sbx = Sandbox(' e2b-docker-template' , timeout = 60 )
83+ sandbox = Sandbox(' e2b-docker-template' , timeout = 60 )
8484
85- result = sbx .commands.run(' sudo docker run --rm alpine echo "Hello from Alpine!"' )
85+ result = sandbox .commands.run(' sudo docker run --rm alpine echo "Hello from Alpine!"' )
8686print (result.stdout)
8787```
8888</CodeGroup >
Original file line number Diff line number Diff line change @@ -77,18 +77,18 @@ Create a sandbox and get the URL. Open it in your browser to see the Expo web pr
7777``` typescript JavaScript & TypeScript
7878import { Sandbox } from ' e2b'
7979
80- const sbx = await Sandbox .create (' expo-app' , { timeoutMs: 60_000 })
80+ const sandbox = await Sandbox .create (' expo-app' , { timeoutMs: 60_000 })
8181
82- const url = sbx .getHost (8081 )
82+ const url = sandbox .getHost (8081 )
8383console .log (' Expo app running at:' , url )
8484```
8585
8686``` python Python
8787from e2b import Sandbox
8888
89- sbx = Sandbox(' expo-app' , timeout = 60 )
89+ sandbox = Sandbox(' expo-app' , timeout = 60 )
9090
91- url = sbx .get_host(8081 )
91+ url = sandbox .get_host(8081 )
9292print (' Expo app running at:' , url)
9393```
9494</CodeGroup >
Original file line number Diff line number Diff line change @@ -85,18 +85,18 @@ Create a sandbox and grab the URL. The dev server with Turbopack is already runn
8585``` typescript JavaScript & TypeScript
8686import { Sandbox } from ' e2b'
8787
88- const sbx = await Sandbox .create (' nextjs-app-bun' , { timeoutMs: 60_000 })
88+ const sandbox = await Sandbox .create (' nextjs-app-bun' , { timeoutMs: 60_000 })
8989
90- const url = sbx .getHost (3000 )
90+ const url = sandbox .getHost (3000 )
9191console .log (' Next.js app running at:' , url )
9292```
9393
9494``` python Python
9595from e2b import Sandbox
9696
97- sbx = Sandbox(' nextjs-app-bun' , timeout = 60 )
97+ sandbox = Sandbox(' nextjs-app-bun' , timeout = 60 )
9898
99- url = sbx .get_host(3000 )
99+ url = sandbox .get_host(3000 )
100100print (' Next.js app running at:' , url)
101101```
102102</CodeGroup >
Original file line number Diff line number Diff line change @@ -87,18 +87,18 @@ Create a sandbox and grab the URL. The dev server with Turbopack is already runn
8787``` typescript JavaScript & TypeScript
8888import { Sandbox } from ' e2b'
8989
90- const sbx = await Sandbox .create (' nextjs-app' , { timeoutMs: 60_000 })
90+ const sandbox = await Sandbox .create (' nextjs-app' , { timeoutMs: 60_000 })
9191
92- const url = sbx .getHost (3000 )
92+ const url = sandbox .getHost (3000 )
9393console .log (' Next.js app running at:' , url )
9494```
9595
9696``` python Python
9797from e2b import Sandbox
9898
99- sbx = Sandbox(' nextjs-app' , timeout = 60 )
99+ sandbox = Sandbox(' nextjs-app' , timeout = 60 )
100100
101- url = sbx .get_host(3000 )
101+ url = sandbox .get_host(3000 )
102102print (' Next.js app running at:' , url)
103103```
104104</CodeGroup >
You can’t perform that action at this time.
0 commit comments