[FEATURE] Attribute CrewAI traffic to E2B via the SDK integration API in the E2B sandbox tools
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Feature Area
Integration with external tools
Is your feature request related to a an existing bug? Please link it here.
NA
Describe the solution you'd like
CrewAI's E2B sandbox tools currently create and connect to E2B sandboxes without identifying
themselves, so E2B has no way to distinguish traffic originating from CrewAI from any other
consumer of the SDK. E2B ships a first-class API for this — ConnectionConfig.set_integration(),
available since e2b 2.32.0 — and CrewAI is not using it.
Proposal: register a versioned integration identifier in the shared E2B base tool, immediately
before every sandbox acquisition (both Sandbox.create(...) and Sandbox.connect(...)).
Concretely:
-
Define a module-level constant in
e2b_base_tool.py:E2B_INTEGRATION = f"crewai-tools/{version('crewai-tools')}" -
Add a small _set_integration() helper that calls
ConnectionConfig.set_integration(E2B_INTEGRATION), and invoke it on both sandbox
acquisition paths before the sandbox is created or connected. -
Raise the optional e2b dependency floor to >=2.32.0,<3.0.0 in
lib/crewai-tools/pyproject.toml, since set_integration does not exist below 2.32.0.
The upper bound keeps CrewAI off an unreleased major. -
Cover both code paths with unit tests asserting the integration is registered before
create/connect, so the ordering can't silently regress.
Describe alternatives you've considered
-
Have users call
ConnectionConfig.set_integration()themselves. Requires per-project
setup code, is undocumented for most users, and would leave the majority of CrewAI E2B
traffic unattributed. It also puts an E2B implementation detail into user crews. -
Set the integration in each concrete E2B tool instead of the shared base tool. Duplicates
the same three lines across tools and is easy to forget when a new E2B tool is added. The base
tool is the single choke point through which every sandbox is created or connected. -
Environment-variable based attribution (e.g. exporting an integration name). Out-of-band,
not guaranteed to be present, and again shifts the burden to every user's environment rather
than shipping correct behavior by default. -
Do nothing and rely on the SDK's default user agent. It does not identify CrewAI and
carries no crewai-tools version, so it can't distinguish CrewAI traffic or track which
CrewAI versions are in use. -
Keep the current
e2b ~=2.20.0pin and guard the call withhasattr/try-except. This was
raised in review on the PR. It avoids bumping the floor, but silently no-ops on older SDKs,
which means attribution is unreliable exactly where it matters. Givene2bis an optional
extra and 2.32.0 is well within the supported 2.x line, a floor bump with an explicit
<3.0.0ceiling is the cleaner contract. Happy to switch to a guarded call if maintainers
prefer not to move the floor.
Additional context
Implementation already exists as PR #6682, which was reviewed and approved but auto-closed by the
bot for not linking an issue. This issue is being filed to satisfy that requirement; the PR will
be reopened with Closes #<this issue> in the body.
Files touched by the proposed change:
lib/crewai-tools/pyproject.toml—e2bbumped from~=2.20.0to>=2.32.0,<3.0.0
(lock resolves 2.20.3 -> 2.34.0)lib/crewai-tools/src/crewai_tools/tools/e2b_sandbox_tool/e2b_base_tool.py—
E2B_INTEGRATIONconstant plus_set_integration()on both sandbox acquisition paths
(also lets an obsolete# type: ignoreon thee2bimport be dropped)lib/crewai-tools/tests/tools/test_e2b_sandbox_tool.py— two tests asserting call ordering
for the create and connect paths
Validation performed on the PR branch: ruff, mypy (clean), lock file check, wheel build, and a
manual run against e2b 2.32.0.
Scope: optional e2b extra only. No effect on users who don't install it, and no change to
sandbox behavior for users who do.
Willingness to Contribute
Yes, I'd be happy to submit a pull request
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/crewai-tools/src/crewai_tools/tools/e2b_sandbox_tool/e2b_base_tool.py and the existing PR #6682, then inspect the dependency change in lib/crewai-tools/pyproject.toml. Run lib/crewai-tools/tests/tools/test_e2b_sandbox_tool.py and confirm both sandbox acquisition paths register the versioned integration before create or connect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100