-
Notifications
You must be signed in to change notification settings - Fork 44.9k
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
CodeExecutionBlock split into InstantiationBlock & StepExecutionBlock #9158
base: dev
Are you sure you want to change the base?
Conversation
This PR targets the Automatically setting the base branch to |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
✅ Deploy Preview for auto-gpt-docs canceled.
|
✅ Deploy Preview for auto-gpt-docs-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I think there’s a healthy case for all three blocks here with the Code Execution block calling the other two to handle its business. What are your thoughts on that? |
Especially in case of heavy sandbox customization we don't want to spawn a new VM every time we need to execute code, especially in circumstances when time of inactivity is negligible.
Changes 🏗️
Added two now blocks inside
autogpt_platform/backend/backend/blocks/code_executor.py
which split the logic of the CodeExecutionBlock in two parts: InstantiationBlock and StepExecutionBlock.The overall setup shall be the done in the InstantiationBlock which then passes as output the
sandbox_id
which identifies the sandbox instance.At a later stage any line of code can be executed through StepExecutionBlock inside the same instance using the e2b library function
sandbox = Sandbox.connect(sandbox_id=sandbox_id, api_key=api_key)
. Variables and memory form earlier executions or instantiation are persisted.Beware, this approach does not make use of the beta apis to pause and resume an instance. By using the approach above the VM will likely be killed after the timeout inactivity set at instantiation time.
New Features:
InstantiationBlock Class:
StepExecutionBlock Class:
Minor Changes:
ProgrammingLanguage
enum definition.