Python SDK for ForgeVM — self-hosted microVM sandboxes for LLMs
Project description
ForgeVM Python SDK
Python client for ForgeVM -- self-hosted compute sandboxes for LLMs.
Install
pip install forgevm
Quick Start
from forgevm import Client
client = Client("http://localhost:7423")
# Spawn a sandbox
sandbox = client.spawn(image="alpine:latest")
# Execute commands
result = sandbox.exec("echo hello")
print(result.stdout) # "hello\n"
# File operations
sandbox.write_file("/tmp/hello.txt", "Hello, world!")
content = sandbox.read_file("/tmp/hello.txt")
# Extend TTL
sandbox.extend_ttl("30m")
# Auto-cleanup with context manager
with client.spawn(image="python:3.12") as sb:
sb.exec("python3 -c 'print(1+1)'")
# sandbox destroyed automatically
# Streaming output
for chunk in sandbox.exec_stream("ping -c 3 localhost"):
print(chunk.data, end="")
sandbox.destroy()
Async Support
from forgevm import AsyncClient
async with AsyncClient("http://localhost:7423") as client:
sandbox = await client.spawn(image="alpine:latest")
result = await sandbox.exec("echo hello")
await sandbox.destroy()
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
forgevm-0.1.1.tar.gz
(13.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
forgevm-0.1.1-py3-none-any.whl
(11.3 kB
view details)
File details
Details for the file forgevm-0.1.1.tar.gz.
File metadata
- Download URL: forgevm-0.1.1.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba78c5f6ccf353bc213af591fb78f00a772f6ee2ae56511a703c597ced1f2195
|
|
| MD5 |
87f765b067ffcd5da4c82ce92a54d8fc
|
|
| BLAKE2b-256 |
67434b9211ee0228883920666382f367dff4f15b115c4c357b8ff95ebc1b0c67
|
File details
Details for the file forgevm-0.1.1-py3-none-any.whl.
File metadata
- Download URL: forgevm-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c4ca488ec8b0cb3cc2d5ffcfa3e3ca6a58e4f9aea641a08a02a0a96498b73da
|
|
| MD5 |
ce1280c33887b5d206cb6f70bec34844
|
|
| BLAKE2b-256 |
bb7e208f63184bace5621c282e46c36fde88e4971162cf415a42873a696d4919
|