Skip to main content

Flyte HITL Plugin

[!WARNING] Deprecated. This plugin has been deprecated in favor of flyte-native conditions (flyte.new_condition), which are built into the flyte SDK and require no extra dependency, no depends_on=[hitl.env] app infrastructure, and no web-form serving. Conditions pause a run until they are signaled from the Flyte UI, the CLI (flyte signal condition <run> <action> <value>), or programmatically via flyte.remote.Condition.signal.

Migration is mostly one-to-one — replace hitl.new_event with flyte.new_condition:

# Before
event = await hitl.new_event.aio(
    "integer_input_event", data_type=int, scope="run", prompt="What should I add to x?"
)
y = await event.wait.aio()

# After
condition = await flyte.new_condition.aio(
    "integer_input_condition", data_type=int, prompt="What should I add to x?"
)
y = await condition.wait.aio()

See examples/advanced/conditions.py for markdown prompts, timeouts, webhook notifications, and signaling conditions programmatically.

Human-in-the-Loop (HITL) plugin for Flyte. This plugin provides an event-based API for pausing workflows and waiting for human input.

Installation

pip install flyteplugins-hitl

Usage

import flyte
import flyteplugins.hitl as hitl

task_env = flyte.TaskEnvironment(
    name="my-hitl-workflow",
    image=flyte.Image.from_debian_base(python_version=(3, 12)),
    resources=flyte.Resources(cpu=1, memory="512Mi"),
    depends_on=[hitl.env],
)


@task_env.task
async def task1() -> int:
    """First task - returns an automated value."""
    return 42


@task_env.task
async def task2(x: int, y: int) -> int:
    """Second task - combines automated and human input."""
    return x + y


@task_env.task(report=True)
async def main() -> int:
    """
    Main workflow that orchestrates automated and human-in-the-loop tasks.

    Flow:
    1. task1() runs and returns an automated value (x)
    2. Create an Event (serves the app) and wait for human input (y)
    3. task2(x, y) combines both values and returns the result
    """
    print("Starting HITL workflow...")

    # Step 1: Automated task
    x = await task1()
    print(f"task1 completed: x = {x}")

    # Step 2: Human-in-the-loop using the Event-based API
    # Create an event (this serves the app if not already running)
    event = await hitl.new_event.aio(
        "integer_input_event",
        data_type=int,
        scope="run",
        prompt="What should I add to x?",
    )
    y = await event.wait.aio()
    print(f"Event completed: y = {y}")

    # Step 3: Combine results
    result = await task2(x, y)
    print(f"task2 completed: result = {result}")

    return result


if __name__ == "__main__":
    flyte.init_from_config()
    run = flyte.run(main)
    print(f"Run URL: {run.url}")
    run.wait()
    print(f"Result: {run.outputs()}")

Features

  • Event-based API: Create events that pause workflow execution until human input is received
  • Web Form: Automatically generates a web form for human input
  • Programmatic API: Submit input via curl or any HTTP client
  • Type Safety: Supports int, float, str, and bool data types

API Reference

hitl.new_event(name, data_type, scope, prompt, ...)

Create a new human-in-the-loop event.

Parameters:

  • name (str): A descriptive name for the event
  • data_type (Type): The expected type of the input (int, float, str, bool)
  • scope (str): The scope of the event. Currently only "run" is supported.
  • prompt (str): The prompt to display to the human
  • timeout_seconds (int): Maximum time to wait for human input (default: 3600)
  • poll_interval_seconds (int): How often to check for a response (default: 5)

Returns: An Event object

event.wait() / await event.wait.aio()

Wait for human input and return the result.

Returns: The value provided by the human, converted to the event's data_type

hitl.env

The TaskEnvironment that provides the HITL app infrastructure. Add this to your task environment's depends_on list.

hitl.Event

The Event class for type annotations and advanced usage.

Release files for flyteplugins-hitl 2.6.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for flyteplugins-hitl 2.6.9
File Interpreter ABI Platform
flyteplugins_hitl-2.6.9-py3-none-any.whl Python 3 none any Details

Release files / flyteplugins_hitl-2.6.9-py3-none-any.whl

Download URL flyteplugins_hitl-2.6.9-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3629e0724778070f43237fdacbe151be1b606a4824a1dcfe6a90589deea8762f
BLAKE2b-256 checksum
How to use checksums
8d3edbd8aa8b55e41f557f3babeb0ab43a7ef1441ab56546d17609db2ff497c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

2.10.1

1 release file

2.10.0

1 release file

2.9.0

1 release file

2.8.1

1 release file

2.8.0

1 release file

2.7.2

1 release file

2.7.1

1 release file

2.7.0

1 release file

2.6.13

1 release file

2.6.12

1 release file

2.6.11

1 release file

2.6.10

1 release file

This release

2.6.9 This release

1 release file

2.6.8

1 release file

2.6.7

1 release file

2.6.6

1 release file

2.6.5

1 release file

2.6.4

1 release file

2.6.3

1 release file

2.6.2

1 release file

2.6.1

1 release file

2.6.0

1 release file

2.5.20

1 release file

2.5.18

1 release file

2.5.17

1 release file

2.5.14

1 release file

2.5.13

1 release file

2.5.12

1 release file

2.5.11

1 release file

2.5.10

1 release file

2.5.9

1 release file

2.5.8

1 release file

2.5.7

1 release file

2.5.6

1 release file

2.5.5

1 release file

2.5.4

1 release file

2.5.3

1 release file

2.5.2

1 release file

2.5.1

1 release file

2.5.0

1 release file

2.4.4

1 release file

2.4.3

1 release file

2.4.2

1 release file

2.4.1

1 release file

2.4.0

1 release file

2.3.9

1 release file

2.3.8

1 release file

2.3.7

1 release file

2.3.6

1 release file

2.3.5

1 release file

2.3.4

1 release file

2.3.3

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3.0

1 release file

2.2.4

1 release file

2.2.3

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.9

1 release file

2.1.8

1 release file

2.1.7

1 release file

2.1.6

1 release file

2.1.5

1 release file

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.12

1 release file

2.0.11

1 release file

2.0.10

1 release file

2.0.9

1 release file

2.0.8

1 release file

2.0.7

1 release file

2.0.6

1 release file

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