docs/getting-started/quickstart.mdx
npx microsandbox run debian
<CodeGroup>
```bash Rust
cargo add microsandbox
```
```bash TypeScript
npm install microsandbox
```
```bash Python
pip install microsandbox
```
```bash CLI
curl -fsSL https://install.microsandbox.dev | sh
```
</CodeGroup>
<CodeGroup>
```rust Rust
use microsandbox::Sandbox;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let sb = Sandbox::builder("hello")
.image("python")
.memory(512)
.create()
.await?;
let output = sb.exec("python", ["-c", "print('Hello from a microVM!')"]).await?;
println!("{}", output.stdout()?); // Hello from a microVM!
sb.stop().await?;
Ok(())
}
```
```typescript TypeScript
import { Sandbox } from "microsandbox";
await using sb = await Sandbox.builder("hello")
.image("python")
.memory(512)
.create();
const output = await sb.exec("python", ["-c", "print('Hello from a microVM!')"]);
console.log(output.stdout()); // Hello from a microVM!
```
```python Python
import asyncio
from microsandbox import Sandbox
async def main():
sb = await Sandbox.create(
"hello",
image="python",
memory=512,
)
output = await sb.exec("python", ["-c", "print('Hello from a microVM!')"])
print(output.stdout_text) # Hello from a microVM!
await sb.stop()
asyncio.run(main())
```
```bash CLI
msb run python -- python3 -c "print('Hello from a microVM!')"
```
</CodeGroup>
Here's what actually happened behind that Sandbox.builder(...).create() call:
The exec call sent a message to that guest agent, which spawned python inside the VM, streamed stdout back, and returned the exit code. No SSH involved, no network overhead. The command channel is completely separate from the sandbox's network stack.
exec, shell, attach, and streaming