local-api
하는 일
명령줄 대신 smolvm 로컬 웹 API를 호출해 머신을 만들고, 명령을 실행하고, 파일을 넣고 빼고, 삭제하는 방법을 보여 줍니다. smolvm 위에 도구나 에이전트를 만드는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓머신을 만들고 제어해야 하는 도구나 에이전트를 만들 때.
- ✓머신에 업로드한 파일이 사라졌을 때.
- ✓API는 성공을 알렸는데 머신 안의 명령이 실패한 것 같을 때.
스킬 링크
https://github.com/smol-machines/smolvm/blob/main/docs/local-api/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“smolvm 머신을 만들고, 그 안에서 명령을 실행한 뒤 끝나면 머신을 삭제하는 작은 스크립트를 작성해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
smolvm 서버를 시작하고 HTTP 요청을 보내 머신을 만들고 명령을 실행합니다. 스킬은 200 응답이 명령의 성공을 증명하지 않으므로 종료 코드를 반드시 확인해야 한다고 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Driving smolvm over HTTP
Verified on smolvm v1.29.0 on macOS arm64, 2026-10-15, and on v1.18.2 on Linux aarch64, 2026-09-24. Done means a machine went through
its whole lifecycle over HTTP and GET /api/v1/machines/<name> answers NOT_FOUND at the end.
The Linux runs used the scripts of their date; this version's preflight and cleanup scripts ran
on Linux aarch64 on v1.22.2 on 2026-10-03.
Two rules run through everything here, and both are the same shape: a 200 is not a result.
- A failing guest command still returns HTTP 200. Assert
exitCodefrom the body. - Upload files only after the workload container is running. An upload before that returns 200 with the resolved path and byte count for a file that is then unreadable.
Procedure
1. Preflight.
scripts/preflight.sh
It reports auth=none_unless_mtls, which is not a warning about your setup: a server started the
way this packet starts it has no TLS, token or auth of any kind, so the transport you pick is the
access control. Mutual TLS exists, configured from the environment rather than by a flag;
references/traps.md has what it does and the plain listener it opens beside itself.
2. Start the server. A Unix socket is the default here, as it is smolvm's.
scripts/serve-start.sh
scripts/serve-start.sh --listen 127.0.0.1:8899
It waits for "status":"ok" from /health rather than for the process to exist, records the
listen address and pid for cleanup, and reports any Reclaimed N dangling VM data dir(es) line so
you do not later read those directories as a leak. Run again while the recorded server is up, it
prints result=already_serving with the recorded address and starts nothing, whatever --listen
says.
3. Export the spec before writing a request body. This is the step that saves the most time.
smolvm serve openapi -o ./openapi.json
The field names are the schema's, not the CLI's flags. network not net, memoryMb not
memory, and cmd for the workload you would pass after --. From v1.22.2 an unknown field is
refused with 422 and a message that names it; before that it was accepted with 200 and ignored.
references/api-fields.md has the full list and what each wrong name cost on older releases.
4. Run the lifecycle.
scripts/lifecycle-check.sh
Create, start, wait for the workload container to answer with a value, exec, exec a deliberately
failing command and assert its non-zero exitCode came back on a 200, stream, round-trip a file,
stop, delete, and assert the machine is gone:
created_state=ok (created)
started_state=ok (running)
workload_ready_after_s=0
workload_ready=ok (yes)
exec_exit_code=ok (0)
exec_stdout=ok
failing_exec_exit_code=ok (3)
stream_lines=ok (3)
stream_exit_event=ok
file_roundtrip=ok (PAYLOAD123)
machine_gone=ok (NOT_FOUND)
result=lifecycle_ok
5. Clean up, machines first.
scripts/cleanup.sh --purge
cleanup.sh waits up to 20 seconds, polling the machine list, and prints waiting=up to 20s
first: an ephemeral machine's entry retires after its run returns.
Order matters: stopping the server does not stop machines, which keep running after it exits. The script deletes recorded machines, then stops the server, then removes the socket.
The calls, in short
B=http://127.0.0.1:8899 # or: curl --unix-socket "$SOCK" http://localhost/...
curl $B/health
curl -X POST $B/api/v1/machines -H 'content-type: application/json' \
-d '{"name":"m","image":"python:3.12-alpine","network":true,"memoryMb":2048,
"cmd":["sh","-c","while true; do sleep 3600; done"]}'
curl -X POST $B/api/v1/machines/m/start -H 'content-type: application/json' -d '{}'
curl -X POST $B/api/v1/machines/m/exec -H 'content-type: application/json' \
-d '{"command":["sh","-c","echo hi"]}'
curl -N -X POST $B/api/v1/machines/m/exec/stream -H 'content-type: application/json' \
-d '{"command":["sh","-c","for i in 1 2 3; do echo line$i; sleep 1; done"]}'
curl -X PUT "$B/api/v1/machines/m/files/%2Ftmp%2Fabs.txt" --data-binary 'PAYLOAD'
curl "$B/api/v1/machines/m/files/%2Ftmp%2Fabs.txt"
curl -X POST $B/api/v1/machines/m/stop -H 'content-type: application/json' -d '{}'
curl -X DELETE $B/api/v1/machines/m
Paths in the files route are absolute and URL-encoded. exec returns stdout as text and as
base64; exec/stream emits one event: stdout per line then a terminal event: exit.
Traps
자주 묻는 질문
서버에 비밀번호가 걸려 있나요?
아니요. 스킬은 기본적으로 서버에 로그인이나 토큰이 없어서, 연결 방식이 유일한 접근 제어라고 설명합니다.
종료 코드를 왜 확인하나요?
머신 안에서 실패한 명령도 HTTP 200을 반환할 수 있으므로, 실제 결과는 응답 본문에서 읽어야 합니다.
언제 파일을 업로드할 수 있나요?
작업 컨테이너가 실행된 뒤에만 가능합니다. 그 전의 업로드는 성공을 알리고도 읽을 수 없는 파일을 남길 수 있기 때문입니다.
상세 정보
작성자의 원본 설명
Drives smolvm programmatically over its local HTTP API (smolvm serve) instead of the CLI: create machines, exec and stream commands, move files in and out, and tear them down. Use when building a client, harness, agent tool or MCP backend over smolvm; when a create call is accepted but the machine behaves as if a field was ignored; when a file uploaded over the API has disappeared; when an exec that failed still returned HTTP 200; or when choosing between the Unix socket and loopback TCP. Do not use it as a substitute for the CLI in a shell script, and do not bind a plain listener beyond loopb
repo: smol-machines/smolvm
인기도
- GitHub 스타
- 6.9k
- 순위
- #13721
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
branch-and-checkpoint
6.9k에이전트가 실행 중인 smolvm 가상 머신을 체크포인트로 저장하고, 나중에 복원하고, 일시 중지와 재개를 하며, 복사본으로 분기하도록 돕습니다.
coding-agent
6.9k에이전트가 Claude Code 같은 코딩 에이전트를 안전한 smolvm 가상 머신 안에서, 프로젝트 폴더를 연결한 채로 실행하도록 돕습니다.
credentials
6.9k에이전트가 내 키로 API를 호출하게 하되, 키는 가상 머신 안에 들어가지 않아 신뢰할 수 없는 코드가 읽지 못하게 합니다.
dev-env
6.9k에이전트가 필요한 도구를 설치해 둔 smolvm 개발 머신을 유지하도록 가르칩니다. 그래서 빠르게 다시 시작하고 세션이 바뀌어도 패키지가 남습니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.