diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs index 20ac5a05..e628bb46 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs @@ -151,7 +151,7 @@ public partial class RoutingService } // It should be Route to agent, but it is used as Response to user. - if (string.IsNullOrEmpty(args.AgentName) && + if (!string.IsNullOrEmpty(args.AgentName) && agents.Select(x => x.Name).Contains(args.AgentName) && args.Function != "route_to_agent") {