runware-serverless
The surface you write a Runware Serverless app against: two decorators, and nothing else to install.
pip install runware-serverless
from runware_serverless import endpoint, serve
@serve
class ImageTools:
def load(self) -> None:
self.pipe = load_my_pipeline()
@endpoint
def generate(self, prompt: str, steps: int = 4) -> dict:
return {"image": self.pipe(prompt, steps).encode()}
runware serverless deploy model.py --id image-tools --gpu-type h100
See the Serverless documentation for the whole picture. This package is only the part your editor needs.
examples/ has two apps you can deploy as they are: the smallest one that works, and one with two endpoints whose request shapes have nothing in common.
What the decorators do
@serve marks the class as the app. @endpoint marks a method as callable, at the path its own name derives: run_upscale serves run-upscale.
Neither one wraps what it decorates. Both record and hand the class or the method straight back, so your file stays importable and your own tests can instantiate the class and call its handlers directly.
load runs before any request reaches the worker. It is required, even when there is nothing to load, because it is part of how a deployment class is identified.
It can run more than once. A load that runs out of VRAM is retried with a larger request, and the retry re-instantiates your class, so both __init__ and load have to be safe to repeat.
What it does not do
This package holds no serving machinery, no build logic and no runtime. The base install declares no dependencies at all, so it costs you nothing and it cannot conflict with your model's own requirements.
When you deploy, Runware supplies the implementation behind these same two names. That is why the decorators record rather than execute: the marks they leave are what the platform reads when it imports your file.
You do not need to list this package in your own requirements. A deploy ignores it if you do, and serves its own copy either way.
Images in a request
An image travels as a base64 string. Annotate it on a field of a request model, and take that model as your handler's parameter:
import pydantic
from runware_serverless import endpoint, serve
from runware_serverless.schema import Base64RGBImage
class UpscaleTask(pydantic.BaseModel):
image: Base64RGBImage
factor: int = 2
@serve
class Upscaler:
def load(self) -> None: ...
@endpoint
def upscale(self, task: UpscaleTask) -> dict:
return {"width": task.image.width * task.factor}
The platform publishes a string of format: base64 for that field, decodes
what a caller sends, and task.image is a PIL.Image by the time your method
runs. A malformed payload is refused before that, as a validation error naming
the field.
It has to be a field on a model. A bare parameter, def upscale(self, image: Base64RGBImage), is left exactly as it arrived: the platform binds a parameter
by validating the model it names, so a parameter that is not a pydantic.BaseModel
is passed through untouched and your method receives the raw string.
Base64RGBAImage is the same thing for an image whose alpha channel has to
survive. Base64RGBImage converts to RGB.
These are the one part of the package with dependencies, Pillow and pydantic, so they come as an extra rather than in the base install:
pip install 'runware-serverless[schema]'
Configuration lives on the app
GPU type, worker counts, idle TTL and concurrency are set on the app, through the CLI, the API or the dashboard, and are changeable while it is serving. None of them are expressible in your source file, and the decorators take no arguments for them.
See Compute and scaling.
Requirements
Python 3.10 or newer, and nothing else unless you annotate an image, which needs the schema extra above.
License
MIT
Metadata
Release files for runware-serverless 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| runware_serverless-0.1.0.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| runware_serverless-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.3 kB
Release files / runware_serverless-0.1.0.tar.gz
| Download URL | runware_serverless-0.1.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd705183fa0b32845dd75906c6b320d825aa5e412b60ea0685256679ab3db5bf
|
|
BLAKE2b-256 checksum How to use checksums |
483988e5531060bf1a567b3cbf5da56f821679ff17b28e9443b3cf08e3aabd30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / runware_serverless-0.1.0-py3-none-any.whl
| Download URL | runware_serverless-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19aa5c9eaa61b6147e337772a06faca39b69d4bf42765be977f01e1f60a5da86
|
|
BLAKE2b-256 checksum How to use checksums |
dfbd2dd3ae1910fdcfa4e393969df4cc8f4da268db4b67857f7dbb2487a9132c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency log