e873ee94b6
Client-side counterpart to [e2b-dev/infra#2982](https://github.com/e2b-dev/infra/pull/2982): adds an `allowNetworkMounts`/`allow_network_mounts` option to filesystem directory watching across the JS and Python (sync + async) SDKs, so clients can explicitly opt into watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE), which envd rejects by default. Events on network mounts may be unreliable or not delivered at all, hence the explicit opt-in. This regenerates the filesystem proto code from the updated spec and threads the flag through `watchDir`/`watch_dir` (streaming `WatchDir` and polling `CreateWatcher`). The option requires envd 0.6.4 (shipped by the infra PR); using it against an older sandbox throws a `TemplateError`/`TemplateException`. Default behavior is unchanged. Includes new watch tests for all three SDKs and a minor-bump changeset for `e2b` and `@e2b/python-sdk`. > Note: the new tests exercise the flag on a regular directory (a network mount can't be set up from SDK tests) and require envd 0.6.4, so this should land with/after the infra deploy. All pre-existing watch tests pass; the new ones currently fail with the expected `TemplateError` against the deployed envd. ### Usage **JavaScript** ```ts const handle = await sandbox.files.watchDir( '/mnt/nfs-share/my-dir', (event) => console.log(event.type, event.name), { allowNetworkMounts: true } ) ``` **Python (async)** ```python handle = await sandbox.files.watch_dir( "/mnt/nfs-share/my-dir", on_event=lambda e: print(e.type, e.name), allow_network_mounts=True, ) ``` **Python (sync)** ```python handle = sandbox.files.watch_dir("/mnt/nfs-share/my-dir", allow_network_mounts=True) for e in handle.get_new_events(): print(e.type, e.name) ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <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.
