copilotkit 0.1.75a6__py3-none-any.whl → 0.1.75a8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,30 +25,19 @@ from langchain.agents.middleware import (
25
25
  )
26
26
  from langgraph.runtime import Runtime
27
27
 
28
- from .langgraph import CopilotContextItem
29
-
30
- class CopilotKitState:
31
- """Extended state schema for CopilotKit middleware."""
32
-
33
- # CopilotKit frontend tools passed via state
34
- actions: List[Any]
35
- context: List[CopilotContextItem]
36
-
37
- # Private state for CopilotKit middleware
38
- intercepted_tool_calls: Any
39
- original_ai_message_id: Any
28
+ from .langgraph import CopilotKitProperties
40
29
 
41
30
  class StateSchema(AgentState):
42
- copilotkit: CopilotKitState
31
+ copilotkit: CopilotKitProperties
43
32
 
44
33
 
45
- class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
34
+ class CopilotKitMiddleware(AgentMiddleware[StateSchema, Any]):
46
35
  """CopilotKit Middleware for LangGraph agents.
47
36
 
48
37
  Handles frontend tool injection and interception for CopilotKit.
49
38
  """
50
39
 
51
- state_schema = CopilotKitState
40
+ state_schema = StateSchema
52
41
  tools: ClassVar[list] = []
53
42
 
54
43
  @property
@@ -77,7 +66,6 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
77
66
  handler: Callable[[ModelRequest], Awaitable[ModelResponse]],
78
67
  ) -> ModelResponse:
79
68
  frontend_tools = request.state.get("copilotkit", {}).get("actions", [])
80
- print(request.state)
81
69
 
82
70
  if not frontend_tools:
83
71
  return await handler(request)
@@ -90,10 +78,10 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
90
78
  # Intercept frontend tool calls after model returns, before ToolNode executes
91
79
  def after_model(
92
80
  self,
93
- state: CopilotKitState,
81
+ state: StateSchema,
94
82
  runtime: Runtime[Any],
95
83
  ) -> dict[str, Any] | None:
96
- frontend_tools = state.get("copilotkit", {}).get("tools", [])
84
+ frontend_tools = state.get("copilotkit", {}).get("actions", [])
97
85
  if not frontend_tools:
98
86
  return None
99
87
 
@@ -144,7 +132,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
144
132
 
145
133
  async def aafter_model(
146
134
  self,
147
- state: CopilotKitState,
135
+ state: StateSchema,
148
136
  runtime: Runtime[Any],
149
137
  ) -> dict[str, Any] | None:
150
138
  # Delegate to sync implementation
@@ -153,7 +141,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
153
141
  # Restore frontend tool calls to AIMessage before agent exits
154
142
  def after_agent(
155
143
  self,
156
- state: CopilotKitState,
144
+ state: StateSchema,
157
145
  runtime: Runtime[Any],
158
146
  ) -> dict[str, Any] | None:
159
147
  copilotkit_state = state.get("copilotkit", {})
@@ -187,7 +175,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
187
175
 
188
176
  async def aafter_agent(
189
177
  self,
190
- state: CopilotKitState,
178
+ state: StateSchema,
191
179
  runtime: Runtime[Any],
192
180
  ) -> dict[str, Any] | None:
193
181
  # Delegate to sync implementation
copilotkit/langgraph.py CHANGED
@@ -37,6 +37,10 @@ class CopilotKitProperties(TypedDict):
37
37
  actions: List[Any]
38
38
  context: List[CopilotContextItem]
39
39
 
40
+ # Private state for CopilotKit middleware
41
+ intercepted_tool_calls: Any
42
+ original_ai_message_id: Any
43
+
40
44
  class CopilotKitState(MessagesState):
41
45
  """CopilotKit state"""
42
46
  copilotkit: CopilotKitProperties
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: copilotkit
3
- Version: 0.1.75a6
3
+ Version: 0.1.75a8
4
4
  Summary: CopilotKit python SDK
5
5
  License: MIT
6
6
  Keywords: copilot,copilotkit,langgraph,langchain,ai,langsmith,langserve
