Skip to content

Modernize copilot action - #2257

Closed
mme wants to merge 32 commits into
mainfrom
mme/modernize-copilot-action
Closed

mme wants to merge 32 commits into
mainfrom
mme/modernize-copilot-action

Conversation

@mme

@mme mme commented Jul 31, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Introduces:

  • useHumanInTheLoop
  • useFrontendAction
  • useRenderedActions
  • zod zupport

Checklist

  • I have read the Contribution Guide
  • If the PR changes or adds functionality, I have updated the relevant documentation

Summary by CodeRabbit

  • New Features

    • Added three frontend hooks for tools, human-in-the-loop flows, and render-only tool calls.
  • Deprecations

    • Legacy action hook marked deprecated; migration to the new hooks recommended.
  • Documentation

    • “Actions” renamed to “Tools” across docs; new reference pages and migration guides added.
  • Examples

    • Updated examples to use new hooks and schema-based parameter definitions.
  • Chores

    • Upgraded Zod to v4 and removed zod-to-json-schema.

@vercel

vercel Bot commented Jul 31, 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 Sep 30, 2025 3:58pm
examples-coagents-ai-travel-app Ready Ready Preview Comment Sep 30, 2025 3:58pm
examples-coagents-research-canvas-ui Ready Ready Preview Comment Sep 30, 2025 3:58pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
examples-coagents-ai-researcher-ui Ignored Ignored Sep 30, 2025 3:58pm

@coderabbitai

coderabbitai Bot commented Jul 31, 2025 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@ranst91 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d262def and cb979e4.

📒 Files selected for processing (1)
  • CopilotKit/packages/runtime/src/service-adapters/langchain/utils.ts (1 hunks)

Walkthrough

Adds three new React hooks (useFrontendTool, useHumanInTheLoop, useRenderToolCall) that accept Zod parameter schemas and emit JSON Schema; migrates many examples/docs from "actions" → "tools"/HITL/render flows; renames renderAndWaitForResponse → render/respond; standardizes Zod v4 usage and core jsonSchema handling.

Changes

Cohort / File(s) Summary of Changes
React core: new hooks & exports
CopilotKit/packages/react-core/src/hooks/use-frontend-tool.ts, .../use-human-in-the-loop.ts, .../use-render-tool-call.ts, CopilotKit/packages/react-core/src/hooks/index.ts, CopilotKit/packages/react-core/package.json, CopilotKit/packages/react-core/examples/use-frontend-tool-example.tsx
Added hooks useFrontendTool / useHumanInTheLoop / useRenderToolCall and related types; re-exported from hooks index; example demonstrating useFrontendTool; added zod / zod-to-json-schema adjustments in package metadata.
Core action types & useCopilotAction adaptation
CopilotKit/packages/react-core/src/types/frontend-action.ts, CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts, CopilotKit/packages/react-core/src/lib/copilot-task.ts
FrontendAction gains optional jsonSchema?: string; processActionsForRuntimeRequest prefers action.jsonSchema; useCopilotAction synthesizes jsonSchema from legacy parameters when needed; doc comments updated.
Zod/json-schema tooling & packages
CopilotKit/packages/shared/package.json, .../src/utils/json-schema.test.ts, CopilotKit/packages/sdk-js/package.json, CopilotKit/packages/runtime/package.json, docs/package.json, registry/package.json
Moved/updated zod usage to v4 across packages, removed or replaced zod-to-json-schema usages, updated tests to use z.toJSONSchema(...), adjusted peer/devDependencies.
Examples — frontend tools (handlerful)
Many examples/** and CopilotKit/examples/next-openai/src/app/presentation/actions/useAppendSlide.tsx, .../useUpdateSlide.tsx
Replaced useCopilotAction → useFrontendTool for tools with handlers; parameters arrays converted to z.object(...) schemas; imports updated; handlers preserved.
Examples — human-in-the-loop (HITL)
Multiple examples/** (Mailer, ResearchCanvas, state-machine stages, demo pages, coagents-travel hooks/components)
Replaced useCopilotAction → useHumanInTheLoop; parameters → Zod schemas; renderAndWaitForResponse → render and render props now provide respond; components adjusted to call respond.
Examples — render-only flows
Components like KnowledgeBase, Dashboard, shared_state pages, copilot-chat examples
Replaced useCopilotAction → useRenderToolCall for render-only tools; parameters converted to Zod schemas; imports and render props adapted.
HITL components: handler → respond prop rename
examples/coagents-travel/ui/components/humanInTheLoop/*.tsx, related components
Renamed component prop handler → respond and updated call sites; minor formatting/refactors.
Docs: actions → tools, new hook docs & deprecation
docs/content/docs/** (guides, tutorials, reference, mdx files)
Terminology migrated from “Frontend Actions” → “Frontend Tools”; added docs for useFrontendTool/useHumanInTheLoop/useRenderToolCall; added deprecation notice for useCopilotAction; examples rewritten to Zod schemas.
Examples & templates: zod additions/bumps
Many **/package.json in examples and demos
Added or bumped zod to ^4.1.11 across numerous example/demo packages.
Prompts / READMEs / snippets / changeset
examples/demo-viewer/src/lib/prompts.ts, many README/MDX, CopilotKit/.changeset/eleven-radios-move.md
Updated text/snippets to reference new hooks and “tools”; added changeset summarizing hook additions and migration.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as React Component
  participant Hook as useFrontendTool
  participant Core as useCopilotAction
  participant Runtime as Runtime

  User->>UI: trigger tool via chat/UI
  UI->>Hook: register tool {name, parameters: z.object(...), handler?, render?, followUp?}
  Hook->>Hook: convert Zod -> jsonSchema (if provided)
  Hook->>Core: register FrontendAction {jsonSchema, renderWrapper, handler, followUp}
  Core->>Runtime: include action.jsonSchema in runtime request
  Runtime-->>Core: runtime response
  Core-->>UI: lifecycle events (inProgress / executing / complete)
  UI-->>User: update UI / show result
Loading
sequenceDiagram
  autonumber
  actor User
  participant UI as React Component
  participant HITL as useHumanInTheLoop
  participant Core as useCopilotAction

  UI->>HITL: register HITL tool {name, parameters: z.object(...), render}
  HITL->>Core: register action {jsonSchema, renderWrapper (provides respond)}
  Core-->>UI: invoke render({ status, args, respond })
  UI->>User: display interactive UI
  User->>UI: submit/cancel
  UI->>Core: respond(value)
  Core-->>UI: status complete + result
Loading
sequenceDiagram
  autonumber
  participant UI as React Component
  participant RTC as useRenderToolCall
  participant Core as useCopilotAction

  UI->>RTC: register render-only tool {name|"*", parameters?: z.object(...), render}
  RTC->>Core: register render-only action {jsonSchema, renderAdapter}
  Core-->>UI: invoke render with {status, args, result}
  UI->>User: display execution/results
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Suggested reviewers

  • mme
  • suhasdeshpande
  • ataibarkai
  • tylerslaton

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title Check ❓ Inconclusive The title “Modernize copilot action” is short and references the overall theme of the changeset, but it is too vague to clearly communicate the core migration from useCopilotAction to the new hooks (useFrontendTool, useHumanInTheLoop, useRenderToolCall) and Zod integration. Consider revising the title to explicitly mention the migration to new frontend and human-in-the-loop hooks and Zod schema support (for example, “Migrate useCopilotAction to new hooks with Zod schema validation”).
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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: 6

🔭 Outside diff range comments (1)
examples/copilot-chat-with-your-data/components/Dashboard.tsx (1)

54-64: Remove unsupported available override from useRenderToolCall

The useRenderToolCall hook’s API doesn’t accept an available property—internally it always sets available: "frontend". Any available: "disabled" you pass in will be ignored. To disable or hide a tool, guard the hook call instead of passing available.

Locations to update:
• examples/copilot-chat-with-your-data/components/Dashboard.tsx: lines 54–64

Updated snippet:

  useRenderToolCall({
    name: "searchInternet",
-   available: "disabled",
    description: "Searches the internet for information.",
    parameters: z.object({
      query: z.string().describe("The query to search the internet for.")
    }),
    render: ({ args, status }) => (
      <SearchResults query={args.query || 'No query provided'} status={status} />
    )
  });

If you need to disable it conditionally, wrap the hook call:

if (isSearchEnabled) {
  useRenderToolCall({ /* … */ });
}
♻️ Duplicate comments (3)
docs/content/docs/reference/components/chat/CopilotSidebar.mdx (1)

223-226: Duplicate of the comment on CopilotChat.mdx – the same clarification applies here.

docs/content/docs/reference/components/chat/CopilotPopup.mdx (1)

219-222: Duplicate of the comment on CopilotChat.mdx – the same clarification applies here.

examples/coagents-wait-user-input/ui/package.json (1)

30-31: Mirror the Tailwind + Zod commentary from the sibling UI package

Same observations apply here: wire up tailwindcss-animate in the Tailwind config and align Zod major versions workspace-wide.

🧹 Nitpick comments (20)
docs/content/docs/reference/components/chat/CopilotChat.mdx (1)

215-218: Clarify timestamp units & retry semantics in the prop description

The new renderError signature looks good, but docs should specify whether timestamp is Unix epoch (ms / s) or an ISO string, and whether onRetry will be invoked with the same params or trigger an internal refetch. That extra line prevents downstream consumers from guessing and writing brittle code.

docs/content/docs/reference/classes/llm-adapters/AnthropicAdapter.mdx (1)

