---
artifact_id: ao-security-e2b-cloud-sandboxes-code
kind: code-snippet
slug: ao-security-e2b-cloud-sandboxes
iil_id: null
note_url: https://iinventedlight.com/library/notes/ao-security-e2b-cloud-sandboxes/
title: "Illustration: create an E2B sandbox and run a command"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
as_of: 2026-11-16
status: week-draft-20261116
untested: "Not executed (needs an E2B account and API key). Calls restated from the round-1 note."
related_slugs:
  - ao-security-e2b-cloud-sandboxes
  - ao-security-gemini-cli-sandbox
source_notices: >
  The note cites Apache-2.0 (e2b-dev/E2B (GitHub)); Apache-2.0 (google-gemini/gemini-cli (GitHub)); prose restates cited source lines in own words. This snippet is an original illustration, not a copy of a docs example.
---

# Illustration for ao-security-e2b-cloud-sandboxes (round-1 draft, not live yet)

The round-1 note: the README calls `Sandbox.create()`, then runs a command with `sandbox.commands.run`.

```js
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create()          // uses E2B_API_KEY from the environment
const result = await sandbox.commands.run('echo hello from the sandbox')
console.log(result.stdout)
await sandbox.kill()
```

This file is a local draft for the 16 November week. It is not live.
