CopilotKit

05pattern 05 of 05

Copilots that act — with approval.

LOB copilots earn trust with human-in-the-loop approval: the agent proposes, your user approves. Human-in-the-loop by default means the agent does the work inside your workflows, and your user stays in control.

New to CopilotKit? It's the open-source frontend stack for AI agents: you bring the agent, CopilotKit connects it to the people using your app. This page shows one of the five patterns it makes possible. What it is, in 30 seconds ↓

What CopilotKit is

Connect any agent to any user.

CopilotKit is the open-source frontend stack for AI agents: it puts an agent to work inside a real product, not in a chat window next to it. Bring the agent you have; reach the people where they already are.

any agent
Microsoft Agent FrameworkAWS StrandsGoogle ADKLangChain / LangGraphCrewAIAgnoClaude Agents SDKOpenAI Agents SDKMastraPydantic AILlamaIndexAG2
any user
iOSAndroidWebSMSiMessageTelegramWhatsAppSlackDiscordGoogle ChatMicrosoft Teams
01 · bring your agent

Any framework, unchanged

CopilotKit speaks AG-UI, the open protocol it created. The agent side stays yours.

02 · connect it to users

Inside your product

Hooks and components for every pattern on this site. This page is one of them.

03 · ship it safely

Production-ready runtime

Streaming, concurrency, retries, and state sync handled. Open source, 37,000+ GitHub stars.

In code
app/page.tsx
import { useFrontendTool } from "@copilotkit/react-core/v2";
import { z } from "zod";

useFrontendTool({
  name: "request_user_approval",
  description: "Ask the operator to approve or reject an action.",
  parameters: z.object({ message: z.string(), context: z.string().optional() }),
  handler: ({ message, context }) =>
    // resolves when the operator clicks Approve or Reject in your modal
    new Promise<{ approved: boolean; reason?: string }>((resolve) =>
      setDialog({ open: true, pending: { message, context }, resolve }),
    ),
});
npm install @copilotkit/react-core @copilotkit/runtime
How it works
01

The agent proposes

Before a consequential action it calls request_user_approval with the concrete numbers and IDs.

02

Your UI decides

The handler returns a Promise. Your modal, outside the chat, resolves it with Approve or Reject.

03

The agent continues

The decision comes back as the tool result. Approved actions run; rejected ones stop, with the reason on record.

Building this?

Tell us in one click. We'll point you at the demo source, the right guide, and the people in the community shipping the same pattern — and skip everything else.

Got it.

We'll tailor what we send you from here. The fastest way to go deeper is the live demo above.

Other patterns