[PR #294] [MERGED] Add resource config node support to workflow representation #299

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

📋 Pull Request Information

Original PR: https://github.com/run-llama/workflows-py/pull/294
Author: @adrianlyjak
Created: 1/22/2026
Status: Merged
Merged: 1/23/2026
Merged by: @adrianlyjak

Base: mainHead: claude/add-resource-configs-graph-1DDYE


📝 Commits (6)

📊 Changes

9 files changed (+863 additions, -257 deletions)

View changed files

.changeset/gold-lemons-matter.md (+6 -0)
📝 packages/llama-index-utils-workflow/src/llama_index/utils/workflow/__init__.py (+18 -0)
📝 packages/llama-index-utils-workflow/tests/test_drawing.py (+108 -0)
📝 packages/llama-index-workflows/src/workflows/representation/__init__.py (+2 -0)
📝 packages/llama-index-workflows/src/workflows/representation/build.py (+154 -35)
📝 packages/llama-index-workflows/src/workflows/representation/types.py (+34 -0)
📝 packages/llama-index-workflows/src/workflows/resource.py (+20 -7)
📝 packages/llama-index-workflows/tests/test_annotation_resolution.py (+39 -0)
📝 packages/llama-index-workflows/tests/test_representation_utils.py (+482 -215)

📄 Description

Summary

This PR adds support for representing resource configuration nodes in workflow graphs. Resource configs are now extracted from resource factory functions and visualized as dedicated nodes in the workflow representation, with edges connecting resources to their configurations.

Key Changes

  • New WorkflowResourceConfigNode type: Added a new node type to represent configuration objects loaded from JSON files, including:

    • Configuration file path and optional path selector for nested values
    • Pydantic JSON schema for the config type (if applicable)
    • Actual config values read from files
  • Resource config extraction: Implemented _extract_resource_configs() to parse resource factory functions and identify ResourceConfig annotations, extracting:

    • Parameter names and type information
    • Config file paths and path selectors
    • JSON schema from Pydantic BaseModel types
    • Actual config values from files
  • Graph building enhancements:

    • Resource config nodes are automatically added to workflow graphs
    • Deduplication by (config_file, path_selector) tuple prevents duplicate nodes
    • Edges from resources to configs are labeled with the parameter name
  • Comprehensive test coverage: Added 10 new tests covering:

    • Basic resource config node extraction
    • Path selectors for nested configs
    • Config deduplication across multiple resources
    • Multiple different configs in one workflow
    • Node serialization/deserialization
    • Graph filtering with resource config nodes

Implementation Details

  • Config values are read from JSON files with graceful error handling (returns None if file unreadable)
  • Resource config nodes use SHA256 hashing of (config_file, path_selector) for unique, deterministic IDs
  • Pydantic model_json_schema() is used to extract JSON schemas from BaseModel config types
  • The implementation maintains backward compatibility with existing workflow representations

Open with Devin

🔄 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/294 **Author:** [@adrianlyjak](https://github.com/adrianlyjak) **Created:** 1/22/2026 **Status:** ✅ Merged **Merged:** 1/23/2026 **Merged by:** [@adrianlyjak](https://github.com/adrianlyjak) **Base:** `main` ← **Head:** `claude/add-resource-configs-graph-1DDYE` --- ### 📝 Commits (6) - [`4258a24`](https://github.com/run-llama/workflows-py/commit/4258a249a2a485d610ffcaf44d61befe5cb72f07) Squashed commit of the following: - [`ca16965`](https://github.com/run-llama/workflows-py/commit/ca169659c150018b9982ceb769e6aefc050315de) little dryer - [`406f7f8`](https://github.com/run-llama/workflows-py/commit/406f7f8772f116ac100486d338fae42da06fa8c9) simplify - [`59ede08`](https://github.com/run-llama/workflows-py/commit/59ede08d3ddd439190564f7f74a006f2717bf60e) Create gold-lemons-matter.md - [`4c9af20`](https://github.com/run-llama/workflows-py/commit/4c9af20a7522c6cecd5ce0659fa31c06d1dea5c0) Add label/description fields for configs - [`2f53657`](https://github.com/run-llama/workflows-py/commit/2f5365796b568251be178b58474dda8d7853cc84) cr fixup ### 📊 Changes **9 files changed** (+863 additions, -257 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/gold-lemons-matter.md` (+6 -0) 📝 `packages/llama-index-utils-workflow/src/llama_index/utils/workflow/__init__.py` (+18 -0) 📝 `packages/llama-index-utils-workflow/tests/test_drawing.py` (+108 -0) 📝 `packages/llama-index-workflows/src/workflows/representation/__init__.py` (+2 -0) 📝 `packages/llama-index-workflows/src/workflows/representation/build.py` (+154 -35) 📝 `packages/llama-index-workflows/src/workflows/representation/types.py` (+34 -0) 📝 `packages/llama-index-workflows/src/workflows/resource.py` (+20 -7) 📝 `packages/llama-index-workflows/tests/test_annotation_resolution.py` (+39 -0) 📝 `packages/llama-index-workflows/tests/test_representation_utils.py` (+482 -215) </details> ### 📄 Description ## Summary This PR adds support for representing resource configuration nodes in workflow graphs. Resource configs are now extracted from resource factory functions and visualized as dedicated nodes in the workflow representation, with edges connecting resources to their configurations. ## Key Changes - **New `WorkflowResourceConfigNode` type**: Added a new node type to represent configuration objects loaded from JSON files, including: - Configuration file path and optional path selector for nested values - Pydantic JSON schema for the config type (if applicable) - Actual config values read from files - **Resource config extraction**: Implemented `_extract_resource_configs()` to parse resource factory functions and identify `ResourceConfig` annotations, extracting: - Parameter names and type information - Config file paths and path selectors - JSON schema from Pydantic BaseModel types - Actual config values from files - **Graph building enhancements**: - Resource config nodes are automatically added to workflow graphs - Deduplication by (config_file, path_selector) tuple prevents duplicate nodes - Edges from resources to configs are labeled with the parameter name - **Comprehensive test coverage**: Added 10 new tests covering: - Basic resource config node extraction - Path selectors for nested configs - Config deduplication across multiple resources - Multiple different configs in one workflow - Node serialization/deserialization - Graph filtering with resource config nodes ## Implementation Details - Config values are read from JSON files with graceful error handling (returns None if file unreadable) - Resource config nodes use SHA256 hashing of (config_file, path_selector) for unique, deterministic IDs - Pydantic `model_json_schema()` is used to extract JSON schemas from BaseModel config types - The implementation maintains backward compatibility with existing workflow representations <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/run-llama/workflows-py/pull/294"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> --- <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:10 -05:00
yindo closed this issue 2026-02-16 02:17:10 -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#299