Enhancement: Unified Management of Dynamic Prompts with Routing and Centralized Storage #18361

Closed
opened 2026-02-21 19:46:43 -05:00 by yindo · 0 comments
Owner

Originally created by @v-49 on GitHub (Sep 27, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Enhancement: Unified Management of Dynamic Prompts with Routing and Centralized Storage

Background

I'm currently working on prompt management in Dify workflows. Instead of directly embedding prompts into individual LLM nodes—which leads to redundancy—I want to route prompts through a centralized management point. This would allow prompts to be dynamically injected into LLM nodes via routing logic and a unified storage mechanism.

The key benefits of this approach include:

  • Avoiding the need to create multiple LLM nodes that differ only in prompt content but share the same responsibilities.
  • Enabling better scalability and maintainability, as prompts can be versioned, updated, or selected conditionally in one place without duplicating nodes.

Current Challenges

I've experimented with storing prompts in session variables, but this introduces several limitations:

  1. Parameter Insertion Issues: It's not possible to seamlessly insert dynamic parameters (e.g., weather data or user-specific inputs) into the prompt as part of the LLM input. These should behave like standard prompt variables, but session variables don't support this natively.
  2. Usability and Organization Problems: Session variables are cumbersome to work with—they can't be easily expanded or viewed in detail, and their structure is not intuitive for complex prompt organization. This makes debugging and editing far less efficient compared to direct code execution nodes for prompt handling.
  3. Aggregation Limitations: Variable aggregation nodes cannot incorporate session variables effectively, preventing the consolidation of prompts from multiple sources or routes.

These issues hinder effective dynamic prompt handling, especially in workflows requiring conditional or parameterized prompts.

Proposed Enhancement

To address the urgent need for unified management of dynamic prompts, I suggest enhancing Dify with:

  • A dedicated "Prompt Manager" node or component that acts as a centralized hub for storing, retrieving, and injecting prompts based on routing decisions.
  • Support for dynamic variable insertion (e.g., via templating like {{weather}} or {{user_input}}) directly within the managed prompts, ensuring they integrate smoothly with LLM nodes.
  • Improved UI/UX for prompt storage: Allow expandable views, hierarchical organization (e.g., folders or tags), and integration with code execution for advanced prompt assembly.
  • Better compatibility with aggregation logic, enabling session-like variables to be pulled into aggregators for building composite prompts.

This would streamline workflows, reduce node proliferation, and make Dify more robust for production-grade prompt engineering. I'd be happy to discuss implementation details or contribute if needed!

Image

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @v-49 on GitHub (Sep 27, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. ### Enhancement: Unified Management of Dynamic Prompts with Routing and Centralized Storage #### Background I'm currently working on prompt management in Dify workflows. Instead of directly embedding prompts into individual LLM nodes—which leads to redundancy—I want to route prompts through a centralized management point. This would allow prompts to be dynamically injected into LLM nodes via routing logic and a unified storage mechanism. The key benefits of this approach include: - Avoiding the need to create multiple LLM nodes that differ only in prompt content but share the same responsibilities. - Enabling better scalability and maintainability, as prompts can be versioned, updated, or selected conditionally in one place without duplicating nodes. #### Current Challenges I've experimented with storing prompts in session variables, but this introduces several limitations: 1. **Parameter Insertion Issues**: It's not possible to seamlessly insert dynamic parameters (e.g., weather data or user-specific inputs) into the prompt as part of the LLM input. These should behave like standard prompt variables, but session variables don't support this natively. 2. **Usability and Organization Problems**: Session variables are cumbersome to work with—they can't be easily expanded or viewed in detail, and their structure is not intuitive for complex prompt organization. This makes debugging and editing far less efficient compared to direct code execution nodes for prompt handling. 3. **Aggregation Limitations**: Variable aggregation nodes cannot incorporate session variables effectively, preventing the consolidation of prompts from multiple sources or routes. These issues hinder effective dynamic prompt handling, especially in workflows requiring conditional or parameterized prompts. #### Proposed Enhancement To address the urgent need for unified management of dynamic prompts, I suggest enhancing Dify with: - A dedicated "Prompt Manager" node or component that acts as a centralized hub for storing, retrieving, and injecting prompts based on routing decisions. - Support for dynamic variable insertion (e.g., via templating like `{{weather}}` or `{{user_input}}`) directly within the managed prompts, ensuring they integrate smoothly with LLM nodes. - Improved UI/UX for prompt storage: Allow expandable views, hierarchical organization (e.g., folders or tags), and integration with code execution for advanced prompt assembly. - Better compatibility with aggregation logic, enabling session-like variables to be pulled into aggregators for building composite prompts. This would streamline workflows, reduce node proliferation, and make Dify more robust for production-grade prompt engineering. I'd be happy to discuss implementation details or contribute if needed! <img width="1816" height="664" alt="Image" src="https://github.com/user-attachments/assets/faedef06-cabf-485d-aad4-ec7c3ed007e0" /> ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 19:46:43 -05:00
yindo closed this issue 2026-02-21 19:46:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18361