docs
Python SDKCore Concepts

Deploy

Deployment is declarative — @app.function declares how your code serves; the urun CLI ships it

Deployment in uRun is declarative. There is no urun.deploy() call inside your Python file. You declare what your function needs with the @app.function() decorator, then ship the file with the urun CLI. uRun owns provisioning, scaling, and lifecycle from that declaration.

The two halves

  1. Declare — the decorator captures the function's config: GPU shape, dependencies, credentials, session length (lease / max_session_s), warm replicas.

    from urun import App, Context
    from urun.core import Dependencies, Credentials
    
    app = App("inference")
    DEPS = Dependencies(python=["torch>=2.5.0", "transformers"])
    CREDS = Credentials(optional_env=["HF_TOKEN"])
    
    @app.function(gpus="h100:1", deps=DEPS, credentials=CREDS)
    def serve(ctx: Context, prompt: str = "Hello"):
        ...
  2. Ship — the urun CLI packages the app directory, registers a content-addressed manifest, uploads any missing blobs, and builds it to readiness:

    urun deploy app.py

The function name (serve) becomes the dispatch name a browser invokes via app.serve(...).

Why declarative

Putting the config in the decorator (not in an imperative launch script) lets uRun manage the full lifecycle — admission, GPU warm-up, scaling, restarts, and teardown — without you writing orchestration code. The build is content-addressed, so redeploying only uploads what changed.

Managing a deployed app

Operate apps from the CLI:

urun app list                          # status of every deployed app
urun app status serve-app               # one app's build / promotion / capacity state
urun app scale serve-app --replicas 3   # scale up; --replicas 0 drains
urun app disable serve-app              # pause it; urun app enable to reverse
urun app delete serve-app               # retire the app outright

See the CLI reference for the full surface, including the app STATUS derivation table.

Args are not config

Arguments you pass when invoking a function (app.serve({ prompt: "…" })) are delivered verbatim to the function — they map 1:1 to its args/kwargs. The GPU shape is decorator config, fixed at deploy. Session creation cannot override them, and reserved-looking arg names (like gpus) are passed through untouched, never reinterpreted as resource overrides.

Related:

  • App — the @app.function decorator and runtime overrides
  • Compute — GPU/CPU specs and replica groups
  • CLIurun deploy, list, scale, and friends

On this page