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
  • API Reference
  • UI Components
  • CopilotTextarea
  • CopilotKit
  • Hooks
  • useAgent
  • useDefaultTool
  • useFrontendTool
  • useRenderToolCall
  • useHumanInTheLoop
  • useCopilotReadable
  • useCopilotAdditionalInstructions
  • useCopilotChat
  • useCopilotChatHeadless_c
  • useCopilotChatSuggestions
  • useCoAgent
  • useCoAgentStateRender
  • useLangGraphInterrupt
  • useCopilotAction
  • Classes
  • CopilotRuntime
  • CopilotTask
  • SDKs
Python

CrewAIAgent

CrewAIAgent lets you define your agent for use with CopilotKit.

CrewAIAgent

CrewAIAgent lets you define your agent for use with CopilotKit.

To install, run:

pip install copilotkit[crewai]

Every agent must have the name and either crew or flow properties defined. An optional description can also be provided. This is used when CopilotKit is dynamically routing requests to the agent.

Serving a Crew based agent

To serve a Crew based agent, pass in a Crew object to the crew parameter.

Note: You need to make sure to have a chat_llm set on the Crew object. See the CrewAI docs for more information.

from copilotkit import CrewAIAgent


CrewAIAgent(
    name="email_agent_crew",
    description="This crew based agent sends emails",
    crew=SendEmailCrew(),
)

Serving a Flow based agent

To serve a Flow based agent, pass in a Flow object to the flow parameter.

CrewAIAgent(
    name="email_agent_flow",
    description="This flow based agent sends emails",
    flow=SendEmailFlow(),
)

Note: Either a crew or flow must be provided to CrewAIAgent.

Parameters

namestrrequired

The name of the agent.

crewCrewrequired

When using a Crew based agent, pass in a Crew object to the crew parameter.

flowFlowrequired

When using a Flow based agent, pass in a Flow object to the flow parameter.

descriptionOptional[str]

The description of the agent.

copilotkit_configOptional[CopilotKitConfig]

The CopilotKit config to use with the agent.

CopilotKitConfig

CopilotKit config for CrewAIAgent

This is used for advanced cases where you want to customize how CopilotKit interacts with CrewAI.

# Function signatures:
def merge_state(
    *,
    state: dict,
    messages: List[BaseMessage],
    actions: List[Any],
    agent_name: str
):
    # ...implementation...

Parameters

merge_stateCallablerequired

This function lets you customize how CopilotKit merges the agent state.

PREV
LangGraph SDK
Slanted end borderSlanted end border
Slanted start borderSlanted start border
NEXT
CrewAI SDK

On this page

CrewAIAgent
Serving a Crew based agent
Serving a Flow based agent
Parameters
CopilotKitConfig
Parameters