Skip to content

Commit fd87137

Browse files
Remove remote WasmExecutor (#2321)
1 parent 13724b5 commit fd87137

9 files changed

Lines changed: 7 additions & 529 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ limitations under the License.
3535

3636
**Simplicity**: the logic for agents fits in ~1,000 lines of code (see [agents.py](https://github.com/huggingface/smolagents/blob/main/src/smolagents/agents.py)). We kept abstractions to their minimal shape above raw code!
3737

38-
🧑‍💻 **First-class support for Code Agents**. Our [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) writes its actions in code (as opposed to "agents being used to write code"). To make it secure, we support executing in sandboxed environments via [Blaxel](https://blaxel.ai), [E2B](https://e2b.dev/), [Modal](https://modal.com/), Docker, or Pyodide+Deno WebAssembly sandbox.
38+
🧑‍💻 **First-class support for Code Agents**. Our [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) writes its actions in code (as opposed to "agents being used to write code"). To make it secure, we support executing in sandboxed environments via [Blaxel](https://blaxel.ai), [E2B](https://e2b.dev/), [Modal](https://modal.com/), or Docker.
3939

4040
🤗 **Hub integrations**: you can [share/pull tools or agents to/from the Hub](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_hub) for instant sharing of the most efficient agents!
4141

@@ -241,7 +241,6 @@ Writing actions as code snippets is demonstrated to work better than the current
241241
Since code execution can be a serious security concern (arbitrary code execution!), **you should run agent code in a sandbox**. We support several options:
242242
- [E2B](https://e2b.dev/), [Blaxel](https://blaxel.ai), [Modal](https://modal.com/) — managed cloud sandboxes, simplest to set up
243243
- [Docker](https://www.docker.com/) — self-hosted container isolation
244-
- Pyodide+Deno WebAssembly — lightweight sandbox for browser or edge environments
245244

246245
The built-in `LocalPythonExecutor` is **not a security sandbox**. It applies some restrictions but can be bypassed and must not be used as a security boundary.
247246

SECURITY.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ To report a security vulnerability, please contact: security@huggingface.co
66

77
## Learning More About Security
88

9-
To learn more about running agents more securely, please see the [Secure Code Execution tutorial](docs/source/en/tutorials/secure_code_execution.mdx) which covers sandboxing with E2B, Docker, and WebAssembly.
9+
To learn more about running agents more securely, please see the [Secure Code Execution tutorial](docs/source/en/tutorials/secure_code_execution.mdx) which covers sandboxing with E2B, and Docker.
1010

1111
### Secure Execution Options
1212

@@ -18,6 +18,4 @@ To learn more about running agents more securely, please see the [Secure Code Ex
1818

1919
3. **Docker Sandbox**: Runs code in an isolated Docker container.
2020

21-
4. **WebAssembly Sandbox**: Executes Python code securely in a sandboxed WebAssembly environment using Pyodide and Deno's secure runtime.
22-
2321
We recommend using one of these sandboxed execution options when running untrusted code.

docs/source/en/reference/python_executors.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,3 @@ available executor implementations.
3535
### DockerExecutor
3636

3737
[[autodoc]] smolagents.remote_executors.DockerExecutor
38-
39-
### WasmExecutor
40-
41-
[[autodoc]] smolagents.remote_executors.WasmExecutor

docs/source/en/tutorials/secure_code_execution.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -432,28 +432,6 @@ finally:
432432
sandbox.cleanup()
433433
```
434434

435-
### WebAssembly setup
436-
437-
WebAssembly (Wasm) is a binary instruction format that allows code to be run in a safe, sandboxed environment.
438-
It is designed to be fast, efficient, and secure, making it an excellent choice for executing potentially untrusted code.
439-
440-
The `WasmExecutor` uses [Pyodide](https://pyodide.org/) and [Deno](https://docs.deno.com/).
441-
442-
#### Installation
443-
444-
1. [Install Deno on your system](https://docs.deno.com/runtime/getting_started/installation/)
445-
446-
#### Running your agent in WebAssembly: quick start
447-
448-
Simply pass `executor_type="wasm"` to the agent initialization, like:
449-
```py
450-
from smolagents import InferenceClientModel, CodeAgent
451-
452-
agent = CodeAgent(model=InferenceClientModel(), tools=[], executor_type="wasm")
453-
454-
agent.run("Can you give me the 100th Fibonacci number?")
455-
```
456-
457435
### Best practices for sandboxes
458436

459437
These key practices apply to Blaxel, E2B, and Docker sandboxes:

docs/source/ko/reference/agents.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,3 @@ Smolagents는 여러 단계에 걸쳐 정보를 저장하기 위해 메모리를
7272
#### DockerExecutor[[smolagents.DockerExecutor]]
7373

7474
[[autodoc]] smolagents.remote_executors.DockerExecutor
75-
76-
#### WasmExecutor[[smolagents.WasmExecutor]]
77-
78-
[[autodoc]] smolagents.remote_executors.WasmExecutor

examples/sandboxed_execution.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,3 @@
2222
with CodeAgent(tools=[WebSearchTool()], model=model, executor_type="modal") as agent:
2323
output = agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
2424
print("Modal executor result:", output)
25-
26-
# WebAssembly executor example
27-
with CodeAgent(tools=[], model=model, executor_type="wasm") as agent:
28-
output = agent.run("Calculate the square root of 125.")
29-
print("Wasm executor result:", output)
30-
# TODO: Support tools
31-
# with CodeAgent(tools=[VisitWebpageTool()], model=model, executor_type="wasm") as agent:
32-
# output = agent.run("What is the content of the Wikipedia page at https://en.wikipedia.org/wiki/Intelligent_agent?")

src/smolagents/agents.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
Monitor,
7878
TokenUsage,
7979
)
80-
from .remote_executors import BlaxelExecutor, DockerExecutor, E2BExecutor, ModalExecutor, WasmExecutor
80+
from .remote_executors import BlaxelExecutor, DockerExecutor, E2BExecutor, ModalExecutor
8181
from .tools import BaseTool, Tool, validate_tool_arguments
8282
from .utils import (
8383
AgentError,
@@ -1513,7 +1513,7 @@ class CodeAgent(MultiStepAgent):
15131513
additional_authorized_imports (`list[str]`, *optional*): Additional authorized imports for the agent.
15141514
planning_interval (`int`, *optional*): Interval at which the agent will run a planning step.
15151515
executor ([`PythonExecutor`], *optional*): Custom Python code executor. If not provided, a default executor will be created based on `executor_type`.
1516-
executor_type (`Literal["local", "blaxel", "e2b", "modal", "docker", "wasm"]`, default `"local"`): Type of code executor.
1516+
executor_type (`Literal["local", "blaxel", "e2b", "modal", "docker"]`, default `"local"`): Type of code executor.
15171517
executor_kwargs (`dict`, *optional*): Additional arguments to pass to initialize the executor.
15181518
max_print_outputs_length (`int`, *optional*): Maximum length of the print outputs.
15191519
stream_outputs (`bool`, *optional*, default `False`): Whether to stream outputs during execution.
@@ -1532,7 +1532,7 @@ def __init__(
15321532
additional_authorized_imports: list[str] | None = None,
15331533
planning_interval: int | None = None,
15341534
executor: PythonExecutor = None,
1535-
executor_type: Literal["local", "blaxel", "e2b", "modal", "docker", "wasm"] = "local",
1535+
executor_type: Literal["local", "blaxel", "e2b", "modal", "docker"] = "local",
15361536
executor_kwargs: dict[str, Any] | None = None,
15371537
max_print_outputs_length: int | None = None,
15381538
stream_outputs: bool = False,
@@ -1596,7 +1596,7 @@ def cleanup(self):
15961596
self.python_executor.cleanup()
15971597

15981598
def create_python_executor(self) -> PythonExecutor:
1599-
if self.executor_type not in {"local", "blaxel", "e2b", "modal", "docker", "wasm"}:
1599+
if self.executor_type not in {"local", "blaxel", "e2b", "modal", "docker"}:
16001600
raise ValueError(f"Unsupported executor type: {self.executor_type}")
16011601

16021602
if self.executor_type == "local":
@@ -1611,7 +1611,6 @@ def create_python_executor(self) -> PythonExecutor:
16111611
"blaxel": BlaxelExecutor,
16121612
"e2b": E2BExecutor,
16131613
"docker": DockerExecutor,
1614-
"wasm": WasmExecutor,
16151614
"modal": ModalExecutor,
16161615
}
16171616
return remote_executors[self.executor_type](

0 commit comments

Comments
 (0)