Registry / workflow / kestra

kestra

JSON →
library1.3.0pypypi✓ verified 22d ago

Kestra is an infinitely scalable orchestration and scheduling platform that allows users to create, run, schedule, and monitor complex pipelines. The Python client library facilitates programmatic interaction with the Kestra API for managing flows, executions, and sending metrics, outputs, and logs from within Python script tasks. The library is currently at version 1.3.0 and maintains a regular release cadence with frequent updates.

pip install kestra
INSTALL
IMPORT
SIG · KESTRA
K
kestra
workflowpythonv1.3.0
Install
4.8s avg
Import
441ms
Disk
96MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.362s · 95.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.8s · import 0.344s · 92MB
96MB installed
● package 96MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Flow
from kestra import Flow
Used for programmatic execution and management of Kestra flows.
Kestra
from kestra import Kestra
Used within Python script tasks inside Kestra flows for sending outputs, metrics, and logs.
Configuration, KestraClient
from kestrapy import Configuration, KestraClient
from kestra import Configuration, KestraClient
While 'kestra' is the PyPI package, the internal SDK modules are exposed under 'kestrapy'. For programmatic client configuration, use 'kestrapy'.

This quickstart demonstrates how to programmatically create and execute a Kestra flow using the Kestra Python SDK. It configures the client using environment variables for host, username, and password (or API token), then defines a simple flow in YAML and submits it to the Kestra instance. It then triggers an execution and waits for its completion. For in-flow interactions, the `kestra.Kestra` class is used within Python script tasks.

import os from kestrapy import Configuration, KestraClient # Configure client using environment variables or hardcoded values (not recommended for production) configuration = Configuration( host=os.environ.get('KESTRA_HOST', 'http://localhost:8080'), username=os.environ.get('KESTRA_USERNAME', 'root@root.com'), # or KESTRA_API_TOKEN password=os.environ.get('KESTRA_PASSWORD', 'Root!1234') ) kestra_client = KestraClient(configuration) tenant_id = os.environ.get('KESTRA_TENANT', 'main') # 'main' is default for OSS namespace = "my_namespace" flow_id = "my_flow" flow_yaml = f''' id: {flow_id} namespace: {namespace} tasks: - id: hello type: io.kestra.plugin.core.log.Log message: "Hello from a Kestra Python SDK created flow!" ''' try: # Create a flow created_flow = kestra_client.flows.create_flow(tenant=tenant_id, body=flow_yaml) print(f"Flow created: {created_flow.id}") # Execute the flow execution = kestra_client.executions.create_execution(tenant=tenant_id, flow_id=flow_id, namespace=namespace, wait=True) print(f"Execution finished with status: {execution.state.current}") # Example of using Kestra within a flow (not directly runnable in quickstart, but demonstrates usage) # from kestra import Kestra # Kestra.outputs({"message": "This is an output from within a flow!"}) except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingStarting from Kestra 0.23.0 (and confirmed in 0.24.0 and 1.x), a tenant context is required. The `defaultTenant` (null tenant) is no longer supported. For Kestra Open Source, a fixed tenant named 'main' is always used, and all API URIs now include the tenant, e.g., `/api/v1/...` became `/api/v1/main/...`.
fix
Ensure all API calls and client configurations specify a `tenant` ID. For Open Source, use `main`. Update any hardcoded API paths to include the tenant.
affects: >=0.23.0
breakingWith Kestra 0.24.0, basic authentication became required. Additionally, IAM and API endpoint changes were introduced.
fix
Configure the `KestraClient` with either `username` and `password`, or an `access_token` (for service accounts). Avoid making unauthenticated API calls.
affects: >=0.24.0
breakingFor users of S3 or GCS as internal storage, Kestra now removes the leading root slash in all storage paths to fix double slashes. This impacts how internal storage objects are accessed.
fix
Run the provided migration scripts for your storage provider to update object paths. Failure to do so will prevent Kestra from accessing files with the old path structure.
affects: >=0.23.0
gotchaWhen running Python scripts within Kestra flows, managing dependencies can be tricky. Installing packages with `beforeCommands` downloads and installs them on every run, increasing execution time.
fix
For efficient dependency management, consider building a custom Docker image that includes Python and all required pip packages, or install packages at server startup if using the `Process Task Runner`. Alternatively, use caching for virtual environments in `WorkingDirectory` tasks.
affects: All
gotchaThe Python client package on PyPI is `kestra`, but the internal modules for programmatic client interaction (e.g., `Configuration`, `KestraClient`) are imported from `kestrapy`. For utilities used inside Kestra Python script tasks (e.g., `Kestra.outputs`), the import is `from kestra import Kestra`.
fix
Be mindful of the specific import paths based on whether you are writing an external Python script to interact with Kestra (use `kestrapy`) or writing a Python script to be executed within a Kestra flow (use `kestra`).
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'kestra'
The 'kestra' Python client library or other required Python packages are not installed in the execution environment of the Kestra Python script task.
fix
Ensure the necessary packages are listed in the `beforeCommands` property of your Kestra Python task (e.g., `pip install kestra pandas`) or use the `dependencies` property (available from Kestra 0.23+) for caching.
ConnectionRefusedError: [Errno 111] Connection refused
The Kestra Python client or SDK is unable to establish a connection with the Kestra API server, often due to an incorrect `KESTRA_HOSTNAME` environment variable, an inaccessible server, or firewall restrictions.
fix
Verify that the `KESTRA_HOSTNAME` environment variable is correctly set to the Kestra API's URL (e.g., `http://localhost:8080`) and that the Kestra server is running and reachable from where the Python client is executed.
NameError: name 'Kestra' is not defined
When using Python script tasks (e.g., `io.kestra.plugin.scripts.python.Script` or `io.kestra.plugin.scripts.python.Commands`), the `Kestra` class (used for sending outputs, metrics, or logs) was not explicitly imported from the `kestra` library or was used without proper instantiation when running a separate script file.
fix
Add `from kestra import Kestra` at the beginning of your Python script when interacting with Kestra's context (e.g., `Kestra.outputs({'key': 'value'})`).
Client Error: Invalid entity for url: ... (422 Unprocessable Entity)
This error, often accompanied by a '422 Unprocessable Entity' status, indicates that the data sent to the Kestra API via the Python SDK (e.g., for creating/updating flows, or executing with inputs) is syntactically or semantically incorrect (e.g., malformed YAML for a flow definition, or incorrect input types).
fix
Review the YAML definition of the flow or the structure of the input payload being sent to the Kestra API to ensure it adheres to Kestra's schema and expected data types.
Upgrade
Version history
1.3.0latest on PyPI · released Mar 3, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
kestra — pip install kestra · libregistry