WrenAI icon indicating copy to clipboard operation
WrenAI copied to clipboard

Instructions order

Open omarragi9 opened this issue 7 months ago • 3 comments

Is your feature request related to a problem? Please describe. I often write multiple instructions for the AI, some of which depend on the output of others. Currently, there’s no way to guarantee the execution order, so I end up with race conditions where the AI executes them in an unpredictable sequence "as far as I know".

Describe the solution you'd like Introduce an “order” (or “priority”) field for each instruction in the Instructions tab.

  • This could be a simple integer (e.g. 1, 2, 3) or a drag-and-drop UI to re-order instructions.
  • The system would then process instructions strictly in ascending order of this field.

Additional context If possible, it would be great to visualize the dependency graph (e.g. arrows showing “this runs after that”).

omarragi9 avatar May 22 '25 11:05 omarragi9

@omarragi9 This is an interesting idea; however I am thinking that whether LLMs can be so smart to follow the order of instructions. What is your thought here? How about we schedule a time for further discussion?

cyyeh avatar May 22 '25 23:05 cyyeh

@cyyeh, thanks for your interest—I’d be happy to discuss this with you.

I ran into a situation where WrenAI was constructing the SQL query after formatting the dates, which meant the date formatting never actually happened. To work around this, I need to explicitly tell it to construct the query first then format the date, I know it doesn't seem logical but you got my idea,

For reference, here are the reasoning steps WrenAI follows:

  1. Format date outputs: Ensure all date fields are formatted as per the instructions, in YYYY-MM-DD format.

  2. Construct the query: Combine all the above steps into a SQL query that filters, calculates, sorts, and retrieves the required data.

  3. Final step: Present the list of sprints with their details, sorted by delay duration, with dates formatted correctly.

I ultimately resolved the issue by issuing multiple, varied instructions—using different phrasing and examples—to cover all the date‑formatting scenarios, and it worked, but still it sounds wrong.

It may be that my instructions weren't effective in the earlier phase, but still I think this feature will give the use more flexibility, also we can make it optional to allow the user to try if the AI will be smart enough or not.

P.S. I know I could adjust the configuration to fix this permanently, but I’m not able to do that at the moment.

Sorry for the late reply!

omarragi9 avatar May 26 '25 08:05 omarragi9

Can I intervene in the output format of the responses? For example: like this (

 # Example: 

## User Question: Check the xxx status of host xxxx from xx to xx today 
## Response Sample: This host xxxx belongs to the xx application, with specifications xxx... Below is the xxx status of the host from eight to nine today: xxxxx

) I uploaded it in Manage Instruction, but it didn't take effect.

Image

datalee avatar Aug 21 '25 00:08 datalee