Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better exception handling for remote code sandbox #160

Merged
merged 6 commits into from
Jul 3, 2024

Conversation

humpydonkey
Copy link
Collaborator

A series of changes to improve remote sandbox error handling.

Changes

  1. Add more exception handling in e2b sandbox operations.
  2. Add a sandbox liveness check to detect the case when a sandbox is dead. It helps better identify issue earlier.
  3. Create three RemoteSandboxError exception classes so the client can catch and handle them differently.
  4. Allow VA client to change the sandbox provider via the VA constructor.
  5. Fix a bug that calls self.interpreter.kill() twice.
  6. Remove unnecessary retry.

Comment on lines +22 to +42
class RemoteSandboxCreationError(RemoteSandboxError):
"""Exception raised when failed to create a remote sandbox.
This could be due to the remote sandbox service is unavailable.
"""

is_retryable = False


class RemoteSandboxExecutionError(RemoteSandboxError):
"""Exception raised when failed in a remote sandbox code execution."""

is_retryable = False


class RemoteSandboxClosedError(RemoteSandboxError):
"""Exception raised when a remote sandbox is dead.
This is retryable in the sense that the user can try again with a new sandbox. Can't be retried in the same sandbox.
When this error is raised, the user should retry by create a new VisionAgent (i.e. a new sandbox).
"""

is_retryable = True
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, @yzld2002, new exception classes

Copy link
Member

@yzld2002 yzld2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@humpydonkey humpydonkey merged commit 30fd01f into main Jul 3, 2024
8 checks passed
@humpydonkey humpydonkey deleted the sandbox-exceptions branch July 3, 2024 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants