Skip to content

Commit

Permalink
Merge pull request #170 from athina-ai/fix/allow-template-sandbox-in-…
Browse files Browse the repository at this point in the history
…code-execution

Allow user to pass a template ID for E2B sandbox
  • Loading branch information
vivek-athina authored Feb 13, 2025
2 parents 03d7df1 + a19918e commit 9f35f84
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions athina/steps/code_execution_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class CodeExecutionV2(Step):
DEFAULT_TIMEOUT: ClassVar[int] = 60 # 1 minute default timeout for sandbox
MAX_TIMEOUT: ClassVar[int] = 300 # 5 minute limit for e2b sandbox execution
sandbox_timeout: Optional[int] = None
template: Optional[str] = None

def __init__(
self,
Expand Down Expand Up @@ -132,6 +133,7 @@ def _create_or_initialize_sandbox(self):

if self._sandbox is None:
self._sandbox = Sandbox(
template=self.template,
timeout=min(
self.sandbox_timeout or self.DEFAULT_TIMEOUT, self.MAX_TIMEOUT
),
Expand Down

0 comments on commit 9f35f84

Please sign in to comment.