Expose ports dynamically for services running inside your sandbox
The Sandbox provides some basic network tools. You can run web services and expose them to the internet behind SSL-terminated endpoints. This is useful for web development, API testing, and running interactive applications with LLMs (think v0, reflex.build, etc).
from beam import Sandbox, Imagesandbox = Sandbox(image=Image(python_version=PythonVersion.Python311))sb = sandbox.create()# Expose port 8000url = sb.expose_port(8000)print(f"Port 8000 exposed at: {url}")# The URL will be something like:# https://384ced3c-f837-4429-bada-39e0b965c9f4-8000.app.beam.cloud