Skip to main content
The simplest possible deployment: a single function with no context or dependencies.

Deployment

# deploy.py
from vastai import Deployment
from vastai.data.query import gpu_name, RTX_4090, RTX_5090

app = Deployment(webserver_url="https://alpha-server.vast.ai")


@app.remote(benchmark_dataset=[{"x": 2}])
async def square(x):
    return x * x


app.configure_autoscaling(min_load=1000)
image = app.image("vastai/base-image:@vastai-automatic-tag", 16)
image.require(gpu_name.in_([RTX_4090, RTX_5090]))
app.ensure_ready()

Client

# client.py
import asyncio
from deploy import app, square


async def main():
    for x in range(1, 10):
        result = await square(x)
        print(f"square({x}) = {result}")


if __name__ == "__main__":
    asyncio.run(main())

What This Demonstrates

  • Minimal @remote function with no dependencies
  • Using benchmark_dataset with a single sample input
  • Calling a remote function in a loop