Back to Copilotkit

Shared State Setup

showcase/integrations/langgraph-python/docs/setup/shared-state-setup.mdx

1.57.4518 B
Original Source
<Steps> <Step> ### Install the LangGraph Python SDK
<InstallPythonSDK />
</Step> <Step> ### Wire CopilotKit middleware into your graph
Shared state flows between your UI and your agent through `agent.setState`
on the frontend and `state.get(...)` in your graph nodes. Attach
`CopilotKitMiddleware` to your `create_agent` call so CopilotKit-specific
state is picked up alongside your own.

<DemoCode file="src/agents/frontend_tools.py" region="middleware" />
</Step> </Steps>