Logo

Shared State

Create a two-way connection between your UI and agent state.

Shared State Demo

This video demonstrates the Research Canvas utilizing shared state.

What is shared state?

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
Agentic Copilot State Diagram

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.

When should I use this?

State streaming is perfect when you want to faciliate collaboration between your agent and the user. Any state that your LangGraph agent persists will be automatically shared by the UI. Similarly, any state that the user updates in the UI will be automatically reflected

This allows for a consistent experience where both the agent and the user are on the same page.

On this page

Edit on GitHub