refactor:langsmith.py changes

This commit is contained in:
aran-yogesh 2026-02-10 17:38:32 -08:00
parent 838e042fe4
commit e7085154da

View file

@ -20,8 +20,7 @@ from deepagents.backends.protocol import (
) )
from deepagents.backends.sandbox import BaseSandbox from deepagents.backends.sandbox import BaseSandbox
if TYPE_CHECKING: from langsmith.sandbox import Sandbox, SandboxClient, SandboxTemplate
from langsmith.sandbox import Sandbox, SandboxClient, SandboxTemplate
class SandboxProvider(ABC): class SandboxProvider(ABC):
@ -101,7 +100,9 @@ class LangSmithBackend(BaseSandbox):
responses: list[FileDownloadResponse] = [] responses: list[FileDownloadResponse] = []
for path in paths: for path in paths:
content = self._sandbox.read(path) content = self._sandbox.read(path)
responses.append(FileDownloadResponse(path=path, content=content, error=None)) responses.append(
FileDownloadResponse(path=path, content=content, error=None)
)
return responses return responses
def upload_files(self, files: list[tuple[str, bytes]]) -> list[FileUploadResponse]: def upload_files(self, files: list[tuple[str, bytes]]) -> list[FileUploadResponse]:
@ -160,7 +161,10 @@ class LangSmithProvider(SandboxProvider):
template_name=resolved_template_name, timeout=timeout template_name=resolved_template_name, timeout=timeout
) )
except Exception as e: except Exception as e:
msg = f"Failed to create sandbox from template '{resolved_template_name}': {e}" msg = (
f"Failed to create sandbox from template "
f"'{resolved_template_name}': {e}"
)
raise RuntimeError(msg) from e raise RuntimeError(msg) from e
# Verify sandbox is ready by polling # Verify sandbox is ready by polling