dify icon indicating copy to clipboard operation
dify copied to clipboard

API for dynamically updating agent instructions

Open akkaz opened this issue 1 year ago • 1 comments

Self Checks

  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [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.

I propose adding an API endpoint to Dify that enables the dynamic updating of an agent's instructions in real-time. This could be implemented as a POST request to the API, with the new instructions included in the request payload.

Current Workaround (and Limitations)

Our current workaround involves using a paragraph input variable passed to the API externally. While this functions when using Dify's UI for debugging and testing, it necessitates manually editing the variable each time we want to test the agent. This is cumbersome and doesn't scale for dynamic instruction updates.

We've also experimented with the API-based variable approach, but encountered difficulties due to the lack of documentation on its usage. This method also requires making an API call every time the agent is invoked, which could be resource-intensive.

Proposed Solution

I recommend implementing a POST/UPDATE API endpoint that allows external modification of agent instructions.

Future Enhancements

A similar mechanism could be applied to LLM block system prompts within workflows, offering greater flexibility and control over instruction updates.

Benefits of Dynamic Instruction Updates

Personalized Experiences: Tailor agent behavior to individual users or specific situations. Streamlined Workflow: Eliminate manual intervention for instruction changes. External Management: Manage and version instructions outside of Dify using tools like GitHub. Dynamic Instruction Generation: Change instructions based on external variables or data. Agent-Driven Updates: Allow other agents to modify instructions programmatically, creating a more adaptable system. Let me know if you'd like any further refinements!

2. Additional context or comments

No response

3. Can you help us with this feature?

  • [ ] I am interested in contributing to this feature.

akkaz avatar Jun 28 '24 12:06 akkaz

+1

I'm having the same problem

MattCarneiro avatar Aug 03 '24 20:08 MattCarneiro