diff --git a/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs b/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs index 5ff9894e..462ee076 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs @@ -10,11 +10,11 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler public List Parameters => new List { - new ParameterPropertyDef("next_action_reason", "the reason why route to this agent") + new ParameterPropertyDef("next_action_reason", "the reason why route to this agent, if user is replying last agent's question, you must route to this agent") { Required = true }, - new ParameterPropertyDef("next_action_agent", "agent for next action based on user latest response") + new ParameterPropertyDef("next_action_agent", "agent for next action based on user latest response, if user is replying last agent's question, you must route to this agent") { Required = true }, diff --git a/src/Infrastructure/BotSharp.Core/Routing/Planning/NaivePlanner.cs b/src/Infrastructure/BotSharp.Core/Routing/Planning/NaivePlanner.cs index 3385eff0..0b1708c5 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/Planning/NaivePlanner.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/Planning/NaivePlanner.cs @@ -116,7 +116,7 @@ public class NaivePlanner : IPlaner var render = _services.GetRequiredService(); return render.Render(template, new Dictionary { - { "next_action_agent", states.GetState("next_action_agent")} + { "expected_next_action_agent", states.GetState("expected_next_action_agent")} }); } diff --git a/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid b/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid index 9407226c..2bf2698c 100644 --- a/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid +++ b/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid @@ -1,3 +1,7 @@ -What is the next step based on the CONVERSATION? -If user is replying with agent's question, you must route back to the previous agent {{ next_action_agent }}. -If user wants to speak to customer service, use function human_intervention_needed. \ No newline at end of file +What is the next step based on the CONVERSATION? +Route to the appropriate agent last handled agent based on the context. +{% if expected_next_action_agent != empty -%} +Expected next action agent is {{ expected_next_action_agent }}. +{%- endif %} +Try to keep the User Goal Agent be consistent as previous goal agent. +If user wants to speak to customer service, use function human_intervention_needed. \ No newline at end of file