7cec36dcb5
## Summary Follow-up to #1444 (the `httpcore` → `TimeoutException` mapping, now merged). That mapping made the flaky timeout deterministic, but the underlying cause remained: the streaming HTTP `read` timeout was set to the command `timeout`, so it raced the server's own `deadline_exceeded` response. This PR removes the read timeout on streaming calls entirely and relies on the server-side `connect-timeout-ms` header to enforce the command timeout — matching the JS SDK, which has no per-chunk read timeout. The race is now structurally impossible rather than mapped over. ## Usage ```python cmd = sandbox.commands.run("sleep 10", timeout=2, background=True) try: for _ in cmd: pass except TimeoutException: print("command timed out") # server-side deadline_exceeded, no transport race ``` ## Tradeoff A silently dropped connection (no RST) on a command with `timeout=0` (disabled) now has no client-side read backstop and relies on keepalive pings — the same posture as the JS SDK. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What is E2B?
E2B is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our JavaScript SDK or Python SDK.
Run your first Sandbox
1. Install SDK
pip install e2b
2. Get your E2B API key
E2B_API_KEY=e2b_***
3. Start a sandbox and run commands
from e2b import Sandbox
with Sandbox.create() as sandbox:
result = sandbox.commands.run('echo "Hello from E2B!"')
print(result.stdout) # Hello from E2B!
4. Code execution with Code Interpreter
If you need run_code(), install the Code Interpreter SDK:
pip install e2b-code-interpreter
from e2b_code_interpreter import Sandbox
with Sandbox.create() as sandbox:
execution = sandbox.run_code("x = 1; x += 1; x")
print(execution.text) # outputs 2
5. Check docs
Visit E2B documentation.
6. E2B cookbook
Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.
