You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-14Lines changed: 21 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,30 +4,33 @@
4
4
<p><strong>Hyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded within applications. It enables safe execution of untrusted code within <i>micro virtual machines</i> with very low latency and minimal overhead.</strong> <br> We are a <a href="https://cncf.io/">Cloud Native Computing Foundation</a> sandbox project. </p>
5
5
</div>
6
6
7
-
> Note: Hyperlight is a nascent project with an evolving API and no guaranteed support. Assistance is provided on a
8
-
> best-effort basis by the developers.
9
-
10
7
# Hyperlight Sandbox
11
8
12
9
A multi-backend sandboxing framework for running untrusted code with controlled host capabilities. Built on [Hyperlight](https://github.com/hyperlight-dev/hyperlight).
13
10
11
+
Supported backends:
12
+
13
+
-[Wasm Component Sandbox](#wasm-component-sandbox) (Python/Javascript or provide your own)
14
+
-[HyperlightJS Sandbox](#hyperlightjs-sandbox)
15
+
-[Nanvix Sandbox](#nanvix-sandbox)
16
+
14
17
## Overview
15
18
16
-
hyperlight-sandbox provides a unified API across multiple isolation backends. All backends share a common capability model. A python SDK is provided.
19
+
hyperlight-sandbox provides a unified API across multiple isolation backends. All backends share a common capability model. A python and rust SDK is provided.
17
20
18
-
-**Secure code execution** -- Run untrusted code in isolated sandboxes
21
+
-**Secure code execution** -- Run untrusted code in hardware isolated sandboxes (KVM, MSHV, Hyper-v)
19
22
-**Host tool dispatch** -- Register callables as tools; guest code invokes them by name with schema-validated arguments
-**Snapshot / restore** -- Capture and rewind sandbox runtime state making it re-useable
25
+
-**Network allow listing** -- Network traffix is off by default; allow specific domains and HTTP verbs with `allow_domain()`
23
26
24
27
For a more in depth walkthrough, see the overview slide deck in `docs/end-user-overview-slides.md` (or run `just slides` to view in the browser).
25
28
26
29
### Use Cases
27
30
28
-
-**File Processing**: Process provided files in Python and return a summarized report
31
+
-**File Processing**: Process provided files and return a summarized report
29
32
-**Code Mode**: Let an agent write a script that calls your tools directly, reducing token usage
30
-
-**Sandboxed Execution** as a library: drop into an existing app or library without building a custom runtime
33
+
-**Sandboxed Execution as a library**: drop into an existing app or library to provide plugins
31
34
-**Agent Skills** combine scripts into multi-step workflows that run in isolation (future work)
32
35
33
36
#### Agent Use Case
@@ -51,6 +54,8 @@ flowchart TD
51
54
52
55
## Quick Start
53
56
57
+
Requires [KVM](https://help.ubuntu.com/community/KVM/Installation), [MSHV](https://github.com/rust-vmm/mshv) or [Hyper-v](https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/Install-Hyper-V?tabs=powershell&pivots=windows-server)
58
+
54
59
Python SDK:
55
60
56
61
```shell
@@ -78,7 +83,9 @@ print(result.stdout)
78
83
79
84
### Wasm Component Sandbox
80
85
81
-
Loads a Wasm component via [hyperlight-wasm](https://github.com/jsturtevant/hyperlight-wasm) and exposes the full capability surface through WIT-generated bindings. Supports the packaged Python guest and JavaScript guest. Use this for general-purpose workloads that need tools, file I/O, networking, and snapshots.
86
+
Loads a Wasm component via [hyperlight-wasm](https://github.com/hyperlight-dev/hyperlight-wasm) and exposes the full capability surface through WIT-generated bindings. Supports the packaged Python guest and JavaScript guest. Use this for general-purpose workloads that need tools, file I/O, networking, and snapshots.
87
+
88
+
Build your own using the provided [WIT interface](src/wasm_sandbox/wit/hyperlight-sandbox.wit). See the [python](./src/wasm_sandbox/guests/python/) and [javascript](./src/wasm_sandbox/guests/javascript/) guests for examples.
82
89
83
90
```rust
84
91
usehyperlight_sandbox::{Sandbox, ToolRegistry};
@@ -116,11 +123,11 @@ print(f"3 + 4 = {result}")
116
123
}
117
124
```
118
125
119
-
See `src/wasm_sandbox/examples/` for file I/O and network demos.
126
+
See [examples](./src/wasm_sandbox/examples/) for file I/O and network demos.
120
127
121
128
### HyperlightJS Sandbox
122
129
123
-
Runs JavaScript directly on the [HyperlightJS](https://github.com/hyperlight-dev/hyperlight-js) runtime without going through the Wasm component model. Injects `call_tool`, `read_file`, `write_file`, and `fetch` as globals. Supports snapshots, file I/O, and network allowlists. A simpler runtime path when the workload is JavaScript-only.
130
+
Runs JavaScript directly on the [HyperlightJS](https://github.com/hyperlight-dev/hyperlight-js) runtime without going through the Wasm component model. Injects `call_tool`, `read_file`, `write_file`, and `fetch` as globals. Supports snapshots, file I/O, and network allowlists. A simpler runtime path when the workload is JavaScript-only and need a smaller footprint.
Copy file name to clipboardExpand all lines: examples/agent-framework/copilot_agent.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -73,9 +73,10 @@
73
73
74
74
DEFAULT_PROMPTS= [
75
75
"Fetch all users, find admins, multiply 6*7, and print the users, admins, and multiplication result. Use one execute_code call.",
76
-
"Use execute_code and the python functions http_get/http_post(these are NOT a tools. use like `resp = http_get(\"https://example\")`) to try reading /input/secrets.txt (it doesn't exist — handle the error), then read /input/team.json which does exist, parse it, and print each team member's name and role.",
76
+
"Use execute_code and to try reading /input/secrets.txt (it doesn't exist — handle the error), then read /input/team.json which does exist, parse it, and print each team member's name and role.",
77
77
(
78
78
"Use execute_code to demonstrate the network allowlist. In a single code block:\n"
79
+
"Use plain python functions http_get/http_post(these are NOT a tools. use like `resp = http_get(\"https://example\")`) \n"
79
80
"1. Use http_get to fetch https://httpbin.org/get — this should succeed (GET is allowed)\n"
80
81
"2. Try http_post to https://httpbin.org/post — this should FAIL (only GET is allowed for httpbin.org)\n"
81
82
"3. Try http_get to https://github.com — this should FAIL (github.com is not in the allowlist at all)\n"
0 commit comments