Skip to main content

leap-workflows-python-sdk

The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests.

PyPI README.md More Info

Table of Contents

Requirements

Python >=3.7

Installing

pip install leap-workflows-python-sdk==1.0.0

Getting Started

from pprint import pprint
from leap_workflows import Leap, ApiException

leap = Leap(
    api_key="YOUR_API_KEY",
)

try:
    # Get a workflow run
    get_workflow_run_response = leap.workflow_runs.get_workflow_run(
        workflow_run_id="workflow_run_id_example",
    )
    pprint(get_workflow_run_response.body)
    pprint(get_workflow_run_response.body["id"])
    pprint(get_workflow_run_response.body["version_id"])
    pprint(get_workflow_run_response.body["status"])
    pprint(get_workflow_run_response.body["created_at"])
    pprint(get_workflow_run_response.body["started_at"])
    pprint(get_workflow_run_response.body["ended_at"])
    pprint(get_workflow_run_response.body["workflow_id"])
    pprint(get_workflow_run_response.body["error"])
    pprint(get_workflow_run_response.body["input"])
    pprint(get_workflow_run_response.body["output"])
    pprint(get_workflow_run_response.headers)
    pprint(get_workflow_run_response.status)
    pprint(get_workflow_run_response.round_trip_time)
except ApiException as e:
    print("Exception when calling WorkflowRunsApi.get_workflow_run: %s\n" % e)
    pprint(e.body)
    pprint(e.headers)
    pprint(e.status)
    pprint(e.reason)
    pprint(e.round_trip_time)

Async

async support is available by prepending a to any method.

import asyncio
from pprint import pprint
from leap_workflows import Leap, ApiException

leap = Leap(
    api_key="YOUR_API_KEY",
)


async def main():
    try:
        # Get a workflow run
        get_workflow_run_response = await leap.workflow_runs.aget_workflow_run(
            workflow_run_id="workflow_run_id_example",
        )
        pprint(get_workflow_run_response.body)
        pprint(get_workflow_run_response.body["id"])
        pprint(get_workflow_run_response.body["version_id"])
        pprint(get_workflow_run_response.body["status"])
        pprint(get_workflow_run_response.body["created_at"])
        pprint(get_workflow_run_response.body["started_at"])
        pprint(get_workflow_run_response.body["ended_at"])
        pprint(get_workflow_run_response.body["workflow_id"])
        pprint(get_workflow_run_response.body["error"])
        pprint(get_workflow_run_response.body["input"])
        pprint(get_workflow_run_response.body["output"])
        pprint(get_workflow_run_response.headers)
        pprint(get_workflow_run_response.status)
        pprint(get_workflow_run_response.round_trip_time)
    except ApiException as e:
        print("Exception when calling WorkflowRunsApi.get_workflow_run: %s\n" % e)
        pprint(e.body)
        pprint(e.headers)
        pprint(e.status)
        pprint(e.reason)
        pprint(e.round_trip_time)


asyncio.run(main())

Reference

leap.workflow_runs.get_workflow_run

This endpoint retrieves the details of a specific workflow run using its workflow_run_id.

🛠️ Usage

get_workflow_run_response = leap.workflow_runs.get_workflow_run(
    workflow_run_id="workflow_run_id_example",
)

⚙️ Parameters

workflow_run_id: str

The ID of the workflow run to retrieve.

🔄 Return

WorkflowRunEntity

🌐 Endpoint

/v1/runs/{workflow_run_id} get

🔙 Back to Table of Contents


leap.workflow_runs.workflow

This endpoint lets the user run a specified workflow with the provided workflow definition.

🛠️ Usage

workflow_response = leap.workflow_runs.workflow(
    workflow_id="123e4567-e89b-12d3-a456-426614174000",
    webhook_url="https://myapp.com/webhook",
    input={
        "first_name": "Sam",
        "last_name": "Altman",
    },
)

⚙️ Parameters

workflow_id: str

The UUID of the workflow to be run.

webhook_url: str

The URL to which the workflow results should be sent to on completion.

input: WorkflowRunPostRequestInput

⚙️ Request Body

WorkflowRunPostRequest

🔄 Return

WorkflowRunEntity

🌐 Endpoint

/v1/runs post

🔙 Back to Table of Contents


Author

This Python package is automatically generated by Konfig

Metadata

Release files for leap-workflows-python-sdk 1.0.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 leap-workflows-python-sdk 1.0.0
File Size Uploaded
leap_workflows_python_sdk-1.0.0.tar.gz 51.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for leap-workflows-python-sdk 1.0.0
File Interpreter ABI Platform
leap_workflows_python_sdk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 126.5 kB

Release files / leap_workflows_python_sdk-1.0.0.tar.gz

Download URL leap_workflows_python_sdk-1.0.0.tar.gz
Size 51.3 kB
Tags Source
SHA-256 checksum
How to use checksums
12869052849c8f4c6ce9be93c21bcc3bdb3d3ffade3b7cee8d9b5bbe60bfc94d
BLAKE2b-256 checksum
How to use checksums
fc05e163678dd2b1c43c12a22ea36f2a0cd764520433095b5c1adca78d70b7e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / leap_workflows_python_sdk-1.0.0-py3-none-any.whl

Download URL leap_workflows_python_sdk-1.0.0-py3-none-any.whl
Size 75.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c69c2575165d05454c7aaa8cd50a22eda46dc31adf3750246ee6b57e65442b7b
BLAKE2b-256 checksum
How to use checksums
7f022e88d48b2b62f30a3862576db48f1e604f9dc4920e72c6ed9d1ca4fef640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.1

2 release files

This release

1.0.0 This release

2 release files

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