DEV Community

Thomas Metz
Thomas Metz

Posted on

Fixing "'Sandbox' object has no attribute '_transport'" in CrewAI's E2B tools

If you installed crewai-tools[e2b] recently and E2BPythonTool crashes with

AttributeError: 'Sandbox' object has no attribute '_transport'
✨ อัปเดตล่าสุด: thomasmetz/fixing sandbox object has no attribute transport in crewais eb tools me - สรุปดราม่าล่าสุด ✨ อัปเดตล่าสุด: thomasmetz/fixing sandbox object has no attribute transport in crewais eb tools me - สรุปดราม่าล่าสุด

you are not doing anything wrong. On Python 3.11 and newer, crewai-tools[e2b] installs e2b 2.64 together with e2b-code-interpreter 2.6. The code interpreter 2.6 still expects an attribute that e2b 2.64 removed, so every Python call fails. The shell and file tools keep working, because they don't use the code interpreter.

The fix

Upgrade the code interpreter after installing CrewAI's tools:

pip install "crewai-tools[e2b]"
pip install -U "e2b-code-interpreter>=2.11"
✨ อัปเดตล่าสุด: thomasmetz/fixing sandbox object has no attribute transport in crewais eb tools me - สรุปดราม่าล่าสุด ✨ อัปเดตล่าสุด: thomasmetz/fixing sandbox object has no attribute transport in crewais eb tools me - สรุปดราม่าล่าสุด

This is outside the version range crewai-tools asks for, so do it in a virtualenv of its own if you also use other E2B tooling. With e2b 2.64 and e2b-code-interpreter 2.11 all three tools work:

from crewai_tools import E2BExecTool, E2BFileTool, E2BPythonTool

print(E2BExecTool().run(command="python3 --version")["stdout"])
print(E2BPythonTool().run(code="print(sum(range(10)))")["stdout"])

files = E2BFileTool(persistent=True)
files.run(action="write", path="/home/user/todo.txt", content="ship it")
print(files.run(action="read", path="/home/user/todo.txt")["content"])
✨ อัปเดตล่าสุด: thomasmetz/fixing sandbox object has no attribute transport in crewais eb tools me - สรุปดราม่าล่าสุด ✨ อัปเดตล่าสุด: thomasmetz/fixing sandbox object has no attribute transport in crewais eb tools me - สรุปดราม่าล่าสุด

I reported the pin to the CrewAI team: https://github.com/crewAIInc/crewAI/issues/10174

Two things worth knowing about these tools

  • Ephemeral by default. E2BExecTool and E2BPythonTool create a new sandbox for every call. That's safe, but each call pays the start-up time and nothing survives between calls. Pass persistent=True when an agent should keep files or variables.
  • The domain is configurable. All three tools take a domain argument that falls back to E2B_DOMAIN, so they work with self-hosted E2B or any E2B-compatible endpoint.

Disclosure: I run getrollouts.dev, an E2B-compatible sandbox service, which is how I ran into this. The fix above has nothing to do with it and applies to e2b.dev the same way. If you want to try the tools somewhere else: E2B_DOMAIN=getrollouts.dev, 24-hour sessions, no monthly fee. Runnable example: 13_crewai.py.

Top comments (0)