Skip to content

Quickly sandbox your AI agent.

Python

Demonstrate multiple guest users in README

Tyler Payne5b358f819df5
diff --git a/README.md b/README.md
index bf17b86..0ad471b 100644
--- a/README.md
+++ b/README.md
@@ -83,17 +83,17 @@ Give multiple agents independent linux user accounts in a single sandbox VM.
```python
async with Sandbox(image="ubuntu") as sb:
alice = await sb.create_user("alice")
- await alice.execute("cat > hello.txt", stdin="Hello from Alice!\n")
+ bob = await sb.create_user("bob")
- result = await alice.execute("whoami && pwd && cat hello.txt")
- print(result.stdout)
+ await alice.execute("cat > hello.txt", stdin="Hello from Alice!\n")
+ await bob.execute("cat > hello.txt", stdin="Hello from Bob!\n")
- await sb.delete_user("alice") # Also removes the user's home directory
+ for user in (alice, bob):
+ result = await user.execute("whoami && pwd && cat hello.txt")
+ print(result.stdout)
+ await sb.delete_user(user.name)
```
-Users share one VM, not separate VM isolation boundaries. Requires Ubuntu or
-Alpine image packages 0.10.0 or newer, or a custom image with the updated guest agent.
-
### Save and load
Save the VM's disk state to a directory. Load it later, even on a different machine.
diff --git a/packages/quicksand/README.md b/packages/quicksand/README.md
index bf17b86..0ad471b 100644
--- a/packages/quicksand/README.md
+++ b/packages/quicksand/README.md
@@ -83,17 +83,17 @@ Give multiple agents independent linux user accounts in a single sandbox VM.
```python
async with Sandbox(image="ubuntu") as sb:
alice = await sb.create_user("alice")
- await alice.execute("cat > hello.txt", stdin="Hello from Alice!\n")
+ bob = await sb.create_user("bob")
- result = await alice.execute("whoami && pwd && cat hello.txt")
- print(result.stdout)
+ await alice.execute("cat > hello.txt", stdin="Hello from Alice!\n")
+ await bob.execute("cat > hello.txt", stdin="Hello from Bob!\n")
- await sb.delete_user("alice") # Also removes the user's home directory
+ for user in (alice, bob):
+ result = await user.execute("whoami && pwd && cat hello.txt")
+ print(result.stdout)
+ await sb.delete_user(user.name)
```
-Users share one VM, not separate VM isolation boundaries. Requires Ubuntu or
-Alpine image packages 0.10.0 or newer, or a custom image with the updated guest agent.
-
### Save and load
Save the VM's disk state to a directory. Load it later, even on a different machine.