Files
windmill/python-client
Ruben Fiszel 52fc7bf94c feat(sdk): allow overriding worker tag when running jobs (WIN-2105) (#9807)
* feat(sdk): allow overriding worker tag when running jobs

Add an optional `tag` parameter to every job-running helper across the
TypeScript, Python, PowerShell and Rust client SDKs. When set, it is
forwarded as the `tag` query param on the `jobs/run/*` endpoints, which
the backend already honors as a worker-tag override.

The parameter is appended last and defaults to null/None everywhere, so
existing positional and keyword callers are unaffected. Rust has no
optional params, so its existing `run_script_async`/`run_script_sync`
signatures are left untouched and new `*_with_tag` variants are added.

Fixes WIN-2105

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(system_prompts): regenerate SDK docs for tag param

Regenerate auto-generated system prompts so the TypeScript/Python SDK
references (and the script skills that embed them) reflect the new
optional `tag` parameter on the job-running helpers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(powershell-sdk): preserve original RunScriptAsync/RunFlowAsync arities

PowerShell class methods dispatch by exact argument count and have no
default parameter values, so adding `$Tag` in place dropped the old
4-arg `RunScriptAsync` / 3-arg `RunFlowAsync` overloads — existing direct
class calls would fail with "Cannot find an overload". Re-add the
original arities as thin overloads that forward `$null` for `$Tag`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(system_prompts): generate prompts.d.ts to stop literal-content drift

prompts.d.ts was a tracked declaration file with string-literal types
baked in, but generate.py never regenerated it — only prompts.ts and the
hand-written index.d.ts. So every prompt change (e.g. the new SDK `tag`
param) left prompts.d.ts stale, and check-freshness didn't catch it
because generate.py never wrote the file.

Emit prompts.d.ts from generate.py as plain `export declare const X:
string;` declarations. The contents now live only in prompts.ts, so the
declaration file can't drift, and check-freshness covers it going forward.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 11:54:09 +02:00
..
2026-04-29 20:23:32 +00:00
2022-05-05 04:25:58 +02:00

wmill

The core client for the Windmill platform.

Usage

Basic Usage

The wmill package has several methods at the top-level for the most frequent operations you will need.

The following are some common examples:

import time

import wmill


def main():
    # Get the value of a variable
    wmill.get_variable("u/user/variable_path")
    
    # Run a script synchronously and get the result
    wmill.run_script("f/pathto/script", args={"arg1": "value1"})
    
    # Get the value of a resource
    wmill.get_resource("u/user/resource_path")
    
    # Set the script's state
    wmill.set_state({"ts": time.time()})
    
    # Get the script's state
    wmill.get_state()

Advanced Usage

The wmill package also exposes the Windmill class, which is the core client for the Windmill platform.

import time

from wmill import Windmill

def main():
    client = Windmill(
        # token=...  <- this is optional. otherwise the client will look for the WM_TOKEN env var
    )

    # Get the current version of the client
    client.version

    # Get the current user
    client.user
    
    # Convenience get and post methods exist for https://app.windmill.dev/openapi.html#/
    # these are thin wrappers around the httpx library's get and post methods
    # list worker groups
    client.get("/configs/list_worker_groups")
    # create a group
    client.post(
        f"/w/{client.workspace}/groups/create",
        json={
            "name": "my-group",
            "summary": "my group summary",
        }
    )
    
    # Get and set the state of the script
    now = time.time()
    client.state = {"ts": now}
    assert client.state == {"ts": now}
    
    # Run a job asynchronously
    job_id = client.run_script_async(path="path/to/script")
    # Get its status
    client.get_job_status(job_id)
    # Get its result
    client.get_result(job_id)