diff --git a/codegen.go b/codegen.go index efe0f7a2..885dadcf 100755 --- a/codegen.go +++ b/codegen.go @@ -4950,7 +4950,16 @@ func handleRunDatastoreAutomation(ctx context.Context, cacheData CacheKeyData, a continue } + requiredApps := []string{"internal_datastore", "shuffle-datastore"} + for _, req := range requiredApps { + + if !ArrayContains(option.Apps, req) { + option.Apps = append(option.Apps, req) + } + } + allowedApps := strings.Join(option.Apps, ",") + parsedParams := []map[string]string{ map[string]string{ "name": "app_name", diff --git a/health.go b/health.go index 30bf1923..457b36a9 100644 --- a/health.go +++ b/health.go @@ -4659,6 +4659,7 @@ func startAgentExecution(baseUrl, apiKey, orgId string) (agentStartResult, error "input": map[string]string{ "text": "Get the current weather of new york using https://wttr.in/New+York?format=%t api and just output the current weather temperature without any commentary, just output the number in celcius and dont include the decimals, use action as custom_action, tool as http and category as singul keep the url as it and not needed for any other hallucinated params or headers, just include the url as is and the method name which is GET.", }, + "tool_name" : "http", }, } diff --git a/shared.go b/shared.go index 71417c0a..49701822 100644 --- a/shared.go +++ b/shared.go @@ -18124,6 +18124,20 @@ func handleAgentDecisionStreamResult(workflowExecution WorkflowExecution, action originalAction = actionResult.Action } + // If the execution is already FINISHED but a continuation was injected (user asked the agent to do more on top of what it already did), we need to reset the status back to EXECUTING so that HandleAiAgentExecutionStart doesn't exit with "Agent run already finished". We also persist this to cache so the guard in + if workflowExecution.Status == "FINISHED" || workflowExecution.Status == "SUCCESS" { + log.Printf("[INFO][%s] Agent continuation: resetting execution status from '%s' to 'EXECUTING' for continuation", workflowExecution.ExecutionId, workflowExecution.Status) + workflowExecution.Status = "EXECUTING" + workflowExecution.CompletedAt = 0 + + executionCacheKey := fmt.Sprintf("workflowexecution_%s", workflowExecution.ExecutionId) + DeleteCache(ctx, executionCacheKey) + marshalledExec, marshalErr := json.Marshal(workflowExecution) + if marshalErr == nil { + SetCache(ctx, executionCacheKey, marshalledExec, 30) + } + } + callerName := "handleAgentDecisionStreamResult" returnAction, err := HandleAiAgentExecutionStart(workflowExecution, originalAction, true, callerName) if err != nil {