Skip to content

Conversation

@satti-hari-krishna-reddy
Copy link

@satti-hari-krishna-reddy satti-hari-krishna-reddy commented Dec 18, 2025

What's Changed ?

  • This PR adds App detection when agents mistakenly select the generic HTTP app instead of a specific integration (e.g., Gmail, Slack).

  • It achieves this by adding a condition that automatically corrects to the appropriate app if a match is found using an LLM along with the fields and a special reason field sent by the agent and falls back to HTTP if no specific app matches or HTTP is genuinely correct.

Also look at this PR: Shuffle/shuffle-shared#291

@satti-hari-krishna-reddy
Copy link
Author

@frikky Take a look at this when you get some time :)

Copy link
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop using and thinking in terms of for-loops and if-statements.

pkg/api.go Outdated

if strings.ToLower(value.AppName) == "http" {
// Smart app correction: Check if we should analyze intent and correct app selection
if strings.ToLower(value.AppName) == "http" && (value.Label == "api" || value.Label == "custom_action" || value.Action == "custom_action") && len(value.Query) > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom_action is associated with having an app. We should not do re-selection in that case.

pkg/api.go Outdated
if !standalone {
tmpApps, tmpErr = shuffle.GetPrioritizedApps(ctx, user)
if tmpErr == nil && len(tmpApps) > 0 {
correctedAppName := AnalyzeIntentAndCorrectApp(ctx, value.Query, value.Fields, tmpApps)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we passing in the "reason" as we discussed? ALL relevant information decided by the agent can and should be used.

pkg/api.go Outdated
// It caches results by URL
// Returns corrected app name or empty string if no correction needed
func AnalyzeIntentAndCorrectApp(ctx context.Context,
query string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wtf is this formatting 😆

Please just keep it one line.

pkg/api.go Outdated
- URL being called: "%s"
- Input fields provided: %s
Available apps: %s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SPECIFICALLY is an absolutely horrendous choice.

Again, when dealing with LLMs, stop thinking in terms of for-loops and if-statements!

You are forcing the user to have perfect information available already. That is not the right choice. Which I mentioned about 283 times in the last call.

pkg/api.go Outdated
func AnalyzeIntentAndCorrectApp(ctx context.Context,
query string,
fields []shuffle.Valuereplace,
availableApps []shuffle.WorkflowApp) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are absolutely intend on doing it based on "availableApps", why don't you just for-loop and search for it? LLM's are not necessary.

Bad choice of LLM use.

pkg/api.go Outdated
}

if len(foundApp) > 0 && foundApp != "http" {
// Cache for 3 days - same domain = same app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing domain name usage? What if we don't have it?

Stop using and thinking in terms of for-loops and if-statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants