Skip to content

Commit

Permalink
feat: Add endpoints to add default e2b/local sandbox configs (#2138)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 authored Dec 2, 2024
1 parent 8e23cc6 commit e5aa5d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions letta/server/rest_api/routers/v1/sandbox_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from letta.schemas.sandbox_config import (
SandboxEnvironmentVariableCreate,
SandboxEnvironmentVariableUpdate,
SandboxType,
)
from letta.server.rest_api.utils import get_letta_server, get_user_id
from letta.server.server import SyncServer
Expand All @@ -29,6 +30,24 @@ def create_sandbox_config(
return server.sandbox_config_manager.create_or_update_sandbox_config(config_create, actor)


@router.post("/e2b/default", response_model=PydanticSandboxConfig)
def create_default_e2b_sandbox_config(
server: SyncServer = Depends(get_letta_server),
user_id: str = Depends(get_user_id),
):
actor = server.get_user_or_default(user_id=user_id)
return server.sandbox_config_manager.get_or_create_default_sandbox_config(sandbox_type=SandboxType.E2B, actor=actor)


@router.post("/local/default", response_model=PydanticSandboxConfig)
def create_default_local_sandbox_config(
server: SyncServer = Depends(get_letta_server),
user_id: str = Depends(get_user_id),
):
actor = server.get_user_or_default(user_id=user_id)
return server.sandbox_config_manager.get_or_create_default_sandbox_config(sandbox_type=SandboxType.LOCAL, actor=actor)


@router.patch("/{sandbox_config_id}", response_model=PydanticSandboxConfig)
def update_sandbox_config(
sandbox_config_id: str,
Expand Down

0 comments on commit e5aa5d1

Please sign in to comment.