Skip to content

feat: copilot action wrappers - #2566

Merged
ranst91 merged 9 commits into
mainfrom
feat/copilot-action-wrappers
Oct 3, 2025
Merged

ranst91 merged 9 commits into
mainfrom
feat/copilot-action-wrappers

Conversation

@ranst91

@ranst91 ranst91 commented Oct 2, 2025 •

Copy link
Copy Markdown
Contributor

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

    • Added new frontend "tool" hooks (tool registration, human-in-the-loop, render-call, default tool) and a TasksProvider example showcasing tool-based integrations; examples/quickstarts updated to use tools.
  • Documentation

    • Rebranded "Frontend Actions" → "Frontend Tools" across docs, guides, tutorials, FAQs; added reference docs and migration guidance; original action API marked deprecated.
  • Chores

    • Added changeset for a patch release.

@vercel

vercel Bot commented Oct 2, 2025 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Oct 3, 2025 8:29am
examples-coagents-ai-travel-app Ready Ready Preview Comment Oct 3, 2025 8:29am
examples-coagents-research-canvas-ui Ready Ready Preview Comment Oct 3, 2025 8:29am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
examples-coagents-ai-researcher-ui Ignored Ignored Oct 3, 2025 8:29am

@coderabbitai

coderabbitai Bot commented Oct 2, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds 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

Cohort / File(s) Summary
React core hooks: new wrappers & exports
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.ts, CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts, CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts, CopilotKit/packages/react-core/src/hooks/use-default-tool.ts, CopilotKit/packages/react-core/src/hooks/index.ts, CopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
Add four new hook modules (useFrontendTool, useHumanInTheLoop, useRenderToolCall, useDefaultTool) that delegate to useCopilotAction; re-export them from the central hooks index; update a JSDoc deprecation note in use-copilot-chat_internal.
Examples: swap action hook → frontend tool hook
CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx, CopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsx
Replace useCopilotAction import/usages with useFrontendTool; configuration shape and behavior unchanged.
Registry quickstarts: migrate to tool hooks
registry/registry/quickstarts/coagents-generic-lg/page.tsx, registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx, registry/registry/quickstarts/mcp-starter/page.tsx, registry/registry/quickstarts/no-agent-framework.tsx
Replace useCopilotAction with useFrontendTool or useDefaultTool as appropriate; update comments/labels to "Tool"; preserve runtime behavior.
Docs: rename Frontend Actions → Frontend Tools (guides/tutorials)
docs/content/docs/(root)/agentic-chat-ui.mdx, docs/content/docs/(root)/faq.mdx, docs/content/docs/ag2/frontend-actions.mdx → .../frontend-tools, docs/content/docs/direct-to-llm/guides/frontend-actions.mdx, docs/content/docs/direct-to-llm/guides/generative-ui.mdx, docs/content/docs/direct-to-llm/guides/quickstart.mdx, docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx, docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-copilot-actions.mdx (removed), docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx, docs/content/docs/langgraph/frontend-actions.mdx, docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx, docs/content/docs/mastra/frontend-actions.mdx
Rename terminology from “actions” → “tools” across docs, update example imports/usages to new hooks, add new tutorial step for frontend tools, and remove examples referencing the old step.
Docs: API references & new hook docs
docs/content/docs/reference/hooks/useCopilotAction.mdx, docs/content/docs/reference/hooks/useFrontendTool.mdx, docs/content/docs/reference/hooks/useHumanInTheLoop.mdx, docs/content/docs/reference/hooks/useRenderToolCall.mdx, docs/content/docs/reference/hooks/useDefaultTool.mdx
Add deprecation callout for useCopilotAction; add reference pages and migration guidance for useFrontendTool, useHumanInTheLoop, useRenderToolCall, and useDefaultTool.
Changeset
.changeset/friendly-ducks-mate.md
Add changeset noting new convenience wrapper hooks around copilot action.

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
Loading
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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • mme
  • ataibarkai

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately reflects the primary purpose of the pull request, which is to introduce new convenience wrappers around the existing useCopilotAction hook. It is concise, follows conventional commit style, and clearly conveys the main feature addition without extraneous detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/copilot-action-wrappers

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d78a4fa and 180c9e2.

📒 Files selected for processing (30)
  • CopilotKit/.changeset/friendly-ducks-mate.md (1 hunks)
  • 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/hooks/useCopilotAction.mdx (1 hunks)
  • docs/content/docs/reference/hooks/useDefaultTool.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
✅ Files skipped from review due to trivial changes (2)
  • docs/content/docs/reference/hooks/useDefaultTool.mdx
  • CopilotKit/.changeset/friendly-ducks-mate.md