47-50: Tweak link formatting for better MDX rendering
Inside the <PropertyReference> description, raw URLs sometimes render without link styling. Wrapping the URL in markdown link syntax keeps styling consistent with the rest of the docs.

-  See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
+  See: [Anthropic prompt caching docs](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
examples/ag2/feature-viewer/package.json (1)

12-54: Maintain alphabetical ordering for dependency list

Adding "zod" after "uuid" breaks the otherwise-alphabetical block, making future diffs noisier.

-    "tailwindcss-animate": "^1.0.7",
-    "uuid": "^11.1.0",
-    "zod": "^4.0.14"
+    "tailwindcss-animate": "^1.0.7",
+    "zod": "^4.0.14",
+    "uuid": "^11.1.0"
examples/ag2/starter/package.json (1)

20-20: Consistent dependency versions across examples

Other examples reference @copilotkit/react-core 1.8.13 + Zod 4.x; this example now matches Zod but keep an eye on CI: Next 15 + React 19 + Zod 4 may have conflicting peer ranges. Pinning everything via a pnpm workspace overrides block can prevent subtle mismatches.

examples/coagents-starter-crewai-crews/ui/package.json (1)

29-31: Ensure PostCSS/Tailwind plugin chain includes tailwindcss-animate

Adding tailwindcss-animate as a dependency is not enough; the plugin must be referenced in tailwind.config.{js,ts} under plugins. Confirm the config was updated in this PR; otherwise, the new dependency is unused bloat.

examples/coagents-enterprise-crewai-crews/ui/package.json (1)

28-29: Runtime vs build-time deps

tailwindcss-animate is a PostCSS plugin – it’s only required at build time, not in production runtime. Move it (and possibly zod if only used in hooks compiled away on the server) to devDependencies to keep the client bundle slim.

examples/demo-viewer/package.json (1)

46-47: Confirm Tailwind plugin is configured

Adding tailwindcss-animate without registering it in tailwind.config.js has no effect. Double-check the config’s plugins array contains:

plugins: [require("tailwindcss-animate")]

Otherwise the dependency can be dropped.

CopilotKit/examples/next-openai/package.json (1)

38-39: Check bundle impact of new UI helpers

use-stick-to-bottom pulls in an IntersectionObserver polyfill for older browsers. If the example targets only modern evergreen browsers this may be unnecessary overhead. Consider lazy-importing the hook or implementing the scroll-lock logic inline.

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

25-26: Check for remaining “action” references in this tutorial
Nice catch switching the bullet to useFrontendTool. Make sure any code blocks or subsequent text snippets in this tutorial (and its sibling pages) no longer reference useCopilotAction, otherwise readers will hit outdated API names.

docs/content/docs/reference/classes/CopilotTask.mdx (1)

13-14: Mixed terminology may confuse readers

Opening paragraph now says “tools provided by useFrontendTool”, but further down the doc still talks about actions, FrontendAction[], and includeCopilotActions. If the public API truly migrated to “tools”, the property names and examples should follow suit; otherwise keep the intro consistent with the rest.

Recommend a quick sweep to ensure a single, unified term is used throughout the page.

examples/coagents-qa/ui/package.json (1)

30-33: Tiny nit: keep dependency keys alphabetised.

Placing "zod" after "tailwindcss-animate" disrupts the existing alphabetical order and makes future diffs noisier.

-    "tailwindcss-animate": "^1.0.7",
-    "zod": "^4.0.14"
+    "tailwindcss-animate": "^1.0.7",
+    "zod": "^4.0.14"
CopilotKit/packages/react-core/src/lib/copilot-task.ts (1)

1-3: Docstring now says “tools”, but the API still exposes actions.

The rename in the first sentence is helpful, yet every public field (actions, includeCopilotActions, FrontendAction etc.) still uses the old term. This partial update risks confusing users skimming the docs.

Update either:

  1. the wording here back to “actions”, or
  2. the public API names in a follow-up PR to “tools” for consistency.
examples/coagents-travel/ui/lib/hooks/README.md (1)

39-48: Minor wording polish & numbering style.

“Completely new” can be shortened to “new”; also Markdown automatic numbering works best when every item starts with 1..

-This hook is used to add front-end functions as tool calls to an agent or LLM. If you're completely new to the concept of human in the loop, checkout LangGraph's ...
+This hook is used to add front-end functions as tool calls to an agent or LLM. If you're new to the concept of human in the loop, checkout LangGraph's ...
@@
-1. Setting a "breakpoint" in the agent code via the `interrupt_after` option when compiling an agent.
-2. Emitting tool calls via the Copilotkit SDK.
-3. Sending approval/rejection response back to the agent via our `useHumanInTheLoop` hook.
+1. Setting a "breakpoint" in the agent code via the `interrupt_after` option when compiling an agent.  
+1. Emitting tool calls via the Copilotkit SDK.  
+1. Sending approval / rejection back to the agent via `useHumanInTheLoop`.
examples/copilot-state-machine/README.md (1)

122-135: Add the missing hook import in the snippet

The example now uses useFrontendTool but doesn’t import it, which may confuse readers.

 import { z } from "zod";
+import { useFrontendTool } from "@copilotkit/react-core";
 
 useFrontendTool({
CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts (1)

168-172: Remove debug console.log before production

The automatic JSON schema generation logic provides good backward compatibility, but the console.log on line 171 should be removed as it's debug code that shouldn't remain in production.

  // Convert parameters to JSON Schema if not already provided
  if (isFrontendAction(action) && !action.jsonSchema && action.parameters) {
    action.jsonSchema = JSON.stringify(actionParametersToJsonSchema(action.parameters));
-    console.log("action.jsonSchema", action.jsonSchema);
  }
CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts (1)

42-54: Consider performance optimization for render adapter

The render adapter creates a new React element on every render, which could impact performance. Consider memoizing the adapter function or using useCallback.

  // Convert render function to match FrontendAction expectations
- const render = tool.render
-   ? (props: any) => {
+ const render = tool.render
+   ? useMemo(() => (props: any) => {
        // Map the props to match the component's expected format
        const componentProps = {
          name: tool.name,
          description: tool.description || "",
          args: props.args,
          status: props.status,
          result: props.result,
        };
        return React.createElement(tool.render!, componentProps);
-     }
+     }, [tool.render, tool.name, tool.description])
    : undefined;
docs/content/docs/reference/hooks/useFrontendTool.mdx (1)

7-7: Update the GIF to reflect the new hook.

The image URL references "useCopilotAction" but this documentation is for useFrontendTool. This may show outdated content and confuse users about the new API.

Update the image URL to reflect the new useFrontendTool hook:

-<img src="https://cdn.copilotkit.ai/docs/copilotkit/images/use-copilot-action/useCopilotAction.gif" width="500" />
+<img src="https://cdn.copilotkit.ai/docs/copilotkit/images/use-frontend-tool/useFrontendTool.gif" width="500" />
CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts (2)

1-2: Remove unused imports.

Several imports are not used in this file: useFrontendTool, ReactFrontendTool, useState, useCallback, and useRef.

-import { useFrontendTool, ReactFrontendTool } from "./use-frontend-tool";
-import { useState, useCallback, useRef } from "react";
 import React from "react";
 import { z } from "zod";
 import { useCopilotAction } from "./use-copilot-action";

58-58: Improve null safety.

Using a non-null assertion (tool.render!) could cause runtime errors if the render function is undefined, even though it's checked above.

-        return React.createElement(tool.render!, componentProps);
+        return React.createElement(tool.render, componentProps);
CopilotKit/packages/react-core/examples/use-frontend-tool-example.tsx (1)

148-168: Dependencies example could be improved for clarity.

While the example demonstrates the dependency pattern correctly, the naming could be more descriptive to better illustrate the concept.

Consider renaming the tool to better reflect its dependency on the React state:

-      name: "getUserCount",
-      description: "Get the current user count",
+      name: "getCurrentUserCount", 
+      description: "Get the current user count (updates when local state changes)",

This makes it clearer that the tool re-registers when the dependency changes.

Comment on lines +25 to +89
// Example 2: Tool with render function
function RenderExample() {
const UserCreationStatus: React.ComponentType<{
name: string;
description: string;
args: { name?: string; email?: string };
status: "inProgress" | "executing" | "complete";
result?: any;
}> = ({ args, status, result }) => {
if (status === "inProgress") {
return <div>Preparing to create user {args.name || "..."}...</div>;
}
if (status === "executing") {
return (
<div>
Creating user {args.name} with email {args.email}...
</div>
);
}
if (status === "complete") {
return (
<div>
User {result.name} created successfully with ID: {result.id}
</div>
);
}
return null;
};

useFrontendTool({
name: "createUserWithUI",
description: "Create a user with visual feedback",
parameters: z.object({
name: z.string(),
email: z.string().email(),
}),
handler: async ({ name, email }) => {
// Simulate API call
await new Promise((resolve) => setTimeout(resolve, 1000));
return { id: Math.random(), name, email };
},
render: ({ args, status, result }) => {
if (status === "inProgress") {
return <div>Preparing to create user {args.name || "..."}...</div>;
}
if (status === "executing") {
return (
<div>
Creating user {args.name} with email {args.email}...
</div>
);
}
if (status === "complete") {
return (
<div>
User {result} created successfully with ID: {result}
</div>
);
}
return null;
},
});

return <div>Render Example</div>;
}

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.

⚠️ Potential issue

Inconsistency in render function implementation.

The example shows two different implementations of the render function - one as a separate component (lines 27-52) and another inline (lines 66-85). However, there's an inconsistency in how the result is displayed.

In the inline render function (lines 80-81), the result is displayed incorrectly:

-            User {result} created successfully with ID: {result}
+            User {result.name} created successfully with ID: {result.id}

The result should be accessed as an object with name and id properties, consistent with the separate component implementation and the handler's return value.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Example 2: Tool with render function
function RenderExample() {
const UserCreationStatus: React.ComponentType<{
name: string;
description: string;
args: { name?: string; email?: string };
status: "inProgress" | "executing" | "complete";
result?: any;
}> = ({ args, status, result }) => {
if (status === "inProgress") {
return <div>Preparing to create user {args.name || "..."}...</div>;
}
if (status === "executing") {
return (
<div>
Creating user {args.name} with email {args.email}...
</div>
);
}
if (status === "complete") {
return (
<div>
User {result.name} created successfully with ID: {result.id}
</div>
);
}
return null;
};
useFrontendTool({
name: "createUserWithUI",
description: "Create a user with visual feedback",
parameters: z.object({
name: z.string(),
email: z.string().email(),
}),
handler: async ({ name, email }) => {
// Simulate API call
await new Promise((resolve) => setTimeout(resolve, 1000));
return { id: Math.random(), name, email };
},
render: ({ args, status, result }) => {
if (status === "inProgress") {
return <div>Preparing to create user {args.name || "..."}...</div>;
}
if (status === "executing") {
return (
<div>
Creating user {args.name} with email {args.email}...
</div>
);
}
if (status === "complete") {
return (
<div>
User {result} created successfully with ID: {result}
</div>
);
}
return null;
},
});
return <div>Render Example</div>;
}
render: ({ args, status, result }) => {
if (status === "inProgress") {
return <div>Preparing to create user {args.name || "..."}...</div>;
}
if (status === "executing") {
return (
<div>
Creating user {args.name} with email {args.email}...
</div>
);
}
if (status === "complete") {
return (
<div>
User {result.name} created successfully with ID: {result.id}
</div>
);
}
return null;
},
🤖 Prompt for AI Agents
In CopilotKit/packages/react-core/examples/use-frontend-tool-example.tsx between
lines 66 and 85, the inline render function incorrectly displays the result by
outputting the entire result object directly instead of accessing its
properties. To fix this, update the render function to access and display the
result's name and id properties, matching the separate UserCreationStatus
component and the handler's return structure.

// Parameters will be undefined since we're using jsonSchema
parameters: undefined,
available: "frontend",
} as any,

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.

🛠️ Refactor suggestion

Avoid unsafe type casting

The as any cast bypasses TypeScript's type checking, which could hide potential type mismatches.

Consider defining a proper interface for the action object or using more specific typing:

  useCopilotAction(
    {
      name: tool.name,
      description: tool.description,
      jsonSchema,
      render,
      // Parameters will be undefined since we're using jsonSchema
      parameters: undefined,
      available: "frontend",
-   } as any,
+   },
    dependencies,
  );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} as any,
