diff --git a/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs b/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs index 0e1cce58..2404e896 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs @@ -14,9 +14,18 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler public List Parameters => new List { - new ParameterPropertyDef("reason", "why route to agent"), - new ParameterPropertyDef("next_action_agent", "agent for next action based on user latest response"), - new ParameterPropertyDef("user_goal_agent", "agent who can achieve user original goal"), + new ParameterPropertyDef("reason", "why route to agent") + { + Required = true + }, + new ParameterPropertyDef("next_action_agent", "agent for next action based on user latest response") + { + Required = true + }, + new ParameterPropertyDef("user_goal_agent", "agent who can achieve user original goal") + { + Required = true + }, new ParameterPropertyDef("args", "useful parameters of next action agent, format: { }") { Type = "object" diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeFunction.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeFunction.cs index 4b8bd099..d1be4254 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeFunction.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeFunction.cs @@ -12,6 +12,7 @@ public partial class RoutingService var originalFunctionName = message.FunctionName; message.FunctionName = name; message.Role = AgentRole.Function; + message.FunctionArgs = message.FunctionArgs; var result = await function.Execute(message); // restore original function name diff --git a/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid b/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid index 9147979f..3609e41f 100644 --- a/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid +++ b/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid @@ -13,7 +13,7 @@ You're {{router.name}} ({{router.description}}). Follow these steps to handle us Parameters: - function: {{ handler.name }} {% for p in handler.parameters -%} - - {{ p.name }}: {{ p.description }}{{ "\r\n " }} + - {{ p.name }} {% if p.required -%}(required){%- endif %}: {{ p.description }}{{ "\r\n " }} {%- endfor %} {%- endif %} {% endfor %}