🚧 Files skipped from review as they are similar to previous changes (10)
  • docs/content/docs/(root)/faq.mdx
  • CopilotKit/packages/react-core/src/hooks/use-frontend-tool.ts
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx
  • CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts
  • CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
  • docs/content/docs/(root)/agentic-chat-ui.mdx
  • CopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsx
  • docs/content/docs/direct-to-llm/guides/frontend-actions.mdx
  • docs/content/docs/reference/hooks/useRenderToolCall.mdx
  • registry/registry/quickstarts/mcp-starter/page.tsx
🧰 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/useCopilotAction.mdx
  • docs/content/docs/reference/hooks/useHumanInTheLoop.mdx
  • docs/content/docs/reference/hooks/useFrontendTool.mdx
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx
  • docs/content/docs/ag2/frontend-actions.mdx
  • docs/content/docs/langgraph/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/guides/quickstart.mdx
  • docs/content/docs/mastra/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/guides/generative-ui.mdx
  • docs/content/docs/langgraph/human-in-the-loop/node-flow.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/useCopilotAction.mdx
  • docs/content/docs/reference/hooks/useHumanInTheLoop.mdx
  • docs/content/docs/reference/hooks/useFrontendTool.mdx
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx
  • docs/content/docs/ag2/frontend-actions.mdx
  • docs/content/docs/langgraph/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/guides/quickstart.mdx
  • docs/content/docs/mastra/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/guides/generative-ui.mdx
  • docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)

Use TypeScript for better type safety

Files:

  • CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx
  • CopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
  • registry/registry/quickstarts/no-agent-framework.tsx
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}

📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)

Maintain consistent styling with Tailwind CSS

Files:

  • CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx
  • CopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts
  • registry/registry/quickstarts/no-agent-framework.tsx
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
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-copilot-chat_internal.ts
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.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-copilot-chat_internal.ts
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
registry/**/*

📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)

Browse [registry/] for reusable UI components

Files:

  • registry/registry/quickstarts/no-agent-framework.tsx
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
🧠 Learnings (5)
📚 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.tsx
  • docs/content/docs/direct-to-llm/guides/generative-ui.mdx
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • registry/registry/quickstarts/coagents-generic-lg/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.tsx
  • registry/registry/quickstarts/coagents-generic-lg/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.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.tsx
🧬 Code graph analysis (3)
registry/registry/quickstarts/no-agent-framework.tsx (1)
registry/registry/quickstarts/mcp-starter/page.tsx (1)
  • CopilotKitPage (12-26)
CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts (1)
CopilotKit/packages/react-core/src/hooks/index.ts (2)
  • useHumanInTheLoop (23-23)
  • useCopilotAction (10-10)
registry/registry/quickstarts/coagents-generic-lg/page.tsx (1)
CopilotKit/packages/react-core/src/hooks/use-default-tool.ts (1)
  • useDefaultTool (4-7)
⏰ 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 (coagents-qa-native, ui)
  • GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-routing, ui)
  • GitHub Check: Build Images (coagents-research-canvas, ui)
  • GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
  • GitHub Check: E2E Tests
  • GitHub Check: Build Images (next-openai, next-openai)
  • GitHub Check: Build Images (coagents-qa-text, ui)
  • GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
  • GitHub Check: Test (18.x)
  • GitHub Check: Test (20.x)
🔇 Additional comments (36)
docs/content/docs/reference/hooks/useCopilotAction.mdx (1)

6-14: Clear deprecation notice with migration guidance.

The deprecation warning provides actionable migration paths to the new specialized hooks and maintains backward compatibility. Well done.

CopilotKit/packages/react-core/src/hooks/use-copilot-chat_internal.ts (1)

70-70: LGTM!

The deprecation JSDoc now clearly specifies the affected scope and removal timeline, improving developer experience.

registry/registry/quickstarts/no-agent-framework.tsx (4)

3-3: LGTM!

Import correctly updated to use the new useFrontendTool hook.


56-67: LGTM!

The addProverb tool migration is consistent and preserves the existing handler behavior.


70-88: LGTM!

The generateGradientCard tool migration correctly uses the render property and maintains the existing generative UI behavior.


11-22: No issues with adding required: true
The required: true flag on themeColor matches other useFrontendTool definitions (e.g. color1, color2) and doesn’t introduce a breaking change.

docs/content/docs/mastra/frontend-actions.mdx (3)

2-2: LGTM!

Title correctly updated to reflect the new "Frontend Tools" terminology.


