File tree 2 files changed +11
-0
lines changed
python/e2b_code_interpreter 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ export interface CreateCodeContextOpts {
78
78
* @default python
79
79
*/
80
80
language ?: string ,
81
+ /**
82
+ * User for the context.
83
+ *
84
+ * @default root
85
+ */
86
+ user ?: "root" | "user" ,
81
87
/**
82
88
* Timeout for the request in **milliseconds**.
83
89
*
@@ -269,6 +275,7 @@ export class Sandbox extends BaseSandbox {
269
275
body : JSON . stringify ( {
270
276
language : opts ?. language ,
271
277
cwd : opts ?. cwd ,
278
+ user : opts ?. user ,
272
279
} ) ,
273
280
keepalive : true ,
274
281
signal : this . connectionConfig . getSignal ( opts ?. requestTimeoutMs ) ,
Original file line number Diff line number Diff line change @@ -231,13 +231,15 @@ async def create_code_context(
231
231
self ,
232
232
cwd : Optional [str ] = None ,
233
233
language : Optional [str ] = None ,
234
+ user : Optional [Literal ["root" , "user" ]] = None ,
234
235
request_timeout : Optional [float ] = None ,
235
236
) -> Context :
236
237
"""
237
238
Creates a new context to run code in.
238
239
239
240
:param cwd: Set the current working directory for the context, defaults to `/home/user`
240
241
:param language: Language of the context. If not specified, defaults to Python
242
+ :param user: User of the context. If not specified, defaults to `root`
241
243
:param request_timeout: Timeout for the request in **milliseconds**
242
244
243
245
:return: Context object
@@ -249,6 +251,8 @@ async def create_code_context(
249
251
data ["language" ] = language
250
252
if cwd :
251
253
data ["cwd" ] = cwd
254
+ if user :
255
+ data ["user" ] = user
252
256
253
257
try :
254
258
response = await self ._client .post (
You can’t perform that action at this time.
0 commit comments