@@ -1,7 +1,7 @@
1
1
  copilotkit/__init__.py,sha256=22bUXudklMop9r1DYkecCaTiHbj_m0Wf4txOU-yfSI4,859
2
2
  copilotkit/action.py,sha256=bg_bPusEfN8TMQV1B3lVyMLbHyLn1E7yVYAvfE2_PXA,1691
3
3
  copilotkit/agent.py,sha256=e-jPsUQo18FOYUPdE3YNmSLcb5FEfWL6ARScOntyvb8,1663
4
- copilotkit/copilotkit_lg_middleware.py,sha256=ya4ZDu7L8zKp53K-KxEhoWFcbFg8ZCKcvkQETS_-oMs,5866
4
+ copilotkit/copilotkit_lg_middleware.py,sha256=7MIiMfdKp9TuwmL0k7dIvTYYob6InxQbOUqICowYRDs,5517
5
5
  copilotkit/crewai/__init__.py,sha256=RAkBTwDpFuvD5prULUnoWdl5d8W373cm1ZlqOMeSGbY,1034
6
6
  copilotkit/crewai/copilotkit_integration.py,sha256=vd1LVhXo-cpA4PQ_-cZHdKgm67MvrHpx4VJweUvCzPE,14550
7
7
  copilotkit/crewai/crewai_agent.py,sha256=maoMnl0WIHUnFAK5ALUKD9z0GvjtfNGi31zi37LyyaE,15323
@@ -11,7 +11,7 @@ copilotkit/html.py,sha256=IHnY4cx89LuYuPPf8Tady2DXfr3MyRWilMHpZ7d8bFk,4357
11
11
  copilotkit/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  copilotkit/integrations/fastapi.py,sha256=3DAAFbpFqL0cJ22sE6JDz3HbTjYerDqn4ZJhYhCvwZs,10487
13
13
  copilotkit/langchain.py,sha256=QFIHnhhAzCKO16F6aFYh_gsCEfm-eaCUPZm-yMTczxU,752
14
- copilotkit/langgraph.py,sha256=Y8VSZ-0vCijppf_0PrHtyT24wC6L16gETbsKwVX4F6g,14992
14
+ copilotkit/langgraph.py,sha256=wfAqp1P2KfMQw5X1AL2BJtXrQBgT02U3KoJh54--uXA,15103
15
15
  copilotkit/langgraph_agent.py,sha256=WPg45s3ITOU2exgE_sW1u-rgnYY4WherAzTVLscBkBk,29668
16
16
  copilotkit/langgraph_agui_agent.py,sha256=t6Vpdiod6-iIGRI303-ipN6FfakpB5So2gaYKYZ6zlY,7798
17
17
  copilotkit/logging.py,sha256=lpPEZbI6LMaQLzSgiQMYV4qHrNk-MuO2qZ3zcaHl1nA,499
@@ -21,6 +21,6 @@ copilotkit/runloop.py,sha256=9pBqWeu4QCRPOizz00se1d0_BvCX3ZIABzNeiXhdyNM,10641
21
21
  copilotkit/sdk.py,sha256=VEQqA9QAXJS5MDLxtJJdtfrApX9EawCHzp-IXnat5vw,11882
22
22
  copilotkit/types.py,sha256=_YQluiHpJGGXYB4eWLk0EocDZp5C8rs3ZsMNFhmXEYU,972
23
23
  copilotkit/utils.py,sha256=rOAaaFBXgb3iv_cLH9S2steyGwHmnTjaxQTA53qdtQo,203
24
- copilotkit-0.1.75a6.dist-info/METADATA,sha256=tPZS0ECIe5RrS5lZk4N8JfLjew6iEKX2vfWrpRfrQ2M,2606
25
- copilotkit-0.1.75a6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
26
- copilotkit-0.1.75a6.dist-info/RECORD,,
24
+ copilotkit-0.1.75a8.dist-info/METADATA,sha256=3NGADg3OXLOLV_IcWmRzTaVrlNqI8wbq1UTqg3bEKq0,2606
25
+ copilotkit-0.1.75a8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
26
+ copilotkit-0.1.75a8.dist-info/RECORD,,