30-54: LGTM!

Code example correctly demonstrates useFrontendTool usage with proper import and parameter structure.


61-65: LGTM!

Heading and content now consistently use "Frontend Tools" terminology, addressing the previous review comment.

docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx (5)

20-21: LGTM!

Imports correctly include useFrontendTool from @copilotkit/react-core and z from zod for schema validation.


27-36: LGTM!

The addTask tool is well-structured with Zod schema validation. The parameter description is clear and the handler correctly invokes the addTask function.


39-48: LGTM!

The deleteTask tool follows the same pattern with proper Zod schema and handler implementation.


51-61: LGTM!

The setTaskStatus tool correctly uses Zod enum for the status parameter, providing type safety and validation. The enum construction z.enum(Object.values(TaskStatus) as [string, ...string[]]) properly handles TypeScript's enum requirements.


67-74: LGTM!

Clear explanation of the useFrontendTool hook properties, emphasizing the benefits of Zod schema validation for runtime validation and TypeScript type inference.

docs/content/docs/direct-to-llm/guides/quickstart.mdx (1)

174-177: LGTM!

Next Steps card correctly updated to reference "Frontend Tools" with the updated link and description.

CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx (2)

1-1: LGTM!

Import correctly updated to use the new useFrontendTool hook.


16-72: LGTM!

Hook call migrated from useCopilotAction to useFrontendTool while preserving the same API surface and behavior. The parameters, handler, and render function remain functionally identical.

CopilotKit/packages/react-core/src/hooks/index.ts (1)

22-25: LGTM!

The new specialized hooks are correctly exported, expanding the public API surface to support the migration from useCopilotAction. The exports follow the existing module export pattern.

docs/content/docs/reference/hooks/useHumanInTheLoop.mdx (6)

1-17: LGTM! Clear introduction to the hook.

The documentation header and introduction effectively explain the hook's purpose and key differentiator (the respond function for interactive loops).


18-67: LGTM! Well-structured example.

The confirmation example clearly demonstrates the human-in-the-loop pattern with proper status checking and response handling.


69-141: LGTM! Comprehensive form example.

The complex example effectively demonstrates form-based input collection with proper state management and submission handling.


143-193: LGTM! Comprehensive parameter documentation.

The parameter documentation thoroughly covers all properties and render props with accurate type information and descriptions.


195-206: LGTM! Helpful best practices.

The best practices section provides actionable guidance for common scenarios and potential issues.


207-256: Verify line 256 content.

The migration guide is clear and helpful. However, line 256 appears to contain only the number "256" without any content. This might be a formatting artifact or an incomplete line.

Please verify that this line is intentional or if it should be removed.

registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx (1)

3-3: LGTM! Clean migration to useFrontendTool.

The import and hook usage have been correctly updated from useCopilotAction to useFrontendTool. The API surface remains unchanged, making this a straightforward terminology update.

Also applies to: 44-58

registry/registry/quickstarts/coagents-generic-lg/page.tsx (1)

3-3: LGTM! Correct migration to useDefaultTool.

The migration properly uses the useDefaultTool wrapper, which internally sets name: "*" for catch-all tool rendering. Removing the explicit name parameter from the hook call is correct.

Also applies to: 45-51

CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts (1)

1-22: LGTM! Clean wrapper implementation.

The useHumanInTheLoop hook is implemented correctly as a thin wrapper around useCopilotAction. Key design decisions are sound:

  • Setting available: "remote" ensures the tool is only callable by remote agents
  • Mapping render to renderAndWaitForResponse maintains compatibility with the underlying hook
  • Type safety is preserved through generic parameters
docs/content/docs/langgraph/frontend-actions.mdx (2)

1-53: LGTM! Consistent terminology migration.

The documentation header and frontend tool creation section have been properly updated with the new terminology and hook names.


64-92: LGTM! State inheritance documented correctly.

The section properly explains how to inherit from CopilotKitState to access frontend tools, with updated terminology throughout.

docs/content/docs/reference/hooks/useFrontendTool.mdx (5)

1-48: LGTM! Clear introduction and example.

The documentation provides a clear explanation of the useFrontendTool hook with a straightforward usage example demonstrating Zod schemas.


50-83: LGTM! Comprehensive rendering example.

The custom UI rendering example effectively demonstrates status-based rendering and shows how to display different UI states.


85-87: LGTM! Helpful cross-reference.

The link to the Generative UI guide provides appropriate additional context.


89-148: LGTM! Thorough parameter documentation.

The parameters section comprehensively documents all hook properties with accurate types and descriptions.


150-187: LGTM! Clear migration guidance.

