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

CrewAI SDK

The CopilotKit CrewAI SDK for Python allows you to build and run CrewAI agents with CopilotKit.

copilotkit_predict_state

Stream tool calls as state to CopilotKit.

To emit a tool call as streaming CrewAI state, pass the destination key in state, the tool name and optionally the tool argument. (If you don't pass the argument name, all arguments are emitted under the state key.)

from copilotkit.crewai import copilotkit_predict_state

await copilotkit_predict_state(
    {
        "steps": {
            "tool_name": "SearchTool",
            "tool_argument": "steps",
        },
    }
)

Parameters

configDict[str, CopilotKitPredictStateConfig]required

The configuration to predict the state.

Returns

returnsAwaitable[bool]

Always return True.

copilotkit_emit_message

Manually emits a message to CopilotKit. Useful in longer running nodes to update the user. Important: You still need to return the messages from the node.

Examples

from copilotkit.crewai import copilotkit_emit_message

message = "Step 1 of 10 complete"
await copilotkit_emit_message(message)

# Return the message from the node
return {
    "messages": [AIMessage(content=message)]
}

Parameters

messagestrrequired

The message to emit.

Returns

returnsAwaitable[bool]

Always return True.

copilotkit_emit_tool_call

Manually emits a tool call to CopilotKit.

from copilotkit.crewai import copilotkit_emit_tool_call

await copilotkit_emit_tool_call(name="SearchTool", args={"steps": 10})

Parameters

namestrrequired

The name of the tool to emit.

argsDict[str, Any]required

The arguments to emit.

Returns

returnsAwaitable[bool]

Always return True.

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

On this page

copilotkit_predict_state
Parameters
Returns
copilotkit_emit_message
Examples
Parameters
Returns
copilotkit_emit_tool_call
Parameters
Returns