useCopilotAction(
{
name: tool.name,
description: tool.description,
jsonSchema,
render,
// Parameters will be undefined since we're using jsonSchema
parameters: undefined,
available: "frontend",
},
dependencies,
);
🤖 Prompt for AI Agents
In CopilotKit/packages/react-core/src/hooks/use-render-tool-call.ts at line 65,
the use of 'as any' disables TypeScript's type checking and may hide type
errors. To fix this, define a proper interface or type for the action object
that accurately represents its structure and replace 'as any' with this specific
type to ensure type safety and clarity.

"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.24.2"
"zod": "^4.0.14"

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.

⚠️ Potential issue

@hookform/resolvers may not yet support Zod 4 – build will likely break

@hookform/[email protected] currently expects Zod 3 types. Upgrading Zod without bumping the resolver to a version that explicitly declares Zod 4 support will yield type errors and, at runtime, invalid schema handling.

Proposed quick fix:

-    "@hookform/resolvers": "^4.1.2",
+    "@hookform/resolvers": "^5.0.0"  // or the first version whose changelog mentions Zod 4 support

Verify with pnpm i --workspace-root --lockfile-only and run type-checks.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In examples/copilot-form-filling/package.json at line 30, the project uses Zod
version 4, but @hookform/[email protected] only supports Zod version 3, causing
type errors and runtime issues. To fix this, downgrade the Zod dependency to a
compatible version 3 release that matches the resolver's expectations. After
updating the version, run `pnpm i --workspace-root --lockfile-only` and perform
type-checks to ensure compatibility.

Comment on lines +147 to 154
render: ({ args }) => {
useEffect(() => {
console.log(args, "args.recipe")
updateRecipe(args?.recipe || {})
}, [args.recipe])
return <></>
}
console.log(args, "args.recipe");
updateRecipe(args?.recipe || {});
}, [args.recipe]);
return <></>;
},
})

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.

⚠️ Potential issue

Critical: useEffect called inside render function violates React hooks rules.

The useEffect hook is being called inside the render function, which violates React's rules of hooks. Hooks must be called at the top level of React components, not inside nested functions.

Consider restructuring to move the effect logic outside the render function:

-render: ({ args }) => {
-  useEffect(() => {
-    console.log(args, "args.recipe");
-    updateRecipe(args?.recipe || {});
-  }, [args.recipe]);
-  return <></>;
-},
+render: ({ args }) => {
+  // Move effect logic to parent component or use a different approach
+  console.log(args, "args.recipe");
+  if (args?.recipe) {
+    updateRecipe(args.recipe);
+  }
+  return <></>;
+},

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Biome (2.1.2)

[error] 148-148: This hook is being called from a nested function, but all hooks must be called unconditionally from the top-level component.

For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level

(lint/correctness/useHookAtTopLevel)

🤖 Prompt for AI Agents
In examples/demo-viewer/agent/demo/standard_shared_state/page.tsx around lines
147 to 154, the useEffect hook is incorrectly called inside the render function,
violating React hooks rules. To fix this, refactor the code by moving the
useEffect hook to the top level of a React component instead of inside the
render function, ensuring hooks are called unconditionally and not within nested
functions or callbacks.

@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: 2

🧹 Nitpick comments (2)
find-package-json.sh (2)

37-49: Check that requested package managers exist before invoking them

Running pnpm install or yarn install without guaranteeing the binary is on $PATH causes the script to abort mid-loop. Add a quick availability check:

-    echo "  Using pnpm install..."
-    pnpm install
+    echo "  Using pnpm install..."
+    command -v pnpm >/dev/null 2>&1 || {
+      echo "  ❌ pnpm not found on PATH"; cd - >/dev/null || exit 1; continue;
+    }
+    pnpm install

Repeat for npm and yarn. Failing fast keeps the remainder of the installation run intact.


52-52: Handle potential failure of cd -

ShellCheck SC2164: add || exit (or || return for sourcing) to propagate errors when restoring the previous directory fails.

-  cd - > /dev/null
+  cd - > /dev/null || exit
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70e2690 and 7bf867d.

⛔ Files ignored due to path filters (27)
  • examples/ag2/feature-viewer/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/ag2/starter/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-enterprise-crewai-crews/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa-native/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa-native/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa-text/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-research-canvas/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-research-canvas/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-routing/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter-crewai-crews/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter-crewai-flows/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-wait-user-input/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-anthropic-pinecone/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-chat-with-your-data/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-form-filling/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-fully-custom/package-lock.json is excluded by !**/package-lock.json
  • examples/copilot-openaI-mongodb-atlas-vector-search/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-state-machine/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/demo-viewer/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/langgraph-tutorial-customer-support/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/langgraph-tutorial-quickstart/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/llamaindex/starter/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/mastra/feature-viewer/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/mastra/starter/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/saas-dynamic-dashboards/frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • find-package-json.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
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/package.json : Review [CopilotKit/package.json] for workspace setup
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
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
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
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/package.json : Use [CopilotKit/package.json] for workspace setup
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/frontend-development.mdc:0-0
Timestamp: 2025-07-18T15:03:52.262Z
Learning: Use the provided hooks and utilities
📚 Learning: applies to examples/*/package.json : each example project should include a 'package.json' file listi...
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/examples-and-demos.mdc:0-0
Timestamp: 2025-07-18T15:03:26.651Z
Learning: Applies to examples/*/package.json : Each example project should include a 'package.json' file listing dependencies.

Applied to files:

  • find-package-json.sh
📚 Learning: applies to copilotkit/package.json : review [copilotkit/package.json] for workspace setup...
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/package.json : Review [CopilotKit/package.json] for workspace setup

Applied to files:

  • find-package-json.sh
📚 Learning: applies to examples/*/{agent,agent-py,ui,readme.md,package.json} : most examples should have the fol...
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/examples-and-demos.mdc:0-0
Timestamp: 2025-07-18T15:03:26.651Z
Learning: Applies to examples/*/{agent,agent-py,ui,README.md,package.json} : Most examples should have the following structure: an 'agent/' (or 'agent-py/') directory for backend agent implementation, a 'ui/' directory for the frontend Next.js application, a 'README.md' file for setup instructions, and a 'package.json' file for dependencies.

Applied to files:

  • find-package-json.sh
📚 Learning: applies to **/agent-js/package.json : install '@copilotkit/sdk-js' package for javascript agents....
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-18T15:02:56.788Z
Learning: Applies to **/agent-js/package.json : Install '@copilotkit/sdk-js' package for JavaScript agents.

Applied to files:

  • find-package-json.sh
📚 Learning: applies to copilotkit/package.json : use [copilotkit/package.json] for workspace setup...
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/package.json : Use [CopilotKit/package.json] for workspace setup

Applied to files:

  • find-package-json.sh
