CopilotKit icon indicating copy to clipboard operation
CopilotKit copied to clipboard

🚀 Feature Request: useCopilotAction: renderAndwaitForResponse need to be available for catch All Actions ,

Open SindhuZelar opened this issue 8 months ago • 2 comments

🎤 Tell us your idea

Greetings CopilotKit, I have a use case where i have some some n number of tools to undergo HITL , so instead of using multiple useCopilotAction , i want to use single hook when i checked with catchALLRenders -useCopilotAction with wildcard * at name , it doesnt work for renderandwaitForResponse Please enhance useCopilotAction feature(CATCH ALL ACTIONS) to work for renderandwaitForResponse

Image

SindhuZelar avatar May 02 '25 08:05 SindhuZelar

Hi @SindhuZelar, this is a great suggestion. We'll be adding this on our side soon or following up with a response if there is something blocking it.

Thanks again!

tylerslaton avatar May 05 '25 19:05 tylerslaton

Currently, useCopilotAction does not support using renderAndWaitForResponse with catch-all actions (wildcard * for the action name). While you can use a wildcard to catch all actions, this combination is explicitly blocked in the codebase.

Details from the Codebase

  • Wildcard actions exist but with limitations: You can use name: "*" to create catch-all actions, but they cannot use renderAndWaitForResponse.
  • Technical limitation: The source code explicitly prevents this combination with a check that returns false for isFrontendAction() when action.name === "*".

What works with wildcard actions

useCopilotAction({
  name: "*",
  render: ({ name, args, status, result, handler, respond }) => {
    return <div>Rendering action: {name}</div>;
  }
});

What doesn't work

// This will NOT work - renderAndWaitForResponse is blocked for catch-all actions
useCopilotAction({
  name: "*",
  handler: async () => {
    const response = await renderAndWaitForResponse(/* ... */); // ❌ Not available
  }
});

Alternative Approaches

  • Use specific action names: Instead of wildcards, define individual actions that can use renderAndWaitForResponse.
  • Use render property only: Catch-all actions can still provide UI rendering through the render property and receive the actual action name in props.

Future Enhancement Plans

  • No roadmap found: There's no evidence in the changelog or documentation of plans to enhance this feature to support renderAndWaitForResponse with wildcard actions.

Source Code Reference:


Was this helpful?

If this solution worked for you, please click on the appropriate option below to help us improve:

✅ Issue Solved | ❌ Need more help