fix(python): route Jupyter requests through client-proxy when E2B_SANDBOX_URL is set #196
+40
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
E2B_SANDBOX_URLis set (local/self-hosted environments), the code interpreter SDK's Jupyter requests (run_code,create_code_context, etc.) bypassE2B_SANDBOX_URLand are sent directly to the hostname-based URL (e.g.https://49999-{sandbox_id}.e2b.app), which fails in local setups.e2b) correctly handles this viaget_sandbox_url(), but the code interpreter's_jupyter_urlusesget_host()directly._jupyter_urlto respectE2B_SANDBOX_URLand addsE2b-Sandbox-Id/E2b-Sandbox-Portheaders for local client-proxy routing.Sandbox) and async (AsyncSandbox) classes are fixed.E2B_SANDBOX_URLis not set in cloud flow).Test plan
run_code()works with stateful execution (variable persistence across calls)E2B_SANDBOX_URLis not set)