📚 Learning: to run an example, install dependencies using 'npm install' or 'pip install -r requirements.txt', fo...
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/examples-and-demos.mdc:0-0
Timestamp: 2025-07-18T15:03:26.651Z
Learning: To run an example, install dependencies using 'npm install' or 'pip install -r requirements.txt', follow the 'README.md' instructions, run the frontend with 'npm run dev', and run the agent with 'npm run agent' or 'python agent.py'.

Applied to files:

  • find-package-json.sh
🪛 Shellcheck (0.10.0)
find-package-json.sh

[warning] 52-52: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ 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). (11)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
  • GitHub Check: Test (18.x)
  • GitHub Check: Build Images (next-openai, next-openai)
  • GitHub Check: Build Images (coagents-qa-text, ui)
  • GitHub Check: Build Images (coagents-qa-native, ui)
  • GitHub Check: Build Images (coagents-routing, ui)
  • GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-research-canvas, ui)
  • GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
  • GitHub Check: Test (20.x)

Comment thread find-package-json.sh Outdated
Comment on lines +4 to +18
package_files=$(find . -name "package.json" \
-not -path "*/node_modules/*" \
-not -path "*/.github/*" \
-not -path "*/.next/*" \
-not -path "*/.venv/*" \
-not -path "*/.mastra/*" \
-not -path "./package.json" \
-not -path "./docs/*" \
-not -path "./infra/*" \
-not -path "./registry/*" \
-not -path "*/utilities/*" \
-not -path "*/next-pages-router/*" \
-not -path "*/node-express/*" \
-not -path "*/node-http/*" \
-not -path "*/scripts/qa/*" | sort)

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.

🛠️ Refactor suggestion

Use -prune and -print0 to make the find pipeline safer & faster

  1. find … -not -path "*/node_modules/*" still descends into node_modules/ before discarding results. -prune prevents that unnecessary traversal and speeds the scan in large repos.
  2. Collecting results with plain new-line separation (| sort) breaks as soon as a path contains spaces or newlines.

Suggested refactor:

