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.0.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.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: forgevm-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a05f6876d70310dd12229b212455b0766b8727a9c51221136705113a75a74dbd
MD5 8f5f25603ad550daa78f389885307b5c
BLAKE2b-256 e6f8ae56534bc8e890c02bf080026437c033ed2a2a12ad8a23933adb7ffffb34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: forgevm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5a689c9b7b384d8c7f57ffca1bc85057fb1031fa8a792418df404310a4e007
MD5 c1388b101c6ebc7bf6df227bf8651145
BLAKE2b-256 e9d7c2ed6aae3117939465a3fb8ece86fa112b365c559b9b9077b1cbca633e6c

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