Aller au contenu
login
arrow_backRetour aux issues
CopilotKit/CopilotKit #3206

🚀 Feature Request: Respond to tool call without followUp

ecoDébutant feature request help wanted

descriptionDescription

### 🎤 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: 1. Agent executes frontend tool 2. 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 3. 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: ```typescript // 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
codeOuvre sur GitHub