- package_files=$(find . -name "package.json" \
-   -not -path "*/node_modules/*" \
+ # Use -prune for ignored dirs and -print0 to preserve whitespace
+ mapfile -d '' package_files < <(
+   find . \( -path '*/node_modules' -o -path './docs' -o -path './infra' \
+            -o -path './registry' -o -path '*/.github' -o -path '*/.next' \
+            -o -path '*/.venv' -o -path '*/.mastra' -o -path '*/utilities' \
+            -o -path '*/next-pages-router' -o -path '*/node-express' \
+            -o -path '*/node-http' -o -path '*/scripts/qa' \) -prune -o \
+            -name package.json -print0
+ )

This eliminates expensive directory walks and guarantees correct handling of paths with spaces.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In find-package-json.sh lines 4 to 18, the current find command uses multiple
-not -path filters which still cause find to descend into excluded directories,
making it inefficient, and it outputs results separated by newlines which can
break with spaces in paths. Refactor the find command to use -prune on each
excluded directory to prevent descending into them, and use -print0 to output
null-separated results. Then pipe the output through sort -z and handle the
null-separated input accordingly to ensure safe and efficient processing of
paths with spaces.

Comment thread find-package-json.sh Outdated
Comment on lines +30 to +34
for package_file in $package_files; do
dir=$(dirname "$package_file")
echo "📦 Installing in: $dir"

cd "$dir" || continue

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.

🛠️ Refactor suggestion

Iterating with for package_file in $package_files loses files containing whitespace

Because $package_files relies on word-splitting, any directory such as examples/my demo/ui/package.json will be split and processed incorrectly or skipped.

After applying the mapfile approach above, iterate safely:

for package_file in "${package_files[@]}"; do
  dir=$(dirname "$package_file")
  …
done

This preserves every path intact.

🤖 Prompt for AI Agents
In find-package-json.sh around lines 30 to 34, the for loop iterates over
$package_files using word splitting, which breaks paths containing whitespace.
To fix this, change the loop to iterate over the array "${package_files[@]}"
instead of the unquoted variable. This preserves each file path intact,
including those with spaces, ensuring correct processing.

@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: 0

🧹 Nitpick comments (1)
CopilotKit/.changeset/eleven-radios-move.md (1)

8-12: Polish the prose for consistency with the rest of the repo
• Capitalize the library name (“Zod” not “zod”).
• Wrap hook names in back-ticks for readability.
• Add a terminal newline to silence POSIX lint warnings.

-Introduces new hooks with zod support:
-- useHumanInTheLoop
-- useFrontendTool
-- useRenderToolCall
+Introduces new hooks with **Zod** support:
+– `useHumanInTheLoop`
+– `useFrontendTool`
+– `useRenderToolCall`
+
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a960bef and 055c518.

📒 Files selected for processing (3)
  • CopilotKit/.changeset/eleven-radios-move.md (1 hunks)
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts (1 hunks)
  • examples/coagents-research-canvas/ui/src/components/ResearchCanvas.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • CopilotKit/packages/react-core/src/hooks/use-human-in-the-loop.ts
  • examples/coagents-research-canvas/ui/src/components/ResearchCanvas.tsx
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
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/package.json : Review [CopilotKit/package.json] for workspace setup
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
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
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
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/package.json : Use [CopilotKit/package.json] for workspace setup
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/frontend-development.mdc:0-0
Timestamp: 2025-07-18T15:03:52.262Z
Learning: Use the provided hooks and utilities
📚 Learning: applies to copilotkit/packages/react-core/** : core react components and hooks for copilotkit should...
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:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/packages/react-core/**/* : use [react-core/] for basic integration when buildi...
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:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : check useeffect dependenci...
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:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : don't modify suggestions s...
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:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/package.json : review [copilotkit/package.json] for workspace setup...
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/package.json : Review [CopilotKit/package.json] for workspace setup

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : verify `usecopilotchatsugg...
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:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/package.json : use [copilotkit/package.json] for workspace setup...
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/package.json : Use [CopilotKit/package.json] for workspace setup

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : check if `usecopilotchatsu...
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:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/packages/react-ui/**/* : add [react-ui/] for pre-built components when buildin...
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-ui/**/* : Add [react-ui/] for pre-built components when building a simple Copilot or customizing UI components

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/packages/react-textarea/** : textarea component with ai integration should be ...
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-textarea/** : Textarea component with AI integration should be implemented in CopilotKit/packages/react-textarea/

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/packages/sdk-js/**/* : use [sdk-js/] package for developing javascript agents...
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/sdk-js/**/* : Use [sdk-js/] package for developing JavaScript agents

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: applies to copilotkit/packages/sdk-js/** : javascript sdk for backend integration should be implemen...
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/sdk-js/** : JavaScript SDK for backend integration should be implemented in CopilotKit/packages/sdk-js/

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
📚 Learning: use the provided hooks and utilities...
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/frontend-development.mdc:0-0
Timestamp: 2025-07-18T15:03:52.262Z
Learning: Use the provided hooks and utilities

Applied to files:

  • CopilotKit/.changeset/eleven-radios-move.md
🔇 Additional comments (1)
CopilotKit/.changeset/eleven-radios-move.md (1)

1-6: Front-matter looks correct
The packages and bump types are valid, and the delimiter usage follows the Changesets spec.

@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

📜 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 03d24c7 and de7e382.

📒 Files selected for processing (2)
  • CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts (2 hunks)
  • docs/content/docs/reference/hooks/useHumanInTheLoop.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
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-action.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-copilot-action.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-copilot-action.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-action.ts
docs/**/*

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

Check [docs/] for documentation site

Files:

  • docs/content/docs/reference/hooks/useHumanInTheLoop.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/useHumanInTheLoop.mdx
🧠 Learnings (2)
📚 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:

  • CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts
📚 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:

  • CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts
🧬 Code graph analysis (1)
CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts (1)
CopilotKit/packages/shared/src/utils/json-schema.ts (1)
  • actionParametersToJsonSchema (40-60)
⏰ 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-text, ui)
  • GitHub Check: Build Images (coagents-qa-native, ui)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
  • GitHub Check: Build Images (next-openai, next-openai)
  • GitHub Check: Build Images (coagents-routing, ui)
  • GitHub Check: Build Images (coagents-research-canvas, 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: E2E Tests
  • GitHub Check: Test (18.x)
  • GitHub Check: Test (20.x)
🔇 Additional comments (1)
CopilotKit/packages/react-core/src/hooks/use-copilot-action.ts (1)

168-171: Conditional schema hydration looks solid

Auto-hydrating jsonSchema only when it’s absent keeps existing overrides intact while preserving backwards compatibility for descriptor arrays. Nicely done.

Comment on lines +33 to +62
render: ({ args, status, respond }) => {
if (status === "executing" && respond) {
return (
<div className="p-4 border rounded">
<p>Are you sure you want to delete {args.itemCount} {args.itemName}(s)?</p>
<div className="flex gap-2 mt-4">
<button
onClick={() => respond({ confirmed: true })}
className="bg-red-500 text-white px-4 py-2 rounded"
>
Delete
</button>
<button
onClick={() => respond({ confirmed: false })}
className="bg-gray-300 px-4 py-2 rounded"
>
Cancel
</button>
</div>
</div>
);
}

if (status === "complete" && result) {
return (
<div className="p-2 text-sm text-gray-600">
{result.confirmed ? "Items deleted" : "Deletion cancelled"}
</div>
);
}

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.

⚠️ Potential issue | 🟠 Major

Fix undefined result reference in example

result isn’t destructured from the render props, so the “complete” branch always sees it as undefined. Please pull result out of the props before using it.

-  render: ({ args, status, respond }) => {
+  render: ({ args, status, respond, result }) => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
render: ({ args, status, respond }) => {
if (status === "executing" && respond) {
return (
<div className="p-4 border rounded">
<p>Are you sure you want to delete {args.itemCount} {args.itemName}(s)?</p>
<div className="flex gap-2 mt-4">
<button
onClick={() => respond({ confirmed: true })}
className="bg-red-500 text-white px-4 py-2 rounded"
>
Delete
</button>
<button
onClick={() => respond({ confirmed: false })}
className="bg-gray-300 px-4 py-2 rounded"
>
Cancel
</button>
</div>
</div>
);
}
if (status === "complete" && result) {
return (
<div className="p-2 text-sm text-gray-600">
{result.confirmed ? "Items deleted" : "Deletion cancelled"}
</div>
);
}
render: ({ args, status, respond, result }) => {
if (status === "executing" && respond) {
return (
<div className="p-4 border rounded">
<p>Are you sure you want to delete {args.itemCount} {args.itemName}(s)?</p>
<div className="flex gap-2 mt-4">
<button
onClick={() => respond({ confirmed: true })}
className="bg-red-500 text-white px-4 py-2 rounded"
>
Delete
</button>
<button
onClick={() => respond({ confirmed: false })}
className="bg-gray-300 px-4 py-2 rounded"
>
Cancel
</button>
</div>
</div>
);
}
if (status === "complete" && result) {
return (
<div className="p-2 text-sm text-gray-600">
{result.confirmed ? "Items deleted" : "Deletion cancelled"}
</div>
);
}
🤖 Prompt for AI Agents
In docs/content/docs/reference/hooks/useHumanInTheLoop.mdx around lines 33 to
62, the render function uses result in the "complete" branch but never
destructures it from the render props; update the render signature to extract
result (e.g., render: ({ args, status, respond, result }) => { ... }) and then
use the destructured result in the "complete" branch so it no longer references
an undefined variable.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
examples/coagents-starter-crewai-flows/ui/package.json (1)

12-30: Update the CopilotKit dependencies to the new tool-aware version.

This frontend now calls the freshly introduced hooks (useFrontendTool, etc.), but the pinned CopilotKit packages remain at 1.8.13, which doesn't export them. At runtime pnpm will resolve the published 1.8.13 bundle and the build will fail with “useFrontendTool is not exported”. Please bump these dependencies to the updated version that includes the new hooks (or switch to workspace:*).

examples/langgraph-tutorial-customer-support/ui/package.json (1)

12-20: Upgrade the CopilotKit packages alongside the new hook usage.

This app still targets @copilotkit/react-core@^1.5.20, which predates the useFrontendTool introduction. Like other examples, it will break at build time once the code is switched to the new hook set. Please bump the CopilotKit dependencies to a version that ships those exports (or use workspace:*).

examples/mastra/feature-viewer/package.json (1)

14-57: Couple this Zod upgrade with the matching CopilotKit release.

useFrontendTool/friends aren’t available in the currently pinned @copilotkit/*@1.9.0. Make sure to bump these packages to the modernized build that exposes the new APIs, otherwise npm run dev will fail to compile. Switching to workspace:* or the upcoming semver tag solves it.

examples/coagents-starter-crewai-crews/ui/package.json (1)

12-28: Bump CopilotKit dependencies to match the new hook usage.

As with the other examples, the code now imports useRenderToolCall / useFrontendTool, but the dependency pin (1.8.13) predates those exports. Please upgrade these CopilotKit packages (or use workspace links) so the bundle includes the new hooks.

examples/coagents-enterprise-crewai-crews/ui/package.json (1)

12-29: Ensure the CopilotKit version exposes the new hooks.

@copilotkit/[email protected] doesn’t include useHumanInTheLoop. Please bump the CopilotKit dependencies here to the version added in this PR so the example compiles.

examples/ag2/feature-viewer/package.json (1)

13-56: Upgrade the CopilotKit deps alongside the hook migration.

This project still references @copilotkit/*@1.8.13, but the new UI code will rely on useFrontendTool/useRenderToolCall, which ship only in the modernized package. Please bump these dependencies (or point them to the workspace version) to avoid runtime import errors.

🧹 Nitpick comments (1)
CopilotKit/packages/react-core/package.json (1)

60-62: Consider making Zod a peerDependency to avoid duplicate installs in consumers.

Library users often already depend on Zod; declaring it as a peer reduces duplication/bundle size. Keep as a direct dep only if you rely on it at runtime in a way that must be bundled.

Within this file, remove it from dependencies:

   "dependencies": {
     "@copilotkit/runtime-client-gql": "workspace:*",
     "@copilotkit/shared": "workspace:*",
     "@scarf/scarf": "^1.3.0",
     "react-markdown": "^8.0.7",
-    "untruncate-json": "^0.0.1",
-    "zod": "^4.1.11"
+    "untruncate-json": "^0.0.1"
   },

Then add to peerDependencies (and optionally devDependencies for local builds/tests):

   "peerDependencies": {
-    "react": "^18 || ^19 || ^19.0.0-rc",
-    "react-dom": "^18 || ^19 || ^19.0.0-rc"
+    "react": "^18 || ^19 || ^19.0.0-rc",
+    "react-dom": "^18 || ^19 || ^19.0.0-rc",
+    "zod": "^4"
   },
📜 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 de7e382 and f481aeb.

⛔ Files ignored due to path filters (34)
  • CopilotKit/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • docs/package-lock.json is excluded by !**/package-lock.json
  • docs/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/ag2/feature-viewer/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/ag2/starter/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-enterprise-crewai-crews/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa-native/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa-native/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa-text/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-qa/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-research-canvas/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-research-canvas/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-routing/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter-crewai-crews/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter-crewai-flows/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter/agent-js/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-starter/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-travel/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/coagents-wait-user-input/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-anthropic-pinecone/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-chat-with-your-data/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-form-filling/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-fully-custom/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-openaI-mongodb-atlas-vector-search/package-lock.json is excluded by !**/package-lock.json
  • examples/copilot-openaI-mongodb-atlas-vector-search/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/copilot-state-machine/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/demo-viewer/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/langgraph-tutorial-customer-support/ui/package-lock.json is excluded by !**/package-lock.json
  • examples/langgraph-tutorial-customer-support/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/langgraph-tutorial-quickstart/ui/package-lock.json is excluded by !**/package-lock.json
  • examples/langgraph-tutorial-quickstart/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/mastra/feature-viewer/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/mastra/starter/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/saas-dynamic-dashboards/frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (35)
  • CopilotKit/examples/next-openai/package.json (1 hunks)
  • CopilotKit/packages/react-core/package.json (1 hunks)
  • CopilotKit/packages/runtime/package.json (2 hunks)
  • CopilotKit/packages/sdk-js/package.json (2 hunks)
  • CopilotKit/packages/shared/package.json (1 hunks)
  • docs/package.json (1 hunks)
  • examples/ag2/feature-viewer/package.json (1 hunks)
  • examples/ag2/starter/package.json (1 hunks)
  • examples/coagents-enterprise-crewai-crews/ui/package.json (1 hunks)
  • examples/coagents-qa-native/agent-js/package.json (1 hunks)
  • examples/coagents-qa-native/ui/package.json (1 hunks)
  • examples/coagents-qa-text/agent-js/package.json (1 hunks)
  • examples/coagents-qa/ui/package.json (1 hunks)
  • examples/coagents-research-canvas/agent-js/package.json (1 hunks)
  • examples/coagents-research-canvas/ui/package.json (2 hunks)
  • examples/coagents-routing/agent-js/package.json (1 hunks)
  • examples/coagents-starter-crewai-crews/ui/package.json (1 hunks)
  • examples/coagents-starter-crewai-flows/ui/package.json (1 hunks)
  • examples/coagents-starter/agent-js/package.json (1 hunks)
  • examples/coagents-starter/ui/package.json (1 hunks)
  • examples/coagents-travel/ui/package.json (2 hunks)
  • examples/coagents-wait-user-input/ui/package.json (1 hunks)
  • examples/copilot-anthropic-pinecone/package.json (1 hunks)
  • examples/copilot-chat-with-your-data/package.json (1 hunks)
  • examples/copilot-form-filling/package.json (1 hunks)
  • examples/copilot-fully-custom/package.json (1 hunks)
  • examples/copilot-openaI-mongodb-atlas-vector-search/package.json (1 hunks)
  • examples/copilot-state-machine/package.json (1 hunks)
  • examples/demo-viewer/package.json (1 hunks)
  • examples/langgraph-tutorial-customer-support/ui/package.json (1 hunks)
  • examples/langgraph-tutorial-quickstart/ui/package.json (1 hunks)
  • examples/mastra/feature-viewer/package.json (1 hunks)
  • examples/mastra/starter/package.json (1 hunks)
  • examples/saas-dynamic-dashboards/frontend/package.json (2 hunks)
  • registry/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • examples/coagents-starter/agent-js/package.json
  • examples/coagents-research-canvas/agent-js/package.json
  • examples/coagents-starter/ui/package.json
  • examples/copilot-anthropic-pinecone/package.json
  • examples/ag2/starter/package.json
🧰 Additional context used
📓 Path-based instructions (16)
examples/*/{agent,agent-py,ui,README.md,package.json}

📄 CodeRabbit inference engine (.cursor/rules/examples-and-demos.mdc)

Most examples should have the following structure: an 'agent/' (or 'agent-py/') directory for backend agent implementation, a 'ui/' directory for the frontend Next.js application, a 'README.md' file for setup instructions, and a 'package.json' file for dependencies.

Files:

  • examples/copilot-chat-with-your-data/package.json
  • examples/copilot-fully-custom/package.json
  • examples/copilot-openaI-mongodb-atlas-vector-search/package.json
  • examples/copilot-form-filling/package.json
  • examples/copilot-state-machine/package.json
  • examples/demo-viewer/package.json
examples/*/package.json

📄 CodeRabbit inference engine (.cursor/rules/examples-and-demos.mdc)

Each example project should include a 'package.json' file listing dependencies.

Files:

  • examples/copilot-chat-with-your-data/package.json
  • examples/copilot-fully-custom/package.json
  • examples/copilot-openaI-mongodb-atlas-vector-search/package.json
  • examples/copilot-form-filling/package.json
  • examples/copilot-state-machine/package.json
  • examples/demo-viewer/package.json
examples/copilot-chat-with-your-data/**/*

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

Start with [copilot-chat-with-your-data/] when building a simple Copilot

Files:

  • examples/copilot-chat-with-your-data/package.json
examples/*/ui/**

📄 CodeRabbit inference engine (.cursor/rules/examples-and-demos.mdc)

Frontend applications in examples should be implemented as Next.js applications inside the 'ui/' directory.

Files:

  • examples/coagents-research-canvas/ui/package.json
  • examples/langgraph-tutorial-customer-support/ui/package.json
  • examples/coagents-qa-native/ui/package.json
  • examples/coagents-starter-crewai-flows/ui/package.json
  • examples/coagents-wait-user-input/ui/package.json
  • examples/coagents-travel/ui/package.json
  • examples/langgraph-tutorial-quickstart/ui/package.json
  • examples/coagents-enterprise-crewai-crews/ui/package.json
  • examples/coagents-qa/ui/package.json
  • examples/coagents-starter-crewai-crews/ui/package.json
**/agent-js/package.json

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

Install '@copilotkit/sdk-js' package for JavaScript agents.

Files:

  • examples/coagents-qa-native/agent-js/package.json
  • examples/coagents-qa-text/agent-js/package.json
  • examples/coagents-routing/agent-js/package.json
docs/**/*

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

Check [docs/] for documentation site

Files:

  • docs/package.json
CopilotKit/packages/runtime/**

📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)

Core runtime for executing copilot actions should be implemented in CopilotKit/packages/runtime/

Files:

  • CopilotKit/packages/runtime/package.json
examples/coagents-starter-crewai-flows/**/*

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

Use [coagents-starter-crewai-flows/] for CrewAI flows integration

Files:

  • examples/coagents-starter-crewai-flows/ui/package.json
CopilotKit/packages/sdk-js/**

📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)

JavaScript SDK for backend integration should be implemented in CopilotKit/packages/sdk-js/

Files:

  • CopilotKit/packages/sdk-js/package.json
CopilotKit/packages/sdk-js/**/*

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

Use [sdk-js/] package for developing JavaScript agents

Files:

  • CopilotKit/packages/sdk-js/package.json
CopilotKit/packages/shared/**

📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)

Shared utilities and types should be placed in CopilotKit/packages/shared/

Files:

  • CopilotKit/packages/shared/package.json
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/package.json
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/package.json
examples/coagents-routing/**/*

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

Use [coagents-routing/] for routing patterns in multi-agent systems

Files:

  • examples/coagents-routing/agent-js/package.json
registry/**/*

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

Browse [registry/] for reusable UI components

Files:

  • registry/package.json
examples/coagents-starter-crewai-crews/**/*

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

Use [coagents-starter-crewai-crews/] for CrewAI crews integration

Files:

  • examples/coagents-starter-crewai-crews/ui/package.json
🧠 Learnings (14)
📚 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/package.json : Review [CopilotKit/package.json] for workspace setup

Applied to files:

  • examples/copilot-chat-with-your-data/package.json
  • examples/coagents-research-canvas/ui/package.json
  • examples/copilot-fully-custom/package.json
  • CopilotKit/examples/next-openai/package.json
  • CopilotKit/packages/runtime/package.json
  • examples/copilot-openaI-mongodb-atlas-vector-search/package.json
  • CopilotKit/packages/sdk-js/package.json
  • examples/coagents-travel/ui/package.json
  • CopilotKit/packages/shared/package.json
  • CopilotKit/packages/react-core/package.json
  • examples/copilot-form-filling/package.json
  • examples/copilot-state-machine/package.json
  • examples/coagents-enterprise-crewai-crews/ui/package.json
  • examples/coagents-qa/ui/package.json
  • examples/coagents-starter-crewai-crews/ui/package.json
📚 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/package.json : Use [CopilotKit/package.json] for workspace setup

Applied to files:

  • examples/coagents-research-canvas/ui/package.json
  • examples/copilot-fully-custom/package.json
  • CopilotKit/examples/next-openai/package.json
  • CopilotKit/packages/runtime/package.json
  • CopilotKit/packages/sdk-js/package.json
  • examples/coagents-travel/ui/package.json
  • CopilotKit/packages/shared/package.json
  • CopilotKit/packages/react-core/package.json
  • examples/copilot-form-filling/package.json
  • examples/copilot-state-machine/package.json
📚 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:

  • examples/coagents-research-canvas/ui/package.json
  • examples/coagents-travel/ui/package.json
  • CopilotKit/packages/react-core/package.json
📚 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-ui/**/* : Add [react-ui/] for pre-built components when building a simple Copilot or customizing UI components

Applied to files:

  • examples/coagents-research-canvas/ui/package.json
  • examples/coagents-travel/ui/package.json
📚 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:

  • examples/coagents-research-canvas/ui/package.json
  • examples/coagents-travel/ui/package.json
📚 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:

  • examples/coagents-research-canvas/ui/package.json
  • examples/coagents-travel/ui/package.json
📚 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:

  • examples/coagents-research-canvas/ui/package.json
  • examples/coagents-travel/ui/package.json
📚 Learning: 2025-07-18T15:02:56.788Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-18T15:02:56.788Z
Learning: Applies to **/agent-js/package.json : Install 'copilotkit/sdk-js' package for JavaScript agents.

Applied to files:

  • examples/copilot-fully-custom/package.json
  • examples/coagents-qa-native/agent-js/package.json
  • examples/coagents-qa-text/agent-js/package.json
  • CopilotKit/packages/sdk-js/package.json
  • examples/coagents-travel/ui/package.json
  • CopilotKit/packages/shared/package.json
  • CopilotKit/packages/react-core/package.json
  • examples/coagents-routing/agent-js/package.json
📚 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 examples/coagents-starter/agent-js/**/* : Check [coagents-starter/agent-js/] for JavaScript agent example

Applied to files:

  • examples/coagents-qa-native/agent-js/package.json
📚 Learning: 2025-07-18T15:02:56.788Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-18T15:02:56.788Z
Learning: Applies to **/agent-js/tsconfig.json : Configure TypeScript with proper types for JavaScript agents.

Applied to files:

  • examples/saas-dynamic-dashboards/frontend/package.json
📚 Learning: 2025-07-18T15:03:09.674Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-18T15:03:09.674Z
Learning: Applies to CopilotKit/package.json : Workspace configuration should be managed in CopilotKit/package.json

Applied to files:

  • CopilotKit/packages/sdk-js/package.json
  • examples/coagents-travel/ui/package.json
  • CopilotKit/packages/shared/package.json
  • CopilotKit/packages/react-core/package.json
📚 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/sdk-js/**/* : Use [sdk-js/] package for developing JavaScript agents

Applied to files:

  • CopilotKit/packages/sdk-js/package.json
📚 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: Examples should use local packages via workspace references

Applied to files:

  • examples/coagents-travel/ui/package.json
📚 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/CopilotKit.code-workspace : Use [CopilotKit.code-workspace] for VS Code workspace settings

Applied to files:

  • examples/coagents-travel/ui/package.json
⏰ 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-text, agent, python, local-deps)
  • GitHub Check: Build Images (next-openai, next-openai)
  • GitHub Check: Build Images (coagents-qa-native, ui)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-qa-text, ui)
  • 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 (22)
examples/langgraph-tutorial-quickstart/ui/package.json (1)

18-19: Zod dependency addition looks correct.

Adding zod@^4.1.11 keeps this example aligned with the new tool schemas introduced elsewhere in the PR; version matches the rest of the workspace and ensures runtime validation is available.

docs/package.json (1)

53-53: Zod version bump looks consistent

No issues spotted—the docs package aligns with the broader repo’s move to Zod v4.

examples/copilot-form-filling/package.json (1)

14-31: Resolver still targets Zod 3

As coderabbitai already noted, @hookform/[email protected] continues to declare Zod ^3 as its peer dependency. Upgrading Zod to ^4.1.11 without moving the resolver forces a type/runtime mismatch when the form schema is parsed. Please align the resolver to the first release that advertises Zod 4 support (or roll Zod back to 3.x).

-    "@hookform/resolvers": "^4.1.2",
+    "@hookform/resolvers": "^5.0.0",
CopilotKit/packages/shared/package.json (1)

51-51: Zod v4 bump: verify no v3 remnants and remove any zod-to-json-schema usage.

Looks good. Please double-check the monorepo for lingering Zod v3 or zod-to-json-schema.

Run:

#!/bin/bash
# Find any Zod v3 references and zod-to-json-schema usage (outside node_modules)
rg -nP '"zod"\s*:\s*"[~^]?3\.' -g '!**/node_modules/**' -C2
rg -nP 'zod-to-json-schema' -g '!**/node_modules/**' -C2

Optional: enforce a single Zod across the workspace using a root-level override (pnpm):

{
  "pnpm": {
    "overrides": {
      "zod": "^4.1.11"
    }
  }
}
examples/copilot-fully-custom/package.json (1)

27-28: LGTM on adding Zod v4.

Dependencies are consistent with React 18.3.1. No further changes needed here.

registry/package.json (1)

34-34: LGTM: registry now aligned on Zod v4.

No other changes required here.

CopilotKit/examples/next-openai/package.json (1)

38-39: LGTM: add Zod v4 for schema-based tools.

Matches hook migrations in this example.

CopilotKit/packages/runtime/package.json (1)

79-79: Runtime on Zod v4: ensure Jest/ESM compatibility for tests.

If Zod v4 resolves as ESM, Jest may need config tweaks to avoid import errors.

Add (or adjust) jest config to treat TS as ESM and transpile Zod:

// CopilotKit/packages/runtime/jest.config.js (example)
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  extensionsToTreatAsEsm: ['.ts', '.tsx'],
  transform: {
    '^.+\\.(ts|tsx)$': ['ts-jest', { useESM: true }],
  },
  transformIgnorePatterns: ['node_modules/(?!(zod)/)'],
};
examples/copilot-chat-with-your-data/package.json (1)

34-34: Manual verification needed for JSON Schema conversion usage
Examples contain no calls to z.toJSONSchema; confirm whether JSON Schema output is required and update the example code accordingly.

examples/coagents-qa/ui/package.json (1)

31-33: Add and commit lockfile for Zod v4 bump
No lockfile found in examples/coagents-qa/ui (or at the repo root); run the install command in that folder and commit the generated lockfile to lock Zod ^4.1.11.

CopilotKit/packages/sdk-js/package.json (1)

65-71: Align the peer dependency range with Zod 4 support.

Every consumer must now install Zod v4, but the codebase still imports zod-to-json-schema elsewhere? Not an issue. No changes needed here.

examples/coagents-research-canvas/ui/package.json (1)

12-28: Double-check the pre-release version pin.

Thanks for pointing these examples at the pre-release that actually contains the new hooks; this one is good to go.

examples/saas-dynamic-dashboards/frontend/package.json (1)

64-64: Zod v4 bump looks good

Upgrading to ^4.1.11 keeps this example aligned with the hooks’ schema expectations elsewhere in the repo. No further action needed.

examples/coagents-qa-native/ui/package.json (1)

31-32: Thanks for adding the zod dependency

Pulling in zod@^4.1.11 here keeps the demo consistent with the new schema-based APIs—looks good.

examples/coagents-travel/ui/package.json (1)

12-15: Ensure the prerelease @CopilotKit versions resolve via the workspace

These 0.0.0-mme-modernize-copilot-action-* ranges will fail to install unless the example is wired into the pnpm workspace and the corresponding local packages advertise the exact same version. If the workspace link isn’t in place, pnpm will hit the registry and 404. Please either (a) switch these to workspace:* (and confirm the workspace includes this example) or (b) pin them to a published release that contains the new APIs.

examples/mastra/starter/package.json (1)

24-24: Zod upgrade matches the rest of the stack

Bumping to ^4.1.11 keeps the Mastra starter consistent with the core packages—looks good.

examples/coagents-qa-native/agent-js/package.json (1)

19-27: Zod v4 bump looks good.
Dependency set already includes @copilotkit/sdk-js, and the Zod upgrade keeps this agent example aligned with the rest of the workspace.

examples/coagents-routing/agent-js/package.json (1)

19-27: Consistent dependency upgrade.
zod moves to v4 here while the required @copilotkit/sdk-js dependency remains in place, so the agent stays consistent with the new tooling expectations.

examples/coagents-qa-text/agent-js/package.json (1)

19-27: Aligned with the Zod v4 migration.
This example now matches the repository-wide move to Zod v4 and continues to ship with @copilotkit/sdk-js, so no issues spotted.

examples/copilot-state-machine/package.json (1)

12-24: Zod dependency addition LGTM.
Adding zod here keeps the state-machine example in step with the new schema-driven hooks.

examples/demo-viewer/package.json (1)

36-47: Demo viewer dependency sync confirmed.
Adding zod here is expected for the new schema-based hooks and plays nicely with the existing dependency set.

examples/coagents-wait-user-input/ui/package.json (1)

12-31: UI package now ready for Zod-backed hooks.
Including zod ensures this example can adopt the updated useFrontendTool / useHumanInTheLoop patterns without missing deps.

@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: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/content/docs/ag2/frontend-actions.mdx (1)

63-64: Add concrete Python code examples.

The Python code blocks contain placeholder comments instead of actual implementation examples. For effective documentation, provide concrete examples showing how to inherit from CopilotKitState (lines 63-64) and how to call frontend tools from the agent (lines 80-81).

Do you want me to help generate example code for these sections?

Also applies to: 80-81

docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx (1)

160-160: Outdated API reference in comment.

The comment references renderAndWaitForResponse, but the API has been updated to use render instead.

Apply this diff to update the comment:

-        # 4. Define the user_feedback_node, this node will be interrupted before execution
-        #    where CopilotKit's renderAndWaitForResponse provide the user's response.
+        # 4. Define the user_feedback_node, this node will be interrupted before execution
+        #    where CopilotKit's render callback provides the user's response.
🧹 Nitpick comments (3)
docs/content/docs/ag2/frontend-actions.mdx (1)

2-4: Consider renaming file to match "Frontend Tools" terminology.

The file is named frontend-actions.mdx but the title and content now refer to "Frontend Tools". For consistency and to avoid confusion, consider renaming this file to frontend-tools.mdx (and update any routing/redirects accordingly).

docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx (2)

122-132: Align comment terminology with state key
Update comments at lines 122 and 130 to refer to CopilotKit “actions” instead of “tools,” since the state property is named actions.


202-221: Use "actions" terminology in documentation comments. Replace references to "CopilotKit tools" with "CopilotKit actions" in docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx (lines 202–221) to match the state.copilotkit.actions property and the convertActionsToDynamicStructuredTools helper.

📜 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 f481aeb and c411141.

⛔ Files ignored due to path filters (1)
  • CopilotKit/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • CopilotKit/packages/react-core/package.json (2 hunks)
  • CopilotKit/packages/runtime/package.json (2 hunks)
  • CopilotKit/packages/sdk-js/package.json (2 hunks)
  • CopilotKit/packages/shared/package.json (1 hunks)
  • docs/content/docs/ag2/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)
🚧 Files skipped from review as they are similar to previous changes (2)
  • CopilotKit/packages/sdk-js/package.json
  • CopilotKit/packages/react-core/package.json
🧰 Additional context used
📓 Path-based instructions (4)
CopilotKit/packages/shared/**

📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)

Shared utilities and types should be placed in CopilotKit/packages/shared/

Files:

  • CopilotKit/packages/shared/package.json
docs/**/*

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

Check [docs/] for documentation site

Files:

  • docs/content/docs/ag2/frontend-actions.mdx
  • docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx
  • docs/content/docs/mastra/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/ag2/frontend-actions.mdx
  • docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx
  • docs/content/docs/mastra/frontend-actions.mdx
CopilotKit/packages/runtime/**

📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)

Core runtime for executing copilot actions should be implemented in CopilotKit/packages/runtime/

Files:

  • CopilotKit/packages/runtime/package.json
🧠 Learnings (3)
📚 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/package.json : Review [CopilotKit/package.json] for workspace setup

Applied to files:

  • CopilotKit/packages/shared/package.json
📚 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/package.json : Use [CopilotKit/package.json] for workspace setup

Applied to files:

  • CopilotKit/packages/shared/package.json
📚 Learning: 2025-07-18T15:02:56.788Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-18T15:02:56.788Z
Learning: Applies to **/agent-js/package.json : Install 'copilotkit/sdk-js' package for JavaScript agents.

Applied to files:

  • CopilotKit/packages/shared/package.json
⏰ 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). (4)
  • GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
