Skip to main content

runware-serverless

The surface you write a Runware Serverless app against: two decorators, with no dependencies in the base install.

To start, use the one-command install. It installs the CLI, or uses the CLI that you already have. If that CLI is too old, the install updates it. Then the install creates an app directory with runware serverless init.

macOS / Linux:

curl -fsSL https://serverless.runware.ai/install.sh | sh -s -- my-app

Windows (PowerShell):

$env:RUNWARE_APP_DIR = "my-app"; irm https://serverless.runware.ai/install.ps1 | iex

If you already have the CLI:

runware serverless init my-app

init creates the app directory my-app with a pyproject.toml, a starter app.py and a .venv that has the package (runware-serverless) as a dev dependency. init installs nothing globally: the package goes only into the app directory's .venv. If uv is on your PATH, init uses uv. If not, init uses Python 3.10 or newer.

To use a different app name, replace my-app in each command. The name is also the app ID for deploy --id. An app ID has 6 to 30 characters: lowercase letters, digits and -. It starts with a letter and ends with a letter or a digit.

To log in and deploy the starter app, see the Serverless quickstart.

To add the package to a project that you already have, install it in that project's virtual environment: run uv add --dev runware-serverless, or run python -m pip install runware-serverless with that environment active.

An app looks like this:

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 app.py --id image-tools --gpu-type h100

See the Serverless documentation for the whole picture. The package is only the part your editor needs.

Runware/runware-serverless-examples holds apps you can deploy as they are, each one the code behind a page in the documentation.

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. It takes two optional keyword arguments: path, for a route a method name cannot spell, such as @endpoint(path="v1/chat/completions"), and default=True, for the endpoint a root invocation reaches with no path at all.

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 the platform identifies an app.

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.

Declaring your app's dependencies

List what your app imports beyond the standard library as a requirements attribute on the class:

@serve
class ImageTools:
    requirements = ["torch==2.5.1", "diffusers>=0.31"]

    def load(self) -> None: ...

It has to be a list or tuple of strings, and the name is reserved, so a handler called requirements is refused.

The build reads the first list it finds: this attribute, then whatever the deploy passed as --requirement, then a pyproject.toml and uv.lock in your app directory. Declaring it on the class and on the deploy at the same time fails the build rather than picking one.

Serving-time imports

The build imports your file to find its endpoints, and it does that with none of your dependencies installed, so a module-level import torch fails the build. Put those imports in a block:

from runware_serverless import endpoint, imports, serve

with imports():
    from my_model.manager import InferenceManager


@serve
class MyModel:
    manager: "InferenceManager | None" = None

    def load(self) -> None:
        self.manager = InferenceManager()

    @endpoint
    def predict(self, prompt: str) -> str:
        return self.manager.run(prompt)

At serving time the block runs and binds its names at module scope, so load and your handlers use them without importing again. At build time the platform suppresses whatever the block raises.

The quotes on the annotation are needed. At build time the import was suppressed, so the name is unbound, and a class-level annotation is evaluated when the class body runs. A module with from __future__ import annotations needs no quotes, because every annotation in it is already a string.

The block holds imports and nothing else. A statement in it that fails for its own reason is suppressed at build time too, and silently.

Your own machine is not a build. This package suppresses nothing, so a missing dependency is your own ImportError at the line that caused it. A test suite that imports your model file therefore needs your serving dependencies installed, where imports inside load let the file import anywhere.

What it does not do

The package has no serving machinery, no build logic and no runtime. The base install declares no dependencies, so it adds nothing to your install and cannot conflict with your app's own requirements.

When you deploy, Runware supplies the implementation behind these same three 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 the 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. Add the extra in the app directory, not globally.

If uv is on your PATH, run this command in the app directory:

uv add --dev 'runware-serverless[schema]'

If not, install the extra with the Python in the app directory's .venv:

.venv/bin/python -m pip install 'runware-serverless[schema]'

On Windows, use .venv\Scripts\python in place of .venv/bin/python.

The pip command does not change pyproject.toml. To record the extra, find the runware-serverless entry in the dev list under [dependency-groups]. Then add [schema] after the name, for example 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.

Python version

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.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runware-serverless 0.3.0
File Size Uploaded Provenance Actions
runware_serverless-0.3.0.tar.gz 18.4 kB With provenance Details for runware_serverless-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for runware-serverless 0.3.0
File Interpreter ABI Platform Actions
runware_serverless-0.3.0-py3-none-any.whl Python 3 none any Details for runware_serverless-0.3.0-py3-none-any.whl

Total release size: 31.8 kB

Release files / runware_serverless-0.3.0.tar.gz

Download URL runware_serverless-0.3.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6c82217e9f9666acb329b4934dd4eb1afa3f4401d5ac91fb318f5dd6196b0472
BLAKE2b-256 checksum
How to use checksums
4041a14f3be5e521b8ae71b3d0e5c0b8323e0bfe5905d874cb8ddaec051c54be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Release files / runware_serverless-0.3.0-py3-none-any.whl

Download URL runware_serverless-0.3.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8c9073de27ff6beda13fff6c0f51cc23e3ac8a1a13dc107ec2157bdc7512e4e
BLAKE2b-256 checksum
How to use checksums
b4cdf848a4e1ee4c5b8437eec8528a861687e70b5b5313f2037c12a1276e3815
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for runware-serverless 0.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for runware_serverless-0.3.0.tar.gz

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 Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page