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

feat: add E2B code interpreter #106

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jamesmurdza
Copy link

This is a plug-and-play alternative of the Docker code interpreter that uses E2B cloud sandboxes.

The inputs and outputs are slightly different compared to the default code interpreter:

Input: Dependencies are specified in the code via "!pip install"
Output: Output is a JSON structure separating standard output, errors, and rich data.

However these don't necessarily affect the end user as they are specified for the agent in the schema.

It also requires an E2B API key.

@jamesmurdza
Copy link
Author

@jamesmurdza
Copy link
Author

Hi @lorenzejay, I've just improved the text and added comments to the README to explain why we have a close() function. I also added arguments to the tool, including timeout.

@lorenzejay
Copy link
Contributor

Hi @lorenzejay, I've just improved the text and added comments to the README to explain why we have a close() function. I also added arguments to the tool, including timeout.

Awesome. Again, should it just automatically use the close method once it finishes the response? Don't need to keep the process running when its done right. Instead of having users set close manually. not saying remove the method just include that or even include that as a flag users can set ie: close_when_finished: bool

@jamesmurdza
Copy link
Author

Hi @lorenzejay, I've just improved the text and added comments to the README to explain why we have a close() function. I also added arguments to the tool, including timeout.

Awesome. Again, should it just automatically use the close method once it finishes the response? Don't need to keep the process running when its done right. Instead of having users set close manually. not saying remove the method just include that or even include that as a flag users can set ie: close_when_finished: bool

@lorenzejay If I understand correctly that would close the sandbox after the first time the tool is called. Since we don't know how many times the tool will be called (and it's frequently used more than once) that would cause workflows to break.

@lorenzejay
Copy link
Contributor

lorenzejay commented Oct 4, 2024

@jamesmurdza getting close
tools/init.py:
add from .e2b_code_interpreter_tool.code_interpreter_tool import E2BCodeInterpreterTool

then on root init.py:
E2BCodeInterpreterTool in init.py to properly import it from crew_tools

@lorenzejay
Copy link
Contributor

@jamesmurdza when running the tool on my crew i get this:

File ".../pypoetry/virtualenvs/crewai-Nmm_nbE4-py3.11/lib/python3.11/site-packages/e2b_code_interpreter/main.py", line 40, in init
super().init(
TypeError: Sandbox.init() got an unexpected keyword argument 'envs'

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