[PR #269] [MERGED] Add resource nodes to workflow graph export #275

Closed
opened 2026-02-16 02:17:06 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/workflows-py/pull/269
Author: @adrianlyjak
Created: 1/8/2026
Status: Merged
Merged: 1/10/2026
Merged by: @adrianlyjak

Base: mainHead: claude/add-resource-nodes-nmFbx


📝 Commits (10+)

  • fe0f21e feat: add resource nodes to workflow graph export
  • 7384304 test: add tests and example for resource nodes visualization
  • 53dc947 chore: add changeset for resource nodes feature
  • 2450f4f fix: reverse resource edge direction to step -> resource
  • e987fd8 refactor: unify DrawWorkflowNode and DrawWorkflowResourceNode
  • c436f7b refactor: simplify _get_clean_node_id to use node_type prefix
  • 8308200 refactor: merge resource_nodes into nodes list
  • 17c952d refactor: remove unnecessary backwards compatibility aliases
  • 49c114b perf: make resource metadata extraction lazy
  • 99b8f23 test: remove unnecessary async from mermaid drawing tests

📊 Changes

13 files changed (+1804 additions, -395 deletions)

View changed files

.changeset/add_resource_nodes.md (+6 -0)
examples/visualization/resource_nodes_example.py (+260 -0)
📝 packages/llama-index-utils-workflow/pyproject.toml (+1 -1)
📝 packages/llama-index-utils-workflow/src/llama_index/utils/workflow/__init__.py (+170 -148)
📝 packages/llama-index-utils-workflow/tests/conftest.py (+61 -0)
📝 packages/llama-index-utils-workflow/tests/test_drawing.py (+162 -18)
📝 packages/llama-index-workflows/src/workflows/protocol/__init__.py (+241 -19)
📝 packages/llama-index-workflows/src/workflows/protocol/serializable_events.py (+1 -2)
📝 packages/llama-index-workflows/src/workflows/representation_utils.py (+134 -121)
📝 packages/llama-index-workflows/src/workflows/resource.py (+2 -0)
📝 packages/llama-index-workflows/src/workflows/server/server.py (+1 -3)
📝 packages/llama-index-workflows/src/workflows/utils.py (+9 -2)
📝 packages/llama-index-workflows/tests/test_representation_utils.py (+756 -81)

📄 Description

Add support for visualizing resource dependencies in workflow graphs:

  • Enhanced _Resource class with source location metadata (file, line, docstring, unique hash for deduplication)
  • Added ResourceDefinition.type_annotation to capture the type from Annotated[T, Resource(...)]
  • Added WorkflowGraphResourceNode protocol model with full metadata
  • Added DrawWorkflowResourceNode class for intermediate representation
  • Updated DrawWorkflowEdge to support edge labels (variable names)
  • Modified extract_workflow_structure to extract and deduplicate resource nodes, connecting them to steps with labeled edges
  • Updated Pyvis and Mermaid renderers to display resource nodes (hexagon shape, plum color) with metadata tooltips

Mermaid

image

Vis html

image

Additionally:

  • Removed excessive duplication of workflow graph dataclasses with pydantic models
  • Split nodes into a discriminated union of subtypes for better attributing fields to a node type
  • added doc strings as descriptions to workflows and nodes where applicable
  • add schema information to event nodes
  • added a utility for condensing the graph, removing an unwanted type (so e.g. you can now remove the new resource type, or, if you want you could convert the event node into just an edge

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/workflows-py/pull/269 **Author:** [@adrianlyjak](https://github.com/adrianlyjak) **Created:** 1/8/2026 **Status:** ✅ Merged **Merged:** 1/10/2026 **Merged by:** [@adrianlyjak](https://github.com/adrianlyjak) **Base:** `main` ← **Head:** `claude/add-resource-nodes-nmFbx` --- ### 📝 Commits (10+) - [`fe0f21e`](https://github.com/run-llama/workflows-py/commit/fe0f21ece8d4617dde313bcb68dc662d7375b9b9) feat: add resource nodes to workflow graph export - [`7384304`](https://github.com/run-llama/workflows-py/commit/7384304e68c1596743fc91f476583af6da558592) test: add tests and example for resource nodes visualization - [`53dc947`](https://github.com/run-llama/workflows-py/commit/53dc947a77d05563040a7ff7ac99831eed1ae07c) chore: add changeset for resource nodes feature - [`2450f4f`](https://github.com/run-llama/workflows-py/commit/2450f4fad2bf51eb0360c228ae58af148960d1db) fix: reverse resource edge direction to step -> resource - [`e987fd8`](https://github.com/run-llama/workflows-py/commit/e987fd893a75c6b6327ee125320f8e02ebfea351) refactor: unify DrawWorkflowNode and DrawWorkflowResourceNode - [`c436f7b`](https://github.com/run-llama/workflows-py/commit/c436f7b8867f083d026e9f24aa46a9c18b5c6aab) refactor: simplify _get_clean_node_id to use node_type prefix - [`8308200`](https://github.com/run-llama/workflows-py/commit/8308200b82bb7e0740158e31ac24021e7e67fdc6) refactor: merge resource_nodes into nodes list - [`17c952d`](https://github.com/run-llama/workflows-py/commit/17c952d9bcff161f3d65f0e5ebcca745a792e399) refactor: remove unnecessary backwards compatibility aliases - [`49c114b`](https://github.com/run-llama/workflows-py/commit/49c114b7b31f0ec226f2a5bbe383d18716539653) perf: make resource metadata extraction lazy - [`99b8f23`](https://github.com/run-llama/workflows-py/commit/99b8f23b6d9e7f688484b8632db8d34b94acf6ee) test: remove unnecessary async from mermaid drawing tests ### 📊 Changes **13 files changed** (+1804 additions, -395 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/add_resource_nodes.md` (+6 -0) ➕ `examples/visualization/resource_nodes_example.py` (+260 -0) 📝 `packages/llama-index-utils-workflow/pyproject.toml` (+1 -1) 📝 `packages/llama-index-utils-workflow/src/llama_index/utils/workflow/__init__.py` (+170 -148) 📝 `packages/llama-index-utils-workflow/tests/conftest.py` (+61 -0) 📝 `packages/llama-index-utils-workflow/tests/test_drawing.py` (+162 -18) 📝 `packages/llama-index-workflows/src/workflows/protocol/__init__.py` (+241 -19) 📝 `packages/llama-index-workflows/src/workflows/protocol/serializable_events.py` (+1 -2) 📝 `packages/llama-index-workflows/src/workflows/representation_utils.py` (+134 -121) 📝 `packages/llama-index-workflows/src/workflows/resource.py` (+2 -0) 📝 `packages/llama-index-workflows/src/workflows/server/server.py` (+1 -3) 📝 `packages/llama-index-workflows/src/workflows/utils.py` (+9 -2) 📝 `packages/llama-index-workflows/tests/test_representation_utils.py` (+756 -81) </details> ### 📄 Description Add support for visualizing resource dependencies in workflow graphs: - Enhanced _Resource class with source location metadata (file, line, docstring, unique hash for deduplication) - Added ResourceDefinition.type_annotation to capture the type from Annotated[T, Resource(...)] - Added WorkflowGraphResourceNode protocol model with full metadata - Added DrawWorkflowResourceNode class for intermediate representation - Updated DrawWorkflowEdge to support edge labels (variable names) - Modified extract_workflow_structure to extract and deduplicate resource nodes, connecting them to steps with labeled edges - Updated Pyvis and Mermaid renderers to display resource nodes (hexagon shape, plum color) with metadata tooltips Mermaid <img width="563" height="680" alt="image" src="https://github.com/user-attachments/assets/e5b794c3-b14c-4d95-9c1e-8ac50d14eafa" /> Vis html <img width="673" height="706" alt="image" src="https://github.com/user-attachments/assets/f4fb5786-ca5b-4bcf-ad8b-6b45119bb8bf" /> Additionally: - Removed excessive duplication of workflow graph dataclasses with pydantic models - Split nodes into a discriminated union of subtypes for better attributing fields to a node type - added doc strings as descriptions to workflows and nodes where applicable - add schema information to event nodes - added a utility for condensing the graph, removing an unwanted type (so e.g. you can now remove the new resource type, or, if you want you could convert the event node into just an edge --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:17:06 -05:00
yindo closed this issue 2026-02-16 02:17:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/workflows-py#275