run-llama/llama_index · error · ValueError

draw_most_recent_execution function is deprecated and no lon

Error message

draw_most_recent_execution function is deprecated and no longer works with the installed version of `workflows`. Install `llama-index-utils-workflow` and use the draw_most_recent_execution import `from llama_index.utils.workflow` instead.

What it means

Raised by llama-index-core's deprecated draw_most_recent_execution helper when the installed `workflows` package is version 2.9.0 or newer. The in-recopy of the visualization code depends on internals of the old `workflows` library that changed in 2.9.0, so llama-index-core refuses to run it instead of producing a broken graph. The functionality was moved out of core into the separate `llama-index-utils-workflow` package.

Source

Thrown at llama-index-core/llama_index/core/workflow/drawing.py:87

            net.add_edge(event_type.__name__, step_name)

    net.show(filename, notebook=notebook)


@deprecated(
    reason="Install `llama-index-utils-workflow` and use the import `from llama_index.utils.workflow` instead."
)
def draw_most_recent_execution(
    workflow: Workflow,
    filename: str = "workflow_recent_execution.html",
    notebook: bool = False,
) -> None:
    """Draws the most recent execution of the workflow."""
    from importlib.metadata import version
    from packaging.version import Version

    if Version(version("workflows")) >= Version("2.9.0"):
        raise ValueError(
            "draw_most_recent_execution function is deprecated and no longer works with the installed version of `workflows`. Install `llama-index-utils-workflow` and use the draw_most_recent_execution import `from llama_index.utils.workflow` instead."
        )

    from pyvis.network import Network

    net = Network(directed=True, height="750px", width="100%")

    # Add nodes and edges based on execution history
    existing_context = next(iter(workflow._contexts), None)  # type: ignore
    if existing_context is None:
        raise ValueError("No runs found in workflow")

    accepted_events = existing_context._accepted_events  # type: ignore
    for i, (step, event) in enumerate(accepted_events):
        event_node = f"{event}_{i}"
        step_node = f"{step}_{i}"
        net.add_node(
            event_node, label=event, color="#90EE90", shape="ellipse"

View on GitHub (pinned to afd0fef371)

Solutions

  1. pip install llama-index-utils-workflow and change the import to `from llama_index.utils.workflow import draw_most_recent_execution`
  2. Pin `workflows<2.9.0` if you must keep using the deprecated core import (temporary workaround only)
  3. Update any notebook/tutorial code that references llama_index.core.workflow.drawing

Example fix

// before
from llama_index.core.workflow import draw_most_recent_execution
draw_most_recent_execution(workflow)

// after
pip install llama-index-utils-workflow
from llama_index.utils.workflow import draw_most_recent_execution
draw_most_recent_execution(workflow)
Defensive patterns

Strategy: validation

Validate before calling

from importlib.metadata import version
from packaging.version import Version

def can_use_core_draw() -> bool:
    try:
        return Version(version("workflows")) < Version("2.9.0")
    except PackageNotFoundError:
        return False

Type guard

def get_draw_most_recent_execution():
    try:
        from llama_index.utils.workflow import draw_most_recent_execution  # new home
        return draw_most_recent_execution
    except ImportError:
        from llama_index.core.workflow import draw_most_recent_execution
        return draw_most_recent_execution

Try / catch

try:
    draw_most_recent_execution(wf)
except ValueError as e:
    if "deprecated" in str(e):
        from llama_index.utils.workflow import draw_most_recent_execution
        draw_most_recent_execution(wf)
    else:
        raise

Prevention

When it happens

Trigger: Calling llama_index.core.workflow.drawing.draw_most_recent_execution(workflow, ...) after `pip install 'workflows>=2.9.0'` (or after upgrading llama-index dependencies that pull in workflows 2.9+). The version check importlib.metadata.version("workflows") >= 2.9.0 fires immediately on call, before any drawing happens.

Common situations: Upgrading the `workflows` library (used by llama-index workflows) past 2.9.0 while still importing draw helpers from llama_index.core.workflow; running old tutorial/notebook code that imports from the core package; CI environments that resolve to the newest workflows wheel.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/3e0fd37453ec4f01. Report an issue: GitHub.