🔇 Additional comments (9)
docs/content/docs/ag2/frontend-actions.mdx (2)

29-45: LGTM! Clean migration to useFrontendTool with Zod.

The import statements and code sample correctly demonstrate the new useFrontendTool API with Zod-based parameter validation. The schema definition and handler are properly aligned.


88-90: LGTM! Clear closing step.

The final step provides a clear summary and uses consistent "frontend tools" terminology.

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

2-4: LGTM! Terminology correctly updated.

The title and description consistently reflect the migration from "Frontend Actions" to "Frontend Tools."


22-30: LGTM! Terminology and hook references correctly updated.

The text correctly references "frontend tools" and the new useFrontendTool hook with appropriate documentation link.


34-35: LGTM! Imports correctly updated for new API.

The imports properly include useFrontendTool and Zod for schema-based parameter validation.


41-50: LGTM! Hook correctly migrated to Zod schema.

The useFrontendTool implementation properly uses a Zod object for parameter validation, with descriptive documentation via .describe(). The handler signature correctly matches the schema.


59-64: LGTM! Final steps correctly reference frontend tools.

The descriptive text consistently uses "frontend tools" terminology throughout the final implementation steps.

docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx (2)

50-56: LGTM! Imports correctly updated for new hook.

The imports properly reference useHumanInTheLoop and include Zod for schema-based parameter validation.


