File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
python/e2b_code_interpreter Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ export interface CreateCodeContextOpts {
7878 * @default python
7979 */
8080 language ?: string ,
81+ /**
82+ * User for the context.
83+ *
84+ * @default root
85+ */
86+ user ?: "root" | "user" ,
8187 /**
8288 * Timeout for the request in **milliseconds**.
8389 *
@@ -269,6 +275,7 @@ export class Sandbox extends BaseSandbox {
269275 body : JSON . stringify ( {
270276 language : opts ?. language ,
271277 cwd : opts ?. cwd ,
278+ user : opts ?. user ,
272279 } ) ,
273280 keepalive : true ,
274281 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(
231231 self ,
232232 cwd : Optional [str ] = None ,
233233 language : Optional [str ] = None ,
234+ user : Optional [Literal ["root" , "user" ]] = None ,
234235 request_timeout : Optional [float ] = None ,
235236 ) -> Context :
236237 """
237238 Creates a new context to run code in.
238239
239240 :param cwd: Set the current working directory for the context, defaults to `/home/user`
240241 :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`
241243 :param request_timeout: Timeout for the request in **milliseconds**
242244
243245 :return: Context object
@@ -249,6 +251,8 @@ async def create_code_context(
249251 data ["language" ] = language
250252 if cwd :
251253 data ["cwd" ] = cwd
254+ if user :
255+ data ["user" ] = user
252256
253257 try :
254258 response = await self ._client .post (
You can’t perform that action at this time.
0 commit comments