Getting started

Install the SDK, scaffold an app, deploy in two commands.

💡

Before you begin

Make sure you have Python 3.12 or newer installed. A free gworker account is required to deploy and run tasks on the unified serverless GPU cloud.

01

Install

Install the Python SDK and CLI from PyPI. Python 3.12+ is required.

bash
1pip install gworker-client
02

Log in

Authenticate with your gworker account. Your token is saved to ~/.gworker/credentials and picked up automatically by all subsequent CLI and SDK calls.

bash
1gworker login
03

Scaffold

Create a project directory. This writes src/app.py with a starter task and gworker.toml with your app name and region.

bash
1gworker init my-app2cd my-app
04

Your first task

Decorate an async function with @app.task. Resources (gpu, memory, timeout) are declared here — not at call time. Heavy imports belong inside the function body so cold starts stay fast.

python
1import gworker_client as gw2 3app = gw.App("my-app")4 5@app.task(gpu=gw.Gpu("A100"), memory=8192, timeout=600)6async def greet(name: str) -> str:7    return f"hello {name}"
05

Deploy

Upload your source. gworker selects a backend, builds the container, and returns an endpoint URL. The first build is slow; subsequent deploys hit the cache.

bash
1gworker deploy --env dev
06

Call the task

Invoke the deployed task from Python. .run() blocks until the result is ready. .spawn() returns a handle you can await later.

python
1from my_app.src.app import greet2 3result = greet.run("world")4print(result)  # "hello world"
07

Tail logs

Stream stdout and stderr from all running workers. Press Ctrl-C to stop.

bash
1gworker logs my-app --follow