Skip to main content

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


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.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forgevm-0.1.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file forgevm-0.1.2.tar.gz.

File metadata

  • Download URL: forgevm-0.1.2.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

Hashes for forgevm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bcb5f0663f1e3f9a589efc7c706899bed45d7d42c1a5381e3fbbf1d0317eff2a
MD5 56f16d35a4571d5fda52d1291b69e94c
BLAKE2b-256 b54e4d607c4d6445a793467f6295f20d0f8519b583d08a6435f56126654ac238

See more details on using hashes here.

File details

Details for the file forgevm-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: forgevm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for forgevm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17f8449341a624f93a20cd55ccb2606a3db784f3a976842c27674a501f66ab41
MD5 065ef21a586d274b57eca12ad0d28eb3
BLAKE2b-256 c5f4901942582367bedbcb6c9f4bc6a83b50da8cfac9d3d0f1a9e20ee4a2dd6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page