Skip to content

Commit c8d4b27

Browse files
committed
chore: add state streaming to langgraph example
1 parent 699f931 commit c8d4b27

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • examples/integrations/langgraph-python/apps/agent

examples/integrations/langgraph-python/apps/agent/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
It defines the workflow graph, state, tools, nodes and edges.
44
"""
55

6-
from copilotkit import CopilotKitMiddleware
6+
from copilotkit import CopilotKitMiddleware, StateStreamingMiddleware, StateItem
77
from langchain.agents import create_agent
88

99
# Data & state tools
@@ -17,7 +17,12 @@
1717
agent = create_agent(
1818
model="openai:gpt-5.4",
1919
tools=[query_data, *todo_tools, generate_a2ui, search_flights],
20-
middleware=[CopilotKitMiddleware()],
20+
middleware=[
21+
CopilotKitMiddleware(),
22+
StateStreamingMiddleware(
23+
StateItem(state_key="todos", tool="manage_todos", tool_argument="todos")
24+
),
25+
],
2126
state_schema=AgentState,
2227
system_prompt="""
2328
You are a polished, professional demo assistant. Keep responses to 1-2 sentences.

0 commit comments

Comments
 (0)