{"record":{"id":"3e0fd37453ec4f01","repo":"run-llama/llama_index","slug":"draw-most-recent-execution-function-is-deprecated","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/workflow/drawing.py","lineNumber":87,"sourceCode":"            net.add_edge(event_type.__name__, step_name)\n\n    net.show(filename, notebook=notebook)\n\n\n@deprecated(\n    reason=\"Install `llama-index-utils-workflow` and use the import `from llama_index.utils.workflow` instead.\"\n)\ndef draw_most_recent_execution(\n    workflow: Workflow,\n    filename: str = \"workflow_recent_execution.html\",\n    notebook: bool = False,\n) -> None:\n    \"\"\"Draws the most recent execution of the workflow.\"\"\"\n    from importlib.metadata import version\n    from packaging.version import Version\n\n    if Version(version(\"workflows\")) >= Version(\"2.9.0\"):\n        raise ValueError(\n            \"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.\"\n        )\n\n    from pyvis.network import Network\n\n    net = Network(directed=True, height=\"750px\", width=\"100%\")\n\n    # Add nodes and edges based on execution history\n    existing_context = next(iter(workflow._contexts), None)  # type: ignore\n    if existing_context is None:\n        raise ValueError(\"No runs found in workflow\")\n\n    accepted_events = existing_context._accepted_events  # type: ignore\n    for i, (step, event) in enumerate(accepted_events):\n        event_node = f\"{event}_{i}\"\n        step_node = f\"{step}_{i}\"\n        net.add_node(\n            event_node, label=event, color=\"#90EE90\", shape=\"ellipse\"","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/workflow/drawing.py#L69-L105","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["pip install llama-index-utils-workflow and change the import to `from llama_index.utils.workflow import draw_most_recent_execution`","Pin `workflows<2.9.0` if you must keep using the deprecated core import (temporary workaround only)","Update any notebook/tutorial code that references llama_index.core.workflow.drawing"],"exampleFix":"// before\nfrom llama_index.core.workflow import draw_most_recent_execution\ndraw_most_recent_execution(workflow)\n\n// after\npip install llama-index-utils-workflow\nfrom llama_index.utils.workflow import draw_most_recent_execution\ndraw_most_recent_execution(workflow)","handlingStrategy":"validation","validationCode":"from importlib.metadata import version\nfrom packaging.version import Version\n\ndef can_use_core_draw() -> bool:\n    try:\n        return Version(version(\"workflows\")) < Version(\"2.9.0\")\n    except PackageNotFoundError:\n        return False","typeGuard":"def get_draw_most_recent_execution():\n    try:\n        from llama_index.utils.workflow import draw_most_recent_execution  # new home\n        return draw_most_recent_execution\n    except ImportError:\n        from llama_index.core.workflow import draw_most_recent_execution\n        return draw_most_recent_execution","tryCatchPattern":"try:\n    draw_most_recent_execution(wf)\nexcept ValueError as e:\n    if \"deprecated\" in str(e):\n        from llama_index.utils.workflow import draw_most_recent_execution\n        draw_most_recent_execution(wf)\n    else:\n        raise","preventionTips":["Prefer importing draw helpers from llama_index.utils.workflow (llama-index-utils-workflow) going forward","Pin workflows<2.9.0 in lockfiles for legacy code that cannot migrate yet","Run a smoke test that calls the draw function in CI to catch dependency-drift breakage"],"tags":["deprecation","versioning","workflow","visualization","python"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}