Skip to content

Commit f212ca3

Browse files
committed
Updates to readme and demos
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 1623ab5 commit f212ca3

3 files changed

Lines changed: 25 additions & 17 deletions

File tree

README.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,33 @@
44
<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>
55
</div>
66

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-
107
# Hyperlight Sandbox
118

129
A multi-backend sandboxing framework for running untrusted code with controlled host capabilities. Built on [Hyperlight](https://github.com/hyperlight-dev/hyperlight).
1310

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+
1417
## Overview
1518

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.
1720

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)
1922
- **Host tool dispatch** -- Register callables as tools; guest code invokes them by name with schema-validated arguments
20-
- **Capability-based file I/O** -- Read-only `/input` directory, writable `/output` directory, strict path isolation
21-
- **Snapshot / restore** -- Capture and rewind sandbox runtime state
22-
- **Network allowlisting** -- Outbound HTTP is deny-by-default; allow specific domains and methods with `allow_domain()`
23+
- **Capability-based file access** -- Read-only `/input` directory, writable `/output` directory, strict path isolation
24+
- **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()`
2326

2427
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).
2528

2629
### Use Cases
2730

28-
- **File Processing**: Process provided files in Python and return a summarized report
31+
- **File Processing**: Process provided files and return a summarized report
2932
- **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
3134
- **Agent Skills** combine scripts into multi-step workflows that run in isolation (future work)
3235

3336
#### Agent Use Case
@@ -51,6 +54,8 @@ flowchart TD
5154

5255
## Quick Start
5356

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+
5459
Python SDK:
5560

5661
```shell
@@ -78,7 +83,9 @@ print(result.stdout)
7883

7984
### Wasm Component Sandbox
8085

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.
8289

8390
```rust
8491
use hyperlight_sandbox::{Sandbox, ToolRegistry};
@@ -116,11 +123,11 @@ print(f"3 + 4 = {result}")
116123
}
117124
```
118125

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.
120127

121128
### HyperlightJS Sandbox
122129

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.
124131

125132
```rust
126133
use hyperlight_javascript_sandbox::HyperlightJs;
@@ -156,7 +163,7 @@ console.log('10 + 20 = ' + sum);
156163
}
157164
```
158165

159-
See `src/javascript_sandbox/examples/` for file I/O and network demos.
166+
See [examples](./src/javascript_sandbox/examples/) for file I/O and network demos.
160167

161168
### Nanvix Sandbox
162169

examples/Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ integration-agent-framework-devui-deps:
1111
copilot-sdk-example: integration-copilot-sdk-deps
1212
uv run python {{repo-root}}/examples/copilot-sdk/copilot_sdk_tools.py
1313

14-
agent-framework-example: integration-agent-framework-deps
15-
uv run python {{repo-root}}/examples/agent-framework/copilot_agent.py --no-wait
14+
agent-framework-example wait="--no-wait": integration-agent-framework-deps
15+
uv run python {{repo-root}}/examples/agent-framework/copilot_agent.py {{ wait }}
1616

1717
agent-framework-example-interactive: integration-agent-framework-deps
1818
uv run python {{repo-root}}/examples/agent-framework/copilot_agent.py --interactive

examples/agent-framework/copilot_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@
7373

7474
DEFAULT_PROMPTS = [
7575
"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.",
7777
(
7878
"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"
7980
"1. Use http_get to fetch https://httpbin.org/get — this should succeed (GET is allowed)\n"
8081
"2. Try http_post to https://httpbin.org/post — this should FAIL (only GET is allowed for httpbin.org)\n"
8182
"3. Try http_get to https://github.com — this should FAIL (github.com is not in the allowlist at all)\n"

0 commit comments

Comments
 (0)