Skip to main content

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

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.0.4
File Size Uploaded Provenance Actions
kestrapy-2.0.4.tar.gz 325.7 kB Without provenance Details for kestrapy-2.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 1.5 MB

Release files / kestrapy-2.0.4.tar.gz

Download URL kestrapy-2.0.4.tar.gz
Size 325.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9554311575aa8369b8dd720ddee48a9ea18e39c3cbc4af6dc875966ed7d7247c
BLAKE2b-256 checksum
How to use checksums
d773b95d1e30d41d471e2fc0f8ea025883a57f944b4ff02bd8fd1d5551a58fda
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.0.4-py3-none-any.whl

Download URL kestrapy-2.0.4-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ebf1225105d4f4f5d6f8041c48d36f535bb4f3b15496ec1a3d9c60c621472ec3
BLAKE2b-256 checksum
How to use checksums
fee78b1d2a81749e8ffab4c693542cdec7cf4174ecb6b3aa30b6852be28398fd
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.0.4

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

2.0.4 This release

2 release files No provenance

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