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

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

Built distribution (wheel)

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

Total release size: 1.5 MB

Release files / kestrapy-2.1.0.tar.gz

Download URL kestrapy-2.1.0.tar.gz
Size 341.7 kB
Tags Source
SHA-256 checksum
How to use checksums
096b6c63d6a9067f2672c1557dfffe969d06e0e0dbabffc4868fb3000c03cdcb
BLAKE2b-256 checksum
How to use checksums
ed253a357220a62f9371ee02f6e2346090e48c525ac6a4fdb63a292fb58a3b21
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-py3-none-any.whl

Download URL kestrapy-2.1.0-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1828d5d1b50121de50c1e29a7b98c1eb37d1de57e62cdffa0dd0e55f06e63a3b
BLAKE2b-256 checksum
How to use checksums
9ca90bc142aec8169d5b6a378aead5fa131f86c230e593a52f1ecb838b5f8fcf
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

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