61-92: LGTM! Hook correctly migrated to new API.

The useHumanInTheLoop implementation properly:

  • Uses Zod object for parameter schema with descriptive documentation
  • Replaces renderAndWaitForResponse with render callback
  • Correctly uses respond() to send user feedback back to the agent
  • Leverages status for UI state management

"tsup": "^6.7.0",
"typescript": "^5.2.3",
"zod-to-json-schema": "^3.23.5"
"zod": "^3.23.3"

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.

⚠️ Potential issue | 🟠 Major

Consider narrowing the zod peer dependency range.

The package uses zod ^3.23.3 in devDependencies but declares >=3.0.0 in peerDependencies. This wide range permits zod v4+, which has breaking changes (ESM-only distribution, different JSON Schema API). Testing with v3.x while allowing v4+ in production could lead to runtime incompatibilities.

Consider one of these approaches:

  1. Restrict to v3.x (safest):
  "peerDependencies": {
    "@ag-ui/client": ">=0.0.39",
    "@ag-ui/core": ">=0.0.39",
    "@ag-ui/encoder": ">=0.0.39",
    "@ag-ui/proto": ">=0.0.39",
-   "zod": ">=3.0.0"
+   "zod": "^3.23.0"
  }
  1. Upgrade to v4 and adjust the codebase for ESM compatibility (as noted in past review).

Note: The past review comment mentions zod v4 ESM/Jest concerns, which would become relevant if consumers install zod v4 under the current permissive peer dependency range.

Also applies to: 86-86

🤖 Prompt for AI Agents
In CopilotKit/packages/runtime/package.json around line 47, the peerDependency
for zod is too permissive (>=3.0.0) which allows zod v4+ and can cause
runtime/ESM incompatibilities; change the peerDependency to a narrower range
matching your tested devDependency (e.g., ^3.23.3 or ^3.x) OR, if you intend to
support zod v4, bump devDependency to v4 and update the codebase and build/test
config for ESM compatibility and any API changes from v3→v4; pick one approach
and make the package.json peerDependencies entry and devDependencies consistent
with that choice.

Comment thread CopilotKit/packages/shared/package.json Outdated
"tsup": "^6.7.0",
"typescript": "^5.2.3"
"typescript": "^5.2.3",
"zod": "^3.23.3"

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.

⚠️ Potential issue | 🟠 Major

Consider narrowing the zod peer dependency range.

Same concern as in @copilotkit/runtime: the package uses zod ^3.23.3 in devDependencies but declares >=3.0.0 in peerDependencies, allowing zod v4+ which has breaking changes. This mismatch could cause runtime issues when consumers install zod v4+.

Recommend restricting the peer dependency to v3.x:

  "peerDependencies": {
-   "zod": ">=3.0.0"
+   "zod": "^3.23.0"
  }

Alternatively, if v4 support is intended, upgrade devDependencies to v4 and validate compatibility across the codebase.

Also applies to: 53-55

🤖 Prompt for AI Agents
In CopilotKit/packages/shared/package.json around line 44 (and also check lines
53-55), the peerDependency range for zod is too permissive (allows v4) while
devDependency uses ^3.23.3; tighten the peerDependency to only allow zod v3
(e.g., "zod": ">=3.0.0 <4.0.0" or "^3.x") to prevent consumers from installing
incompatible v4, or if you intend v4 support, upgrade devDependencies and
validate/adjust the codebase for zod v4 compatibility.


<Callout>
Check out the [Frontend Actions overview](/frontend-actions) to understand what they are and when to use them.
Check out the [Frontend Tools overview](/frontend-tools) to understand what they are and when to use them.

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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the Frontend Tools overview link resolves correctly.

Past reviews flagged this link target (/frontend-tools) as potentially broken. While marked as addressed, please confirm the route exists or that proper redirects are in place.


🏁 Script executed:

#!/bin/bash
# Description: Verify the frontend-tools route exists or has a redirect configured
# Expected: Find matching slug, title, or redirect configuration

# Check for pages with frontend-tools slug or title
rg -nP -C2 '(slug:\s*/?frontend-tools\b|title:\s*"?Frontend Tools"?)' docs/content/

# Check for redirect configurations
fd -e json -e js -e ts . docs | xargs rg -l 'redirect' | xargs rg -C3 'frontend-tools'

Length of output: 8295


Fix broken /frontend-tools link: in docs/content/docs/ag2/frontend-actions.mdx (line 10), replace /frontend-tools with the actual route /ag2/frontend-actions or configure a redirect/page for /frontend-tools.

🤖 Prompt for AI Agents
In docs/content/docs/ag2/frontend-actions.mdx around line 10, the link currently
points to the wrong path (/frontend-tools); update the link target to the
correct route (/ag2/frontend-actions) or alternatively add/configure a redirect
or page that maps /frontend-tools to /ag2/frontend-actions so the link resolves
correctly; modify the markdown link destination accordingly and verify the site
builds and the link navigates to the intended page.

<Step>
### Modify your agent
Now, we'll need to modify the agent to access these frontend actions. Open up for your agent's folder and continue from there!
Now, we'll need to modify the agent to access these frontend tools. Open up for your agent's folder and continue from there!

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.

⚠️ Potential issue | 🟡 Minor

Fix grammatical error.

The phrase "Open up for your agent's folder" is grammatically awkward.

Apply this diff:

-        Now, we'll need to modify the agent to access these frontend tools. Open up for your agent's folder and continue from there!
+        Now, we'll need to modify the agent to access these frontend tools. Open up your agent's folder and continue from there!
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Now, we'll need to modify the agent to access these frontend tools. Open up for your agent's folder and continue from there!
Now, we'll need to modify the agent to access these frontend tools. Open up your agent's folder and continue from there!
🤖 Prompt for AI Agents
In docs/content/docs/ag2/frontend-actions.mdx around line 53, the phrase "Open
up for your agent's folder and continue from there!" is grammatically awkward;
change it to "Open up your agent's folder and continue from there." (remove
"for" and optionally change the trailing exclamation to a period) so the
sentence reads correctly.

// execution, giving CopilotKit a chance to get feedback from the user.
//
// The "writeEssay" tool is a CopilotKit action and is binded in step 3.2.
// The "writeEssay" tool is a CopilotKit tool and is binded in step 3.2.

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.

⚠️ Potential issue | 🟡 Minor

Fix grammatical error: "binded" → "bound".

The comment contains a grammatical error.

Apply this diff:

-            //       The "writeEssay" tool is a CopilotKit tool and is binded in step 3.2.
+            //       The "writeEssay" tool is a CopilotKit tool and is bound in step 3.2.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// The "writeEssay" tool is a CopilotKit tool and is binded in step 3.2.
// The "writeEssay" tool is a CopilotKit tool and is bound in step 3.2.
🤖 Prompt for AI Agents
In docs/content/docs/langgraph/human-in-the-loop/node-flow.mdx around line 243,
fix the grammatical error by replacing the incorrect word "binded" with the
correct past participle "bound" in the comment so it reads: The "writeEssay"
tool is a CopilotKit tool and is bound in step 3.2.


<Callout>
Check out the [Frontend Actions overview](/frontend-actions) to understand what they are and when to use them.
Check out the [Frontend Tools overview](/frontend-tools) to understand what they are and when to use them.

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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the link target exists.

The link to /frontend-tools was previously flagged as broken. While marked as addressed, ensure the target page exists with the correct slug.


🏁 Script executed:

#!/bin/bash
# Description: Check if the frontend-tools documentation page exists
# Expected: Find either /frontend-tools or /mastra/frontend-tools target

# Search for files that might be the target of this link
fd -t f -g '*frontend-tools*' docs/content/docs

# Search for frontmatter or titles referencing "Frontend Tools overview"
rg -n "Frontend Tools overview|title.*Frontend Tools" docs/content/docs -A2 -B2

Length of output: 3841


Correct the broken link target: in docs/content/docs/mastra/frontend-actions.mdx (line 15), replace /frontend-tools with /mastra/frontend-actions so it points to the existing Mastra Frontend Tools overview page.

🤖 Prompt for AI Agents
In docs/content/docs/mastra/frontend-actions.mdx around line 15, the link target
currently points to /frontend-tools which is incorrect; update the link so it
points to /mastra/frontend-actions instead to reference the existing Mastra
Frontend Tools overview page.

@@ -61,12 +56,12 @@
<Step>
### Accessing Frontend Actions

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.

⚠️ Potential issue | 🟡 Minor

Inconsistent terminology: "Actions" should be "Tools".

The step heading still references "Frontend Actions" while the rest of the document has been updated to "Frontend Tools."

Apply this diff to fix the inconsistency:

-        ### Accessing Frontend Actions
+        ### Accessing Frontend Tools
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Accessing Frontend Actions
### Accessing Frontend Tools
🤖 Prompt for AI Agents
In docs/content/docs/mastra/frontend-actions.mdx around line 57, the heading
text "Accessing Frontend Actions" is inconsistent with the updated terminology
"Frontend Tools"; update that heading to "Accessing Frontend Tools" so the
document uses "Tools" everywhere.

@changesets-bot-copilotkit

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cb979e4

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/runtime Patch
@copilotkit/sdk-js Patch
@copilotkit/shared Patch
@copilotkit/react-textarea Patch
@copilotkit/react-ui Patch
@copilotkit/runtime-client-gql Patch

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

This branch was successfully deployed

3 active deployments
Preview – docs — cb979e4a Deployed Sep 30, 2025 by vercel[bot]
Preview – examples-coagents-ai-travel-app — cb979e4a Deployed Sep 30, 2025 by vercel[bot]
Preview – examples-coagents-research-canvas-ui — cb979e4a Deployed Sep 30, 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.

3 participants