A2UI Launched: Full CopilotKit support at launch!

A2UI Launched: CopilotKit has partnered with Google to deliver full support in both CopilotKit and AG-UI!

Check it out
LogoLogo
  • Overview
  • Integrations
  • API Reference
  • Copilot Cloud
Slanted end borderSlanted end border
Slanted start borderSlanted start border
Select integration...

Please select an integration to view the sidebar content.

Frontend Actions

Create frontend actions and use them within your CrewAI Crews agent.

Implementation

Check out the Frontend Actions overview to understand what they are and when to use them.

Setup CopilotKit

To use frontend actions, you'll need to setup CopilotKit first. For the sake of brevity, we won't cover it here.

Check out our getting started guide and come back here when you're setup!

Create a frontend action

First, you'll need to create a frontend action using the useCopilotAction hook. Here's a simple one to get you started that says hello to the user.

page.tsx
import { useCopilotAction } from "@copilotkit/react-core"

export function Page() {
  // ...

  useCopilotAction({
    name: "sayHello",
    description: "Say hello to the user",
    available: "remote", // optional, makes it so the action is *only* available to the agent
    parameters: [
      {
        name: "name",
        type: "string",
        description: "The name of the user to say hello to",
        required: true,
      },
    ],
    handler: async ({ name }) => {
      alert(`Hello, ${name}!`);
    },
  });

  // ...
}

Frontend actions are made available automatically to Crews

We don't need to do anything special to access these frontend actions from within a CrewAI Crew, since they're automatically available.

Give it a try!

You've now given your agent the ability to directly call any CopilotActions you've defined. These actions will be available as tools to the agent where they can be used as needed.

PREV
Setting the inputs
Slanted end borderSlanted end border
Slanted start borderSlanted start border
NEXT
Exiting the agent loop

On this page

Implementation
Setup CopilotKit
Create a frontend action
Frontend actions are made available automatically to Crews
Give it a try!