The migration guide effectively explains the differences between useCopilotAction and useFrontendTool with a practical before/after example.

docs/content/docs/ag2/frontend-actions.mdx (2)

1-54: LGTM! Consistent migration for AG2.

The documentation has been properly updated with the new "Frontend Tools" terminology and hook names, consistent with other framework guides.


60-96: LGTM! AG2-specific documentation with placeholders.

The state inheritance and access sections have been updated with the new terminology. The placeholder code blocks (# your code goes here...) are appropriate for AG2-specific implementations that may differ from the LangGraph patterns.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e4fbac and f2367fa.

📒 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.mdx
  • docs/content/docs/reference/classes/CopilotTask.mdx
  • docs/content/docs/reference/hooks/useHumanInTheLoop.mdx
  • docs/content/docs/reference/hooks/useCopilotAction.mdx
  • docs/content/docs/direct-to-llm/guides/quickstart.mdx
  • docs/content/docs/reference/hooks/useRenderToolCall.mdx
  • docs/content/docs/(root)/agentic-chat-ui.mdx
  • docs/content/docs/direct-to-llm/guides/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx
  • docs/content/docs/langgraph/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/guides/generative-ui.mdx
  • docs/content/docs/mastra/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx
  • docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx
  • docs/content/docs/(root)/faq.mdx
  • docs/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.mdx
  • docs/content/docs/reference/classes/CopilotTask.mdx
  • docs/content/docs/reference/hooks/useHumanInTheLoop.mdx
  • docs/content/docs/reference/hooks/useCopilotAction.mdx
  • docs/content/docs/direct-to-llm/guides/quickstart.mdx
  • docs/content/docs/reference/hooks/useRenderToolCall.mdx
  • docs/content/docs/(root)/agentic-chat-ui.mdx
  • docs/content/docs/direct-to-llm/guides/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/step-4-frontend-tools.mdx
  • docs/content/docs/langgraph/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/guides/generative-ui.mdx
  • docs/content/docs/mastra/frontend-actions.mdx
  • docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx
  • docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx
  • docs/content/docs/(root)/faq.mdx
  • docs/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.ts
  • CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • CopilotKit/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.ts
  • CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
  • registry/registry/quickstarts/no-agent-framework.tsx
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • CopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsx
  • CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • registry/registry/quickstarts/mcp-starter/page.tsx
  • CopilotKit/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.ts
  • CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
  • registry/registry/quickstarts/no-agent-framework.tsx
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • CopilotKit/examples/next-openai/src/app/presentation/actions/useUpdateSlide.tsx
  • CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • registry/registry/quickstarts/mcp-starter/page.tsx
  • CopilotKit/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.ts
  • CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts
  • CopilotKit/packages/react-core/src/hooks/index.ts
  • CopilotKit/packages/react-core/src/hooks/use-default-tool.ts
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • CopilotKit/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.tsx
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
  • registry/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.tsx
  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • docs/content/docs/direct-to-llm/guides/generative-ui.mdx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
  • 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/coagents-starter-crewai-flows/page.tsx
  • registry/registry/quickstarts/coagents-generic-lg/page.tsx
  • 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 useEffect dependencies and ensure they're properly memoized to avoid infinite re-renders

Applied to files:

  • registry/registry/quickstarts/coagents-starter-crewai-flows/page.tsx
  • 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-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.tsx
  • 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-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 useFrontendTool instead of useCopilotAction is 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 underlying useCopilotAction implementation. 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 useCopilotAction while explicitly setting available: "frontend". The Pick type appropriately excludes handler and followUp, 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 render from the tool config and maps it to renderAndWaitForResponse
  • Sets available: "remote" to indicate this tool is for remote agents
  • Forwards remaining properties to useCopilotAction

This 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 useCopilotAction to the new useFrontendTool hook.

docs/content/docs/direct-to-llm/tutorials/ai-todo-app/overview.mdx (1)

25-25: Documentation update aligns with terminology shift.

The update from useCopilotAction to useFrontendTool in 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 useCopilotAction with useFrontendTool is 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 useCopilotAction to useDefaultTool aligns with the migration to tool-centric APIs in this PR.


45-52: LGTM!

The hook migration from useCopilotAction to useDefaultTool maintains 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 useCopilotAction to useFrontendTool aligns with the migration to tool-centric APIs.


16-72: LGTM!

The hook migration from useCopilotAction to useFrontendTool maintains 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 useFrontendTool is 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 useCopilotAction to useFrontendTool aligns with the migration to tool-centric APIs.


10-22: LGTM! Description added.

The setThemeColor hook migration to useFrontendTool is clean. The addition of a description ("Set the theme color of the interface") improves clarity for the LLM.


55-67: LGTM! Description added.

The addProverb hook migration to useFrontendTool is consistent. The addition of a description ("Add a proverb to the list") provides better context for the LLM.


70-88: LGTM!

The generateGradientCard hook migration to useFrontendTool maintains 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 (useFrontendTool and 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
The useCopilotChatHeadless_c hook is exported by @copilotkit/react-core and provides sendMessage, 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 useCopilotAction to useDefaultTool is appropriate for catch-all tool rendering. The configuration shape and render props are preserved, ensuring a smooth transition.


5-5: No change required: CatchAllActionRenderProps is the defined type in @copilotkit/react-core and no CatchAllToolRenderProps exists—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 useCopilotAction with side-by-side comparison

The migration guide (lines 207-250) is particularly helpful, clearly showing the differences in API (Zod schemas, render vs renderAndWaitForResponse, checking for respond function).

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 useCopilotAction

The 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 useCopilotAction to useFrontendTool is 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 useCopilotAction with renderAndWaitForResponse to useHumanInTheLoop with render is 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, and useRenderToolCall based 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-tools paths
  • Code examples properly migrated

All changes align with the broader API refactor across the codebase.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 render with CatchAllActionRenderProps, which no longer exists. Switch the annotation to CatchAllToolRenderProps so 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

📥 Commits

Reviewing files that changed from the base of the PR and between f2367fa and 3a59d8b.

📒 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.mdx
  • docs/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.mdx
  • docs/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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
CatchAllActionRenderProps is defined in react-core/src/types/frontend-action.ts and used across quickstarts and context. Renaming it to CatchAllToolRenderProps (or adding a type 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3a59d8b and 7e61a09.

📒 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.ts
  • registry/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.ts
  • registry/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 useCopilotAction to useDefaultTool aligns 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 name with '*' for catch-all behavior
  • Uses satisfies for type checking to ensure correctness
  • Passes through optional dependencies to useCopilotAction

This 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 useCopilotAction for existing users

The structure follows good documentation practices with examples before reference material.

@ranst91
ranst91 force-pushed the feat/copilot-action-wrappers branch from d78a4fa to 180c9e2 Compare October 3, 2025 08:26
@changesets-bot-copilotkit

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 180c9e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@copilotkit/react-core Patch
@copilotkit/react-textarea Patch
@copilotkit/react-ui Patch
@copilotkit/runtime-client-gql Patch
@copilotkit/runtime Patch
@copilotkit/sdk-js Patch
@copilotkit/shared Patch

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Oct 3, 2025 •

Copy link
Copy Markdown
Contributor

Preview environments destroyed for this pull request.

@github-actions

github-actions Bot commented Oct 3, 2025 •

Copy link
Copy Markdown
Contributor

Test Results

Status: ✅ Passed (View Run)

Commit: fcc0bce

Duration: 305.5s

Total Tests: 37

Pass Rate: 100.0%

Failed Tests: 0

🔍 Detailed Results

coagents-research-canvas

CoAgents Research Canvas (UI) - Local Depenencies

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
CrewAI chromium ✅ PASSED -

coagents-qa-native

CoAgents QA Native (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -

coagents-qa-text

CoAgents QA Text (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
OpenAI (LGC Python) chromium ✅ PASSED -
Anthropic (LGC Python) chromium ✅ PASSED -
OpenAI (LGC JS) chromium ✅ PASSED -
Anthropic (LGC JS) chromium ✅ PASSED -

coagents-routing

CoAgents Routing (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -

next-openai

Next OpenAI - Self Hosted

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
LangChain (OpenAI) chromium ✅ PASSED -
Groq chromium ✅ PASSED -

@ranst91
ranst91 merged commit c9e499f into main Oct 3, 2025
@ranst91
ranst91 deleted the feat/copilot-action-wrappers branch October 3, 2025 12:40
@coderabbitai coderabbitai Bot mentioned this pull request Oct 20, 2025
tylerslaton pushed a commit to tylerslaton/CopilotKit that referenced this pull request Nov 5, 2025
tylerslaton pushed a commit that referenced this pull request Feb 18, 2026

This branch was successfully deployed

3 active deployments
Preview – docs — 180c9e22 Deployed Oct 3, 2025 by vercel[bot]
Preview – examples-coagents-research-canvas-ui — 180c9e22 Deployed Oct 3, 2025 by vercel[bot]
Preview – examples-coagents-ai-travel-app — 180c9e22 Deployed Oct 3, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants