Chuyển đến nội dung
Skillpedia
Lập trình chung19k · #10485

iii-sandbox

Skill này làm gì

Chạy mã trong các máy ảo cô lập, tồn tại ngắn, để mã từ nguồn không rõ không thể chạm vào hệ thống chính của bạn. Dành cho lập trình viên xây agent hoặc công cụ AI chạy mã mà họ không tự viết.

Khi nào nên dùng

  • ✓Khi một agent cần chạy mã mà bạn không hoàn toàn tin tưởng.
  • ✓Khi bạn muốn thử một đoạn mã trong một môi trường sạch sẽ bị hủy.
  • ✓Khi bạn cần chạy nhiều lệnh hoặc chỉnh sửa tệp trong cùng một sandbox cô lập.

Liên kết skill

https://github.com/iii-hq/iii/blob/main/crates/iii-worker/src/sandbox_daemon/skills/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/iii-hq/iii/blob/main/crates/iii-worker/src/sandbox_daemon/skills/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chạy đoạn Python không đáng tin này trong một sandbox cô lập và cho tôi xem kết quả.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill khởi động một máy ảo nhỏ, chạy mã hoặc lệnh bên trong nó, rồi trả về kết quả. Với công việc nhiều bước, sandbox được giữ hoạt động qua các lần gọi, sau đó được dừng và các tệp tạm bị hủy.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

iii-sandbox

The iii-sandbox worker boots ephemeral libkrun microVMs and runs code inside them, isolated from the host. Each sandbox boots in a few hundred milliseconds, runs commands or file operations scoped to the engine it lives on, and is reaped when idle; the overlay filesystem is discarded on stop. Its sandbox::* functions are called like any other iii function.

There are two ways in. sandbox::run is the fast path: it boots a VM, runs a code snippet, captures stdout/stderr, and tears the VM down in a single call. For multi-step work — several commands, multiple files, or inspecting a VM between steps — use the sandbox::create → sandbox::exec / sandbox::fs::* → sandbox::stop lifecycle and carry the returned sandbox id across calls.

Prerequisites: enable iii-sandbox under engine.workers (or the five-worker allowlist of a directly supervised engine), and provide hardware virtualization (Apple Silicon, or /dev/kvm on Linux). Intel Macs and Windows cannot boot sandboxes.

Get the contract from the engine

This page tells you WHEN and HOW to use the sandbox; the engine is the source of truth for every function's exact arguments and responses. Before you call any sandbox::* function, fetch its contract and build your payload from that — do not guess field names, types, or formats from memory:

engine::functions::info { function_id: "sandbox::<fn>" }

(e.g. { function_id: "sandbox::fs::write" }). The returned schema is authoritative; this skill never restates it.

Running an iii worker inside a sandbox

To author an iii worker (read the iii skill first), you write the worker code into the sandbox, install its deps, and run it as a process there — but the worker must still join the HOST engine bus to be useful.

  • Reaching the host engine: enable networking when you create the sandbox (the field is in the sandbox::create contract — fetch it), AND set the worker's engine-URL env (III_ENGINE_URL, e.g. ws://localhost:49134) IN THE sandbox::create env — NOT later at exec/run time. The localhost→host rewrite happens ONLY for the create-time env: a localhost / 127.0.0.1 engine URL set there is rewritten to the per-sandbox gateway so the worker reaches the host bus. The same localhost URL passed at sandbox::exec time is NOT rewritten — it points at the sandbox's own loopback, the worker silently fails to connect, and you will waste turns debugging TCP. So: put the engine URL in the create env; the worker process inherits it already rewritten.
  • Run it backgrounded, never as a foreground exec: starting the worker with sandbox::exec "node index.mjs" blocks and times out (S200 exec timed out), because the process never returns. Launch it detached (… &, nohup, or sandbox::run shell mode) so the exec call returns while the worker keeps running — see the serialized-exec boundary below.
  • Find the result: once the worker connects, its functions appear in engine::functions::list and any http trigger it binds is served by the Compose http worker; verify endpoints with web::fetch, not curl.
  • EPHEMERAL by nature: a worker hosted in a sandbox dies when the sandbox is stopped or reaped (the overlay is discarded). That is fine for a demo, test, or one-off. Declare a long-lived worker as a Compose container instead of hosting it in a sandbox.

When to Use

  • Execute untrusted or LLM-generated code without exposing the host.
  • One-shot "code in, stdout out" — reach for sandbox::run.
  • Spin up an ephemeral build worker, integration-test fixture, or throwaway iii worker.
  • Read, write, search, or edit files inside an isolated filesystem.

Boundaries

  • A sandbox is for running code and build steps, NOT for hosting a long-lived server. To expose an HTTP API or any always-on endpoint, author an iii worker and register a trigger for it (an http trigger is served by the Compose http worker) — do NOT start a server process (express, http.createServer, a framework listen()) inside the sandbox. A server you start here is not routed by iii, is unreachable as an iii endpoint, and as a foreground process hangs the exec slot until it times out. If the task is "build an iii worker," the deliverable is registered functions plus a trigger, not a running server.
  • Not for long-lived services or durable state — the overlay is wiped on stop. Use a regular worker for daemons and the Compose state worker for persistence.
  • Bootable images are catalog NA
Câu hỏi thường gặp

Những máy tính nào chạy được?

Mac Apple Silicon, hoặc máy Linux có ảo hóa phần cứng. Mac Intel và Windows không thể khởi động các sandbox này.

Nó có giữ tệp của tôi sau đó không?

Không. Hệ thống tệp tạm bị hủy khi sandbox dừng.

Tôi có cần biết chi tiết hàm không?

Không. Skill lấy đúng đối số của từng hàm từ engine trước khi gọi.

Chi tiết

Mô tả gốc của tác giả

Ephemeral microVM sandboxes for running untrusted or agent-generated code in isolation — a one-call run path, a create/exec/stop lifecycle, and a set of filesystem operations.

repo: iii-hq/iii

Độ phổ biến

Sao GitHub
19k
Vị trí xếp hạng
#10485
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự