Skip to main content

Python SDK for Kestrel Workflows

Project description

Kestrel SDK

Python SDK for Kestrel — AI Agents for Platform Engineering.

Build, deploy, and manage workflows programmatically with a typed, fluent API.

Installation

pip install kestrel-workflows

Quick Start

from kestrel import KestrelClient
from kestrel.workflows import Workflow, Trigger, Action

client = KestrelClient(api_key="kestrel_sk_...")

wf = (
    Workflow("Pod Crash RCA + Jira")
    .description("Run RCA on pod crash, create Jira ticket")
    .trigger(
        Trigger.k8s_pod_status()
        .reasons("CrashLoopBackOff")
        .namespace("production")
    )
    .cooldown(hours=24)
    .then(Action.kestrel_trigger_rca().label("Run RCA"))
    .then(Action.jira_create_ticket()
        .project("KAN")
        .title("{{incident.title}}")
        .priority("High")
    )
)

created = client.workflows.deploy(wf, activate=True)
print(f"Deployed: {created.id}")

Async Support

from kestrel import AsyncKestrelClient

async with AsyncKestrelClient(api_key="kestrel_sk_...") as client:
    workflows = await client.workflows.list()
    execution = await client.workflows.test(workflows[0].id)
    result = await client.executions.wait(execution.id)
    print(f"Result: {result.status}")

Integrations

Connect, test, and disconnect Kestrel integrations programmatically. API keys need the integrations:read / integrations:manage scopes.

# See every integration and its connection status
for status in client.integrations.list():
    print(status.id, status.connected)

# Inspect credential requirements per integration
for spec in client.integrations.specs():
    print(spec.key, spec.kind, [f.name for f in spec.fields])

# Setup instructions: where to create each credential (mirrors the
# platform UI and `kestrel integrations connect <name> --help`)
print(client.integrations.setup_help("cloudflare"))

# Token integrations take credential kwargs
client.integrations.connect("cloudflare", api_token="...", account_id="...")
client.integrations.connect("pagerduty", api_token="...", webhook_secret="...")

# Follow-up steps after connecting (e.g. webhook setup), if any
print(client.integrations.post_connect_hint("cloudflare"))

# Save a vendor-generated webhook signing secret after connect
# (Vercel, Railway, PlanetScale, Supabase) — keeps the stored API token
client.integrations.set_webhook_secret("vercel", "whsec_...")

# Knowledge sources
client.integrations.connect(
    "confluence",
    base_url="https://acme.atlassian.net",
    api_key="me@acme.com",   # Atlassian account email
    api_token="...",
)

# OAuth integrations return a URL to open in the browser
url = client.integrations.connect("github")

# Verify and clean up
client.integrations.test("cloudflare")
client.integrations.disconnect("cloudflare")

Kubernetes, AWS, and OCI use multi-step flows — connect those with the Kestrel CLI (kestrel integrations connect <name> --help).

Authentication

Create an API key in the Kestrel platform under Workflows > API Keys.

# API key (recommended)
client = KestrelClient(api_key="kestrel_sk_...")

# From CLI login
client = KestrelClient.from_config()

# Async
client = AsyncKestrelClient(api_key="kestrel_sk_...")

Documentation

Full SDK documentation: docs.usekestrel.ai/workflows/sdk

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kestrel_workflows-0.36.0.tar.gz (59.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kestrel_workflows-0.36.0-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file kestrel_workflows-0.36.0.tar.gz.

File metadata

  • Download URL: kestrel_workflows-0.36.0.tar.gz
  • Upload date:
  • Size: 59.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kestrel_workflows-0.36.0.tar.gz
Algorithm Hash digest
SHA256 1942149d6ce8e19dc1155969551b9d5269438055da95fc0115d15885a9639543
MD5 bc8e682b7f5bd86318807a52cfedc5d2
BLAKE2b-256 fc712a029ed728e0fad1f3fe98a686e42cc5af75e007091a1bcc557f7d0dcf8b

See more details on using hashes here.

File details

Details for the file kestrel_workflows-0.36.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kestrel_workflows-0.36.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a59d423911bf145d0f9b97fb01c71a4c9521b9addb42e8bf636bb71c65ef949e
MD5 57a7552982bfdeacc116fdfd2ffb47f1
BLAKE2b-256 77086e856e2853dc60b03f3c2a272cb2006869785df5a6adf1a080ac2e54f6d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page