🎤 Tell us your idea
Idea
I'd like to use AppendMessageOptions or only the followUp option when using the respond function from useHumanInTheLoop to have better control over the messages before an agent response is generated.
Use Case
I'm currently using useHumanInTheLoop to enable the agent to propose a list of elements to be created to the user that the user can edit and apply.
However the user should also be able to send a message with additional information and instructions if the proposition didn't meet their expectations.
If there is an unapproved tool call and the user sends their message, I want to first set a "rejected" tool result so that the tool call is completed gracefully and then send the message. Both - the user message and the tool result - should be send together to give the agent the full picture before a reply is generated.
In the sendMessage method I can use the optional AppendMessageOptions which offer the followUp option to tell CopilotKit to not immediately send the message.
In the respond method offered by useHumanInTheLoop these options are not exposed - instead followUp can currently only be configured in the arguments of useHumanInTheLoop beforehand.
If I understand it correctly, if the followUp option could be set when calling respond, I should be able to register the tool result "silently" and have it automatically be sent as soon as sendMessage is called with followUp: true.
To summarize my ideal scenario:
- Agent executes frontend tool
- User sends a message
2.1. Frontend tool is gracefully completed calling respond with "rejection" result and followUp: false
2.2. User message is sent calling sendMessage with followUp: true
2.3. CopilotKit sends both messages and triggers a new generation
- Agent can reference the user decision to reject the proposition from the first tool call and their new instructions to continue the dialogue or execute frontend tool again with improved proposition
In a nutshell:
// at design time (currently supported)
useHumanInTheLoop({
followUp: true, // sets the default value
});
// at runtime (currently not supported)
respond(result, {
followUp: false, // overwrites the default value if supplied
})
// at runtime (currently supported)
sendMessage(userMessage, {
followUp: true, // sends two messages (the tool result above and the user message created here)
})
Related Issues
#3154 Might be related, because they also needed to set followUp: false when calling useHumanInTheLoop and then manually call sendMessage with followUp: true inside the render function
🎤 Tell us your idea
Idea
I'd like to use
AppendMessageOptionsor only thefollowUpoption when using therespondfunction fromuseHumanInTheLoopto have better control over the messages before an agent response is generated.Use Case
I'm currently using
useHumanInTheLoopto enable the agent to propose a list of elements to be created to the user that the user can edit and apply.However the user should also be able to send a message with additional information and instructions if the proposition didn't meet their expectations.
If there is an unapproved tool call and the user sends their message, I want to first set a "rejected" tool result so that the tool call is completed gracefully and then send the message. Both - the user message and the tool result - should be send together to give the agent the full picture before a reply is generated.
In the
sendMessagemethod I can use the optionalAppendMessageOptionswhich offer thefollowUpoption to tell CopilotKit to not immediately send the message.In the
respondmethod offered byuseHumanInTheLoopthese options are not exposed - insteadfollowUpcan currently only be configured in the arguments ofuseHumanInTheLoopbeforehand.If I understand it correctly, if the
followUpoption could be set when callingrespond, I should be able to register the tool result "silently" and have it automatically be sent as soon assendMessageis called withfollowUp: true.To summarize my ideal scenario:
2.1. Frontend tool is gracefully completed calling
respondwith "rejection" result andfollowUp: false2.2. User message is sent calling
sendMessagewithfollowUp: true2.3. CopilotKit sends both messages and triggers a new generation
In a nutshell:
Related Issues
#3154 Might be related, because they also needed to set
followUp: falsewhen callinguseHumanInTheLoopand then manually callsendMessagewithfollowUp: trueinside the render function