Repository navigation
feat: copilot action wrappers - #2566
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
WalkthroughAdds four new frontend-oriented hooks (useFrontendTool, useHumanInTheLoop, useRenderToolCall, useDefaultTool) as thin wrappers around useCopilotAction, re-exports them, updates example/registry code to use the new hooks, renames “frontend actions” → “frontend tools” across docs (and marks useCopilotAction deprecated), and adds a changeset. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Developer
participant Component
participant useFrontendTool
participant useCopilotAction
participant CopilotRuntime
Developer->>Component: define tool {name, description, parameters, handler/render}
Component->>useFrontendTool: call(tool, deps)
useFrontendTool->>useCopilotAction: delegate(tool, deps)
useCopilotAction-->>CopilotRuntime: register tool (frontend)
Note over CopilotRuntime,Component: Model/runtime invokes tool by name with args
CopilotRuntime->>useCopilotAction: tool call event
alt handler provided
useCopilotAction->>Component: invoke handler(args)
else render provided
useCopilotAction->>Component: invoke render({args, status, result, respond})
end
sequenceDiagram
autonumber
actor Developer
participant Component
participant useHumanInTheLoop
participant useCopilotAction
participant CopilotRuntime
Developer->>Component: define HITL tool with render (await user response)
Component->>useHumanInTheLoop: call(tool, deps)
useHumanInTheLoop->>useCopilotAction: delegate({ available: "remote", renderAndWaitForResponse <- render })
CopilotRuntime->>Component: request UI via render
Component->>CopilotRuntime: respond(result) when user completes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (30)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (10)
🧰 Additional context used📓 Path-based instructions (7)docs/**/*📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Files:
docs/content/docs/**/*📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Files:
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Files:
CopilotKit/packages/react-core/**📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
Files:
CopilotKit/packages/react-core/**/*📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Files:
registry/**/*📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Files:
🧠 Learnings (5)📚 Learning: 2025-07-04T14:02:44.814ZApplied to files:
📚 Learning: 2025-07-20T15:40:00.391ZApplied to files:
📚 Learning: 2025-07-20T15:40:00.391ZApplied to files:
📚 Learning: 2025-07-18T15:03:09.673ZApplied to files:
📚 Learning: 2025-07-18T15:03:09.673ZApplied to files:
🧬 Code graph analysis (3)registry/registry/quickstarts/no-agent-framework.tsx (1)
CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts (1)
registry/registry/quickstarts/coagents-generic-lg/page.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
🔇 Additional comments (36)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/content/docs/langgraph/frontend-actions.mdx (1)
17-18: Update the setup instructions to say “frontend tools”.This sentence still references “frontend actions,” which undermines the migration messaging. Please switch it to “frontend tools” for consistency.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (29)
CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx(2 hunks)CopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsx(2 hunks)CopilotKit/packages/react-core/src/hooks/index.ts(1 hunks)CopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts(1 hunks)CopilotKit/packages/react-core/src/hooks/use-default-tool.ts(1 hunks)CopilotKit/packages/react-core/src/hooks/use-frontend-tool.ts(1 hunks)CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts(1 hunks)CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts(1 hunks)docs/content/docs/(root)/agentic-chat-ui.mdx(2 hunks)docs/content/docs/(root)/faq.mdx(1 hunks)docs/content/docs/ag2/frontend-actions.mdx(4 hunks)docs/content/docs/direct-to-llm/guides/frontend-actions.mdx(4 hunks)docs/content/docs/direct-to-llm/guides/generative-ui.mdx(10 hunks)docs/content/docs/direct-to-llm/guides/quickstart.mdx(1 hunks)docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx(1 hunks)docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-copilot-actions.mdx(0 hunks)docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx(1 hunks)docs/content/docs/langgraph/frontend-actions.mdx(4 hunks)docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx(6 hunks)docs/content/docs/mastra/frontend-actions.mdx(3 hunks)docs/content/docs/reference/classes/CopilotTask.mdx(1 hunks)docs/content/docs/reference/hooks/useCopilotAction.mdx(1 hunks)docs/content/docs/reference/hooks/useFrontendTool.mdx(1 hunks)docs/content/docs/reference/hooks/useHumanInTheLoop.mdx(1 hunks)docs/content/docs/reference/hooks/useRenderToolCall.mdx(1 hunks)registry/registry/quickstarts/coagents-generic-lg/page.tsx(2 hunks)registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx(2 hunks)registry/registry/quickstarts/mcp-starter/page.tsx(2 hunks)registry/registry/quickstarts/no-agent-framework.tsx(3 hunks)
💤 Files with no reviewable changes (1)
- docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-copilot-actions.mdx
🧰 Additional context used
📓 Path-based instructions (7)
docs/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Check [docs/] for documentation site
Files:
docs/content/docs/reference/hooks/useFrontendTool.mdxdocs/content/docs/reference/classes/CopilotTask.mdxdocs/content/docs/reference/hooks/useHumanInTheLoop.mdxdocs/content/docs/reference/hooks/useCopilotAction.mdxdocs/content/docs/direct-to-llm/guides/quickstart.mdxdocs/content/docs/reference/hooks/useRenderToolCall.mdxdocs/content/docs/(root)/agentic-chat-ui.mdxdocs/content/docs/direct-to-llm/guides/frontend-actions.mdxdocs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdxdocs/content/docs/langgraph/frontend-actions.mdxdocs/content/docs/direct-to-llm/guides/generative-ui.mdxdocs/content/docs/mastra/frontend-actions.mdxdocs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdxdocs/content/docs/langgraph/human-in-the-loop/node-flow.mdxdocs/content/docs/(root)/faq.mdxdocs/content/docs/ag2/frontend-actions.mdx
docs/content/docs/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
See [docs/content/docs/] for markdown documentation files
Files:
docs/content/docs/reference/hooks/useFrontendTool.mdxdocs/content/docs/reference/classes/CopilotTask.mdxdocs/content/docs/reference/hooks/useHumanInTheLoop.mdxdocs/content/docs/reference/hooks/useCopilotAction.mdxdocs/content/docs/direct-to-llm/guides/quickstart.mdxdocs/content/docs/reference/hooks/useRenderToolCall.mdxdocs/content/docs/(root)/agentic-chat-ui.mdxdocs/content/docs/direct-to-llm/guides/frontend-actions.mdxdocs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdxdocs/content/docs/langgraph/frontend-actions.mdxdocs/content/docs/direct-to-llm/guides/generative-ui.mdxdocs/content/docs/mastra/frontend-actions.mdxdocs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdxdocs/content/docs/langgraph/human-in-the-loop/node-flow.mdxdocs/content/docs/(root)/faq.mdxdocs/content/docs/ag2/frontend-actions.mdx
CopilotKit/packages/react-core/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Files:
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.tsCopilotKit/packages/react-core/src/hooks/use-render-tool-call.tsCopilotKit/packages/react-core/src/hooks/index.tsCopilotKit/packages/react-core/src/hooks/use-default-tool.tsCopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.tsCopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Use TypeScript for better type safety
Files:
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.tsCopilotKit/packages/react-core/src/hooks/use-render-tool-call.tsCopilotKit/packages/react-core/src/hooks/index.tsCopilotKit/packages/react-core/src/hooks/use-default-tool.tsregistry/registry/quickstarts/no-agent-framework.tsxregistry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxCopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsxCopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsxregistry/registry/quickstarts/coagents-generic-lg/page.tsxCopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.tsregistry/registry/quickstarts/mcp-starter/page.tsxCopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Maintain consistent styling with Tailwind CSS
Files:
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.tsCopilotKit/packages/react-core/src/hooks/use-render-tool-call.tsCopilotKit/packages/react-core/src/hooks/index.tsCopilotKit/packages/react-core/src/hooks/use-default-tool.tsregistry/registry/quickstarts/no-agent-framework.tsxregistry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxCopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsxCopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsxregistry/registry/quickstarts/coagents-generic-lg/page.tsxCopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.tsregistry/registry/quickstarts/mcp-starter/page.tsxCopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
CopilotKit/packages/react-core/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Use [react-core/] for basic integration when building a simple Copilot
Files:
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.tsCopilotKit/packages/react-core/src/hooks/use-render-tool-call.tsCopilotKit/packages/react-core/src/hooks/index.tsCopilotKit/packages/react-core/src/hooks/use-default-tool.tsCopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.tsCopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
registry/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Browse [registry/] for reusable UI components
Files:
registry/registry/quickstarts/no-agent-framework.tsxregistry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxregistry/registry/quickstarts/coagents-generic-lg/page.tsxregistry/registry/quickstarts/mcp-starter/page.tsx
🧠 Learnings (8)
📚 Learning: 2025-07-04T14:02:44.814Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to CopilotKit/packages/react-core/**/* : Use [react-core/] for basic integration when building a simple Copilot
Applied to files:
registry/registry/quickstarts/no-agent-framework.tsxregistry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxdocs/content/docs/direct-to-llm/guides/generative-ui.mdxregistry/registry/quickstarts/coagents-generic-lg/page.tsxregistry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check if `useCopilotChatSuggestions` is being called in your component if there are no initial suggestions
Applied to files:
registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxregistry/registry/quickstarts/coagents-generic-lg/page.tsxregistry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check useEffect dependencies and ensure they're properly memoized to avoid infinite re-renders
Applied to files:
registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxregistry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-18T15:03:09.673Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-18T15:03:09.673Z
Learning: Applies to CopilotKit/packages/react-ui/** : UI components for copilot interfaces should be placed in CopilotKit/packages/react-ui/
Applied to files:
registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
📚 Learning: 2025-07-18T15:03:09.673Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-18T15:03:09.673Z
Learning: Applies to CopilotKit/packages/react-core/** : Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Applied to files:
registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsxregistry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Don't modify suggestions state directly - Always use the provided hooks and functions
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Verify `useCopilotChatSuggestions` is registering configuration
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/components/chat/Chat.tsx : Use `suggestions="auto"` on CopilotChat for most cases
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
🧬 Code graph analysis (4)
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.ts (1)
CopilotKit/packages/react-core/src/hooks/index.ts (2)
useFrontendTool(22-22)useCopilotAction(10-10)
CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts (1)
CopilotKit/packages/react-core/src/hooks/index.ts (2)
useRenderToolCall(24-24)useCopilotAction(10-10)
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts (1)
CopilotKit/packages/react-core/src/hooks/index.ts (2)
useDefaultTool(25-25)useCopilotAction(10-10)
registry/registry/quickstarts/no-agent-framework.tsx (1)
registry/registry/quickstarts/mcp-starter/page.tsx (1)
CopilotKitPage(12-26)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: Test (18.x)
- GitHub Check: Test (20.x)
- GitHub Check: E2E Tests
🔇 Additional comments (33)
docs/content/docs/reference/classes/CopilotTask.mdx (1)
13-13: Documentation update aligns with terminology shift.The reference to
useFrontendToolinstead ofuseCopilotActionis consistent with the PR's goal of simplifying hook naming and clarifying use cases.CopilotKit/packages/react-core/src/hooks/use-frontend-tool.ts (1)
1-14: LGTM! Clean delegation to useCopilotAction.The hook correctly forwards all specified properties (
name,description,parameters,handler,followUp,render) to the underlyinguseCopilotActionimplementation. The use of a const generic and Pick utility ensures type safety and clear intent.CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts (1)
1-16: LGTM! Correct delegation with frontend availability constraint.The hook correctly delegates to
useCopilotActionwhile explicitly settingavailable: "frontend". The Pick type appropriately excludeshandlerandfollowUp, focusing on render-only tool calls. This aligns with the hook's intent to handle frontend rendering without executing handlers.CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts (1)
1-21: LGTM! Correct delegation with remote availability and render mapping.The hook correctly:
- Destructures
renderfrom the tool config and maps it torenderAndWaitForResponse- Sets
available: "remote"to indicate this tool is for remote agents- Forwards remaining properties to
useCopilotActionThis implementation aligns with the human-in-the-loop pattern where the tool waits for user response before proceeding.
docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx (1)
17-74: Excellent tutorial demonstrating useFrontendTool best practices.The code examples clearly demonstrate:
- Proper Zod schema usage for type-safe parameter validation
- Clear tool descriptions to guide LLM tool selection
- Type-safe handlers leveraging Zod inference
- Integration within a React context provider
The documentation is well-structured and provides clear guidance for developers migrating from
useCopilotActionto the newuseFrontendToolhook.docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx (1)
25-25: Documentation update aligns with terminology shift.The update from
useCopilotActiontouseFrontendToolin the learning objectives is consistent with the broader migration to tool-centric terminology throughout the codebase.docs/content/docs/reference/hooks/useCopilotAction.mdx (1)
6-14: Clear and actionable deprecation notice.The deprecation warning:
- Provides clear migration paths to specialized hooks
- Explains the purpose of each replacement hook
- Acknowledges backward compatibility for existing code
- Guides developers toward better type safety and clearer intent
This aligns with the PR's goal of simplifying the API surface while maintaining backward compatibility.
CopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsx (1)
1-1: Clean migration to useFrontendTool preserving behavior.The replacement of
useCopilotActionwithuseFrontendToolis a straightforward substitution with no changes to the configuration object or handler/render logic. This demonstrates that the new hook maintains API compatibility while providing clearer semantic intent.Also applies to: 10-10
docs/content/docs/direct-to-llm/guides/quickstart.mdx (1)
174-176: LGTM! Terminology update and typo fix.The update from "Frontend Actions" to "Frontend Tools" aligns with the broader migration in this PR. The description correction ("execute tools in the frontend" vs. the grammatically incorrect "take applications on frontend") improves clarity.
registry/registry/quickstarts/coagents-generic-lg/page.tsx (2)
3-3: LGTM!The import update from
useCopilotActiontouseDefaultToolaligns with the migration to tool-centric APIs in this PR.
45-52: LGTM!The hook migration from
useCopilotActiontouseDefaultToolmaintains the same configuration and render behavior. The catch-all tool rendering logic remains intact.CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx (2)
1-1: LGTM!The import update from
useCopilotActiontouseFrontendToolaligns with the migration to tool-centric APIs.
16-72: LGTM!The hook migration from
useCopilotActiontouseFrontendToolmaintains the same configuration structure and behavior. The slide append logic and rendering remain unchanged.docs/content/docs/reference/hooks/useFrontendTool.mdx (1)
1-187: LGTM! Comprehensive documentation.The documentation for
useFrontendToolis thorough and well-organized:
- Clear usage examples (simple and with custom UI)
- Detailed parameter descriptions
- Helpful migration guide from
useCopilotAction- Good integration with the broader Generative UI concept
The migration examples will be especially helpful for users transitioning from the action-based API.
registry/registry/quickstarts/no-agent-framework.tsx (4)
3-3: LGTM!The import update from
useCopilotActiontouseFrontendToolaligns with the migration to tool-centric APIs.
10-22: LGTM! Description added.The
setThemeColorhook migration touseFrontendToolis clean. The addition of a description ("Set the theme color of the interface") improves clarity for the LLM.
55-67: LGTM! Description added.The
addProverbhook migration touseFrontendToolis consistent. The addition of a description ("Add a proverb to the list") provides better context for the LLM.
70-88: LGTM!The
generateGradientCardhook migration touseFrontendToolmaintains the same render logic and behavior. The tool correctly generates custom UI in the chat interface.docs/content/docs/(root)/faq.mdx (2)
49-49: LGTM!The terminology update from "take actions" to "execute tools" is consistent with the broader migration in this PR.
53-56: LGTM!The updates to "Frontend Tools" and "Copilot Tasks" descriptions consistently reflect the tool-centric terminology. The documentation now aligns with the new API surface (
useFrontendTooland related hooks).CopilotKit/packages/react-core/src/hooks/use-default-tool.ts (1)
1-7: LGTM – type and export verified
CatchAllFrontendAction is correctly defined and useDefaultTool is exported from the hooks index.CopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts (1)
70-70: Deprecation reference is correct
TheuseCopilotChatHeadless_chook is exported by@copilotkit/react-coreand providessendMessage, so the deprecation notice is accurate.CopilotKit/packages/react-core/src/hooks/index.ts (1)
22-25: LGTM! Clean API surface expansion.The four new hooks are properly exported and follow the existing export pattern. Backward compatibility is maintained by keeping
useCopilotAction(line 10), allowing gradual migration.registry/registry/quickstarts/mcp-starter/page.tsx (2)
52-58: Migration to useDefaultTool is correct.The hook migration from
useCopilotActiontouseDefaultToolis appropriate for catch-all tool rendering. The configuration shape and render props are preserved, ensuring a smooth transition.
5-5: No change required:CatchAllActionRenderPropsis the defined type in@copilotkit/react-coreand noCatchAllToolRenderPropsexists—keep the existing import.Likely an incorrect or invalid review comment.
docs/content/docs/reference/hooks/useHumanInTheLoop.mdx (1)
1-256: Excellent documentation for the new hook.The documentation is comprehensive, well-structured, and includes:
- Clear purpose statement and visual example
- Practical usage examples (simple confirmation and complex input collection)
- Detailed parameter documentation
- Best practices for implementation
- Migration guide from
useCopilotActionwith side-by-side comparisonThe migration guide (lines 207-250) is particularly helpful, clearly showing the differences in API (Zod schemas,
rendervsrenderAndWaitForResponse, checking forrespondfunction).docs/content/docs/reference/hooks/useRenderToolCall.mdx (1)
1-222: Well-documented hook for rendering tool calls.The documentation effectively covers:
- Clear distinction from
useFrontendTool(no handler function)- Practical examples for specific backend tools and catch-all rendering
- MCP tool integration pattern
- Comprehensive parameter documentation
- Common use cases section
- Straightforward migration guide from
useCopilotActionThe catch-all pattern (
name: "*") is particularly well-explained with practical examples (lines 58-101).registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx (2)
3-3: Clean migration to useFrontendTool.The import and hook migration from
useCopilotActiontouseFrontendToolis correct, maintaining the same configuration shape and behavior.
44-58: Configuration preserved correctly.The hook usage maintains the identical configuration structure (name, description, parameters, handler, followUp), ensuring a seamless drop-in replacement.
docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx (2)
50-91: Documentation correctly reflects the new API.The migration from
useCopilotActionwithrenderAndWaitForResponsetouseHumanInTheLoopwithrenderis accurately documented. The example code correctly shows:
- New import path
- Updated hook name
- Changed render prop name
- Consistent status checking pattern
104-296: Terminology consistently updated throughout agent examples.The agent implementation examples correctly reflect the terminology shift from "CopilotKit actions" to "CopilotKit tools" across both Python and TypeScript examples, maintaining accuracy and consistency.
docs/content/docs/direct-to-llm/guides/frontend-actions.mdx (1)
1-106: Comprehensive guide update with helpful context.The documentation has been thoroughly updated to reflect the new "Frontend Tools" paradigm:
- Consistent terminology shift from actions to tools
- Updated import paths and hook names
- Helpful accordion section (lines 53-59) guiding users to choose between
useFrontendTool,useHumanInTheLoop, anduseRenderToolCallbased on use case- Updated next steps and references
The accordion providing context on when to use different hooks is particularly valuable for helping users choose the right API.
docs/content/docs/ag2/frontend-actions.mdx (1)
1-96: AG2 documentation updated consistently.The AG2-specific frontend actions/tools documentation has been comprehensively updated:
- Title and descriptions reflect "Frontend Tools" terminology
- Import paths and hook names changed to
useFrontendTool- References to accessing and invoking tools (instead of actions) are consistent
- Links updated to point to the new
/frontend-toolspaths- Code examples properly migrated
All changes align with the broader API refactor across the codebase.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
docs/content/docs/direct-to-llm/guides/generative-ui.mdx (1)
220-225: Update the example to use the new CatchAllToolRenderProps type.The snippet still annotates
renderwithCatchAllActionRenderProps, which no longer exists. Switch the annotation toCatchAllToolRenderPropsso the sample compiles as written.-useDefaultTool({ - name: "*", - render: ({ name, args, status, result }: CatchAllActionRenderProps<[]>) => { +useDefaultTool({ + name: "*", + render: ({ name, args, status, result }: CatchAllToolRenderProps<[]>) => {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CopilotKit/.changeset/friendly-ducks-mate.md(1 hunks)docs/content/docs/direct-to-llm/guides/generative-ui.mdx(10 hunks)docs/content/docs/mastra/frontend-actions.mdx(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- CopilotKit/.changeset/friendly-ducks-mate.md
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Check [docs/] for documentation site
Files:
docs/content/docs/mastra/frontend-actions.mdxdocs/content/docs/direct-to-llm/guides/generative-ui.mdx
docs/content/docs/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
See [docs/content/docs/] for markdown documentation files
Files:
docs/content/docs/mastra/frontend-actions.mdxdocs/content/docs/direct-to-llm/guides/generative-ui.mdx
🧠 Learnings (1)
📚 Learning: 2025-07-04T14:02:44.814Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to CopilotKit/packages/react-core/**/* : Use [react-core/] for basic integration when building a simple Copilot
Applied to files:
docs/content/docs/direct-to-llm/guides/generative-ui.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: E2E Tests
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
registry/registry/quickstarts/mcp-starter/page.tsx (1)
52-57: Optional: Align render-props type with “tool” terminology
CatchAllActionRenderPropsis defined in react-core/src/types/frontend-action.ts and used across quickstarts and context. Renaming it toCatchAllToolRenderProps(or adding atype CatchAllToolRenderProps<T> = CatchAllActionRenderProps<T>) will require changes in the core package and all import sites—confirm your preferred approach.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts(1 hunks)docs/content/docs/direct-to-llm/guides/generative-ui.mdx(10 hunks)docs/content/docs/reference/hooks/useDefaultTool.mdx(1 hunks)docs/content/docs/reference/hooks/useRenderToolCall.mdx(1 hunks)registry/registry/quickstarts/coagents-generic-lg/page.tsx(2 hunks)registry/registry/quickstarts/mcp-starter/page.tsx(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/content/docs/reference/hooks/useRenderToolCall.mdx
🚧 Files skipped from review as they are similar to previous changes (2)
- registry/registry/quickstarts/coagents-generic-lg/page.tsx
- docs/content/docs/direct-to-llm/guides/generative-ui.mdx
🧰 Additional context used
📓 Path-based instructions (7)
docs/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Check [docs/] for documentation site
Files:
docs/content/docs/reference/hooks/useDefaultTool.mdx
docs/content/docs/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
See [docs/content/docs/] for markdown documentation files
Files:
docs/content/docs/reference/hooks/useDefaultTool.mdx
CopilotKit/packages/react-core/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Files:
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Use TypeScript for better type safety
Files:
CopilotKit/packages/react-core/src/hooks/use-default-tool.tsregistry/registry/quickstarts/mcp-starter/page.tsx
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Maintain consistent styling with Tailwind CSS
Files:
CopilotKit/packages/react-core/src/hooks/use-default-tool.tsregistry/registry/quickstarts/mcp-starter/page.tsx
CopilotKit/packages/react-core/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Use [react-core/] for basic integration when building a simple Copilot
Files:
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
registry/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Browse [registry/] for reusable UI components
Files:
registry/registry/quickstarts/mcp-starter/page.tsx
🧠 Learnings (7)
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check useEffect dependencies and ensure they're properly memoized to avoid infinite re-renders
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check if `useCopilotChatSuggestions` is being called in your component if there are no initial suggestions
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Don't modify suggestions state directly - Always use the provided hooks and functions
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-04T14:02:44.814Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to CopilotKit/packages/react-core/**/* : Use [react-core/] for basic integration when building a simple Copilot
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Verify `useCopilotChatSuggestions` is registering configuration
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/components/chat/Chat.tsx : Use `suggestions="auto"` on CopilotChat for most cases
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
📚 Learning: 2025-07-18T15:03:09.673Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-18T15:03:09.673Z
Learning: Applies to CopilotKit/packages/react-core/** : Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Applied to files:
registry/registry/quickstarts/mcp-starter/page.tsx
🧬 Code graph analysis (2)
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts (1)
CopilotKit/packages/react-core/src/hooks/index.ts (2)
useDefaultTool(25-25)useCopilotAction(10-10)
registry/registry/quickstarts/mcp-starter/page.tsx (1)
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts (1)
useDefaultTool(4-7)
🪛 GitHub Actions: Quality
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
[error] 1-1: Prettier formatting check failed for this file during 'npx turbo run check-prettier'. Issue: [warn] Code style issues found. Run 'prettier --write' to fix. The check-prettier command exited with code 1.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Test (20.x)
- GitHub Check: Test (18.x)
- GitHub Check: E2E Tests
🔇 Additional comments (3)
registry/registry/quickstarts/mcp-starter/page.tsx (1)
5-5: LGTM! Import updated correctly.The import change from
useCopilotActiontouseDefaultToolaligns with the new hook wrapper approach introduced in this PR.CopilotKit/packages/react-core/src/hooks/use-default-tool.ts (1)
4-6: Implementation looks correct.The wrapper correctly:
- Uses
Omit<CatchAllFrontendAction, 'name'>to exclude the name field from the input- Spreads the tool and overrides
namewith'*'for catch-all behavior- Uses
satisfiesfor type checking to ensure correctness- Passes through optional dependencies to
useCopilotActionThis provides a clean, type-safe API for catch-all tool rendering.
docs/content/docs/reference/hooks/useDefaultTool.mdx (1)
1-139: Documentation is comprehensive and well-structured.The documentation provides:
- Clear usage examples covering basic and MCP-specific scenarios
- Detailed parameter references with proper typing information
- Common use cases that help users understand when to use this hook
- Migration guidance from
useCopilotActionfor existing usersThe structure follows good documentation practices with examples before reference material.
d78a4fa to
180c9e2
Compare
🦋 Changeset detectedLatest commit: 180c9e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Click here if you're a maintainer who wants to add another changeset to this PR |
|
Preview environments destroyed for this pull request. |
Test ResultsStatus: ✅ Passed (View Run) Commit: fcc0bce Duration: 305.5s Total Tests: 37 Pass Rate: 100.0% Failed Tests: 0 🔍 Detailed Resultscoagents-research-canvasCoAgents Research Canvas (UI) - Local Depenencies
coagents-qa-nativeCoAgents QA Native (UI) - Local
coagents-qa-textCoAgents QA Text (UI) - Local
coagents-routingCoAgents Routing (UI) - Local
next-openaiNext OpenAI - Self Hosted
|
This PR introduces new hooks which wraps "useCopilotAction". These are meant to be easier to understand, as they address specific use cases.
It's a simplification of #2257
Summary by CodeRabbit
New Features
Documentation
Chores