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 GitHub last commit README.md More Info

Table of Contents

Requirements

Python >=3.7

Installing

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

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="rnp_x3p27VQk6MyJfLe",
    )
    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="rnp_x3p27VQk6MyJfLe",
        )
        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="rnp_x3p27VQk6MyJfLe",
)

⚙️ 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="wkf_i3F5UjpZ2Vg",
    webhook_url="https://myapp.com/webhook",
    input={
        "first_name": "Sam",
        "last_name": "Altman",
    },
)

⚙️ Parameters

workflow_id: str

The ID of the workflow to be run.

webhook_url: str

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

input: RunWorkflowDtoInput

⚙️ Request Body

RunWorkflowDto

🔄 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.1

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.1
File Size Uploaded
leap_workflows_python_sdk-1.0.1.tar.gz 51.2 kB Details

Built distribution (wheel)

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

Total release size: 126.5 kB

Release files / leap_workflows_python_sdk-1.0.1.tar.gz

Download URL leap_workflows_python_sdk-1.0.1.tar.gz
Size 51.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bb72e592bc0f7ce3fd2c393070909f74fa6d91ace458e48bb622312707606ede
BLAKE2b-256 checksum
How to use checksums
681b99a17e61bc84b534546d45b482a026ea741d906971cddf5249f0c82898f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

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

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

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

This release

1.0.1 This release

2 release files

1.0.0

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