fix: mark E2B_API_KEY as required for E2B sandbox tools - #6688
Conversation
E2B_API_KEY was declared with required=False on the shared E2B tool base (E2BExecTool, E2BFileTool, E2BPythonTool), even though none of the three tools can create or attach to a sandbox without it. E2B_DOMAIN stays optional since it genuinely defaults to e2b.dev. Regenerated lib/crewai-tools/tool.specs.json via generate_tool_specs.py to reflect the change.
📝 WalkthroughWalkthroughThe E2B sandbox tool now requires ChangesE2B API key requirement
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR corrects the E2B sandbox tools’ environment-variable metadata so downstream consumers (notably CrewAI AMP) can properly validate and forward E2B_API_KEY, which is necessary for creating/attaching to E2B sandboxes.
Changes:
- Mark
E2B_API_KEYasrequired=Truein the shared E2B sandbox base tool env var declaration. - Regenerate
lib/crewai-tools/tool.specs.jsonso the three E2B tool entries reflect the required flag change (and only that change).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lib/crewai-tools/src/crewai_tools/tools/e2b_sandbox_tool/e2b_base_tool.py |
Flips E2B_API_KEY env var metadata to required in the shared base used by E2B sandbox tools. |
lib/crewai-tools/tool.specs.json |
Regenerated specs reflecting E2B_API_KEY as required for the three E2B tool definitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
E2B_API_KEYwas declared withrequired: falseon the shared E2B tool base (E2BExecTool,E2BFileTool,E2BPythonTool), even though none of the three tools can create or attach to a sandbox without it. This PR flips it torequired: true.E2B_DOMAINstaysrequired: false— it's genuinely optional and defaults toe2b.devwhen unset.lib/crewai-tools/tool.specs.jsonby runningsrc/crewai_tools/generate_tool_specs.py(not hand-edited) so the diff there is exactly the 3requiredflags flipping fromfalsetotrue, one per E2B tool.Why
tool.specs.jsonis the machine-readable source of truth for tool env var requirements, and downstream consumers rely on therequiredflag to validate configuration up front. WithE2B_API_KEYflagged optional, a missing key only surfaces at runtime when sandbox creation fails, instead of at configuration time. Since no E2B tool works without the key, the spec should say so.Changes
lib/crewai-tools/src/crewai_tools/tools/e2b_sandbox_tool/e2b_base_tool.py:E2B_API_KEYEnvVarentry now hasrequired=True(single shared declaration used by all three E2B tools).lib/crewai-tools/tool.specs.json: regenerated viagenerate_tool_specs.py.Test plan
ruff checkon the touched source file — all checks passedpytest lib/crewai-tools/tests/test_generate_tool_specs.py— 10 passedtool.specs.jsonvia the real generator script (generate_tool_specs.py), not hand-edited, and diffed to confirm only the 3 expectedrequiredflags changed