Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

kestrapy — Kestra Python SDK

Official Python SDK for the Kestra API. Use it to manage flows, executions and other resources programmatically from a Python application.

All API operations, except for Instance-owner-only endpoints, require a tenant identifier in the HTTP path. Endpoints designated as Instance-owner-only are not tenant-scoped.

This SDK is hand-written. Do not regenerate it — edit the sources under python/python-sdk directly.

Installation

pip install kestrapy

Getting started

Create a Configuration, configure the host and authentication, then instantiate the single KestraClient that gathers every API:

from kestrapy import Configuration, KestraClient

configuration = Configuration()
configuration.host = "http://localhost:8080"
configuration.username = "root@root.com"
configuration.password = "Root!1234"

kestra_client = KestraClient(configuration)
tenant = "main"

# List the first page of flows in the tenant.
flows = kestra_client.flows.search_flows(tenant, page=1, size=10)
print(f"Found {len(flows.results)} flows")

# Create a new flow from its YAML source.
flow = """
id: hello_from_sdk
namespace: company.team

tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: Hello from the Kestra Python SDK!
"""
created = kestra_client.flows.create_flow(tenant, flow)
print(f"Created flow {created.namespace}.{created.id} (revision {created.revision})")

Authentication

The client supports HTTP basic auth and bearer tokens. Prefer reading credentials from the environment rather than hard-coding them:

import os

from kestrapy import Configuration, KestraClient

# HTTP basic authentication
configuration = Configuration(
    host="http://localhost:8080",
    username=os.environ["KESTRA_USERNAME"],
    password=os.environ["KESTRA_PASSWORD"],
)
kestra_client = KestraClient(configuration)

# ...or a bearer token (service-account API token / JWT)
kestra_client = KestraClient(
    host="http://localhost:8080",
    token=os.environ["KESTRA_TOKEN"],
)

Pass bearer tokens with the token= keyword: KestraClient does not read Configuration.access_token.

Errors

API calls raise kestrapy.rest.ApiException on non-2xx responses:

from kestrapy.rest import ApiException

try:
    kestra_client.flows.flow("company.team", "does_not_exist", tenant)
except ApiException as e:
    print(f"Kestra API returned {e.status}: {e.reason}")

Documentation for API Endpoints

Per-method reference (signatures, parameters, examples) for the most-used APIs. Every KestraClient accessor is documented by its docstrings.

Accessor Reference
kestra_client.executions ExecutionsApi
kestra_client.flows FlowsApi
kestra_client.groups GroupsApi
kestra_client.kv KVApi
kestra_client.logs LogsApi
kestra_client.namespaces NamespacesApi
kestra_client.roles RolesApi
kestra_client.service_account ServiceAccountApi
kestra_client.triggers TriggersApi
kestra_client.users UsersApi

Documentation for Models

Each model has a page under docs/ named after the class, for example FlowWithSource.

Documentation for Authorization

basicAuth

HTTP basic authentication: set username and password on the Configuration (or pass them to KestraClient).

bearerAuth

Bearer token (service-account API token / JWT): KestraClient(host=..., token=...).

Development

Run the test suite with pytest. See AGENTS.md in the repository root for contribution notes.

Metadata

Release files for kestrapy 2.1.0.dev528

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

Source distribution (sdist)

Source distribution for kestrapy 2.1.0.dev528
File Size Uploaded Provenance Actions
kestrapy-2.1.0.dev528.tar.gz 335.9 kB Without provenance Details for kestrapy-2.1.0.dev528.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kestrapy 2.1.0.dev528
File Interpreter ABI Platform Actions
kestrapy-2.1.0.dev528-py3-none-any.whl Python 3 none any Details for kestrapy-2.1.0.dev528-py3-none-any.whl

Total release size: 1.5 MB

Release files / kestrapy-2.1.0.dev528.tar.gz

Download URL kestrapy-2.1.0.dev528.tar.gz
Size 335.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bf187af1bb3e53ea06778a69051541487524d45cb5c1b56530e450629b3565ce
BLAKE2b-256 checksum
How to use checksums
cf286197309359349301a63e25799a54ce14ee970ed2694c6b8fee8a1c256363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / kestrapy-2.1.0.dev528-py3-none-any.whl

Download URL kestrapy-2.1.0.dev528-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
32ccc15ee6384c6b68fad842ca7f5e4905687ba8a55622710af941c2b38dc19d
BLAKE2b-256 checksum
How to use checksums
db9367a7dd14742d5f563f95865025a707bb799703ace27f6e14186c64a83364
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for kestrapy 2.1.0.dev528

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release
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