Back to Copilotkit

Shared State

showcase/shell-docs/src/content/docs/integrations/mastra/shared-state/index.mdx

1.57.0766 B
Original Source
<Frame> </Frame>

The foundation of this system is built on Mastra's stateful architecture via AG-UI. Mastra agents can 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 Mastra 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.