Skip to content

fix: mark E2B_API_KEY as required for E2B sandbox tools - #6688

Merged
thiagomoretto merged 1 commit into
mainfrom
fix/e2b-api-key-required
Jul 27, 2026
Merged

fix: mark E2B_API_KEY as required for E2B sandbox tools#6688
thiagomoretto merged 1 commit into
mainfrom
fix/e2b-api-key-required

Conversation

@thiagomoretto

@thiagomoretto thiagomoretto commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 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. This PR flips it to required: true.
  • E2B_DOMAIN stays required: false — it's genuinely optional and defaults to e2b.dev when unset.
  • Regenerated lib/crewai-tools/tool.specs.json by running src/crewai_tools/generate_tool_specs.py (not hand-edited) so the diff there is exactly the 3 required flags flipping from false to true, one per E2B tool.

Why

tool.specs.json is the machine-readable source of truth for tool env var requirements, and downstream consumers rely on the required flag to validate configuration up front. With E2B_API_KEY flagged 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_KEY EnvVar entry now has required=True (single shared declaration used by all three E2B tools).
  • lib/crewai-tools/tool.specs.json: regenerated via generate_tool_specs.py.

Test plan

  • ruff check on the touched source file — all checks passed
  • pytest lib/crewai-tools/tests/test_generate_tool_specs.py — 10 passed
  • Confirmed no existing E2B-specific test file to update (none exists yet)
  • Regenerated tool.specs.json via the real generator script (generate_tool_specs.py), not hand-edited, and diffed to confirm only the 3 expected required flags changed

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.
Copilot AI review requested due to automatic review settings July 27, 2026 17:38
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The E2B sandbox tool now requires E2B_API_KEY, with the requirement synchronized across its base tool definition and three tool specification entries.

Changes

E2B API key requirement

Layer / File(s) Summary
Require E2B API key
lib/crewai-tools/src/crewai_tools/tools/e2b_sandbox_tool/e2b_base_tool.py, lib/crewai-tools/tool.specs.json
The E2B_API_KEY environment variable is marked as required in the base tool definition and three specification entries.

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: making E2B_API_KEY required for E2B sandbox tools.
Description check ✅ Passed The description matches the changeset and explains the requirement flip and regenerated specs.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2b-api-key-required

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thiagomoretto
thiagomoretto marked this pull request as ready for review July 27, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_KEY as required=True in the shared E2B sandbox base tool env var declaration.
  • Regenerate lib/crewai-tools/tool.specs.json so 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.

@thiagomoretto
thiagomoretto enabled auto-merge (squash) July 27, 2026 18:22
@thiagomoretto
thiagomoretto merged commit e2c8d7c into main Jul 27, 2026
61 of 126 checks passed
@thiagomoretto
thiagomoretto deleted the fix/e2b-api-key-required branch July 27, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants