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

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.dev541
File Size Uploaded Provenance Actions
kestrapy-2.1.0.dev541.tar.gz 336.9 kB Without provenance Details for kestrapy-2.1.0.dev541.tar.gz

Built distribution (wheel)

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

Total release size: 1.5 MB

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

Download URL kestrapy-2.1.0.dev541.tar.gz
Size 336.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fd626a955cc1d5aa2e29a37d507793c363e0b0bc9486fc1a50bc2a6f50c8cfef
BLAKE2b-256 checksum
How to use checksums
922b1f043948b74a517196ce96d9d14a5d0471281116eb98cb9e167842c1e2b7
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.dev541-py3-none-any.whl

Download URL kestrapy-2.1.0.dev541-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
34a15e5e83b1e7b46df1ca3d2ea0dd189f3e6bf44716bed102a82dfc642e34c1
BLAKE2b-256 checksum
How to use checksums
b4d1448b4e0e9260794d0ee9f088cb15f3ee03cbdd2bd3f302d48b86a12a93bb
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.dev541

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