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.

Shared State

CoAgents maintain a shared state across your UI and agent execution.

Agentic Copilot State Diagram

CoAgents maintain a shared state that seamlessly connects your UI with the agent's execution. This shared state system allows you to:

  • Display the agent's current progress and intermediate results
  • Update the agent's state through UI interactions
  • React to state changes in real-time across your application

The foundation of this system is built on LangGraph's stateful architecture. Unlike traditional LangChains, LangGraphs maintain their internal state throughout execution, which you can access via the useCoAgentState hook.

Understanding Predicted State

While your agent runs, you can emit state updates using CopilotKit's emit_intermediate_state function, ensuring your UI stays synchronized with the agent's progress. The emitted state is called the predicted state and is used to provide immediate feedback about ongoing operations.

While the core shared state reflects the agent's current node in the execution graph, the predicted state provides immediate feedback about ongoing operations. Accordingly, this creates a more fluid user experience by showing real-time progress before the agent completes its current task.

When the state is updated (when a node finishes executing),

For example, when your agent is processing a request, the predicted state might show a loading indicator or partial results, while the actual shared state updates once the operation is complete.

Want help implementing this into your CoAgent application? Check out our intermediate state streaming documentation.

PREV
Agentic Copilots
Slanted end borderSlanted end border
Slanted start borderSlanted start border
NEXT
Streaming and Tool Calls

On this page

Understanding Predicted State