Skip to main content

Pregel-based runner for WIRL workflows

Project description

WIRL Pregel Runner

Run WIRL workflows on top of LangGraph's Pregel execution model with built‑in parallelism, checkpoints, and optional human‑in‑the‑loop (HITL) steps.

1) What is WIRL?

WIRL is a compact workflow DSL that compiles to an explicit directed graph with optional guarded loops. Nodes declare inputs/outputs; optional inputs do not block scheduling; reducers like (append) accumulate outputs across iterations. See packages/wirl-lang/ for the DSL, parser, and quickstart.

2) What is the WIRL Pregel Runner?

Python runner that executes WIRL workflows with LangGraph Pregel:

  • Parallelization: ready nodes run concurrently in supersteps.
  • Checkpoints: resume from saved state with a checkpointer.
  • HITL: supports human‑in‑the‑loop hooks from the WIRL spec.

API: wirl_pregel_runner.run_workflow(workflow_path, fn_map, params=None, thread_id=None, resume=None, checkpointer=None).

3) Install

Requires Python 3.10+

# from source (editable)
cd packages/wirl-pregel-runner
pip install -e .
# or with uv
uv pip install -e .

4) Use

Python API

from wirl_pregel_runner import run_workflow

workflow_path = "tests/wirls/sample.wirl"

fn_map = {
    "query_extender": lambda query, config: {"extended_query": "extended query"},
    "retrieve_from_web": lambda extended_query, config: {"chunks": ["chunk"], "need_filtering": False},
}

result = run_workflow(
    workflow_path,
    fn_map=fn_map,
    params={"query": "hello"},
    thread_id="cli",
)
print(result)

CLI

python -m wirl_pregel_runner.pregel_runner \
  path/to/workflow.wirl \
  --functions your_module_with_functions \
  --param key=value \
  --thread-id myrun \
  --resume '{"configurable": {"thread_id": "myrun"}}'
  • --functions: module exposing callables whose names match WIRL call identifiers
  • --param: repeatable key=value; numbers auto‑parsed
  • --thread-id: correlates runs for checkpointing
  • --resume: JSON string to resume via LangGraph

Examples

Use the wirls in tests as references:

  • tests/wirls/sample.wirl
  • tests/wirls/sample_with_cycle.wirl

See how functions are wired and assertions made in:

  • tests/test_simple_wirl_runner.py
  • tests/test_wirl_with_cycles_runner.py

When Block Evaluation

The Pregel runner evaluates when blocks with special truthiness rules:

  • False conditions: Only None or explicit False evaluate to false
  • True conditions: All other values evaluate to true, including:
    • Empty containers: [], {}, ""
    • Zero values: 0, 0.0
    • Objects with undefined types (e.g., custom classes not in scope)

This means expressions like None or [CustomType(...)] will evaluate to true even if CustomType is not defined in the evaluation context, as long as the actual data exists in the workflow state.

Example:

node ProcessData {
  when {
    SomeNode.results  // True even if results is [] or contains undefined types
  }
}

node SkipIfNone {
  when {
    SomeNode.optional_data  // False only if None or explicit False
  }
}

5) License

MIT — see root LICENSE.

Also useful

  • DSL and parser: packages/wirl-lang/
  • Larger example workflow: workflow_definitions/paper_rename_workflow/

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

wirl_pregel_runner-0.1.1.tar.gz (67.0 kB view details)

Uploaded Source

Built Distribution

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

wirl_pregel_runner-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file wirl_pregel_runner-0.1.1.tar.gz.

File metadata

  • Download URL: wirl_pregel_runner-0.1.1.tar.gz
  • Upload date:
  • Size: 67.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for wirl_pregel_runner-0.1.1.tar.gz
Algorithm Hash digest
SHA256 201d434804858039eedeac52101bdae1bf44dee3dd9658c9c54701522a346884
MD5 b4198e62340123ed7449c30da34b7441
BLAKE2b-256 9be76bb8cd7ca11e63b1dadfce487d06af682a641af9aefaf0916bd94ea32f5c

See more details on using hashes here.

File details

Details for the file wirl_pregel_runner-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wirl_pregel_runner-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 23128925b0dfc13e5289c43bae5d26f437fd33cb4defcb9e94b168fe7b9a7cdc
MD5 da7a12a72b9363a4773ae10b5e452a96
BLAKE2b-256 f66d79945d0b4c59ad5c68f4fc70ac99361c3e80b9cb7cbcfef69184d8fd954f

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