copilotkit 0.1.75a7__py3-none-any.whl → 0.1.76__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.
- copilotkit/copilotkit_lg_middleware.py +10 -21
- copilotkit/langgraph.py +4 -0
- {copilotkit-0.1.75a7.dist-info → copilotkit-0.1.76.dist-info}/METADATA +2 -2
- {copilotkit-0.1.75a7.dist-info → copilotkit-0.1.76.dist-info}/RECORD +5 -5
- {copilotkit-0.1.75a7.dist-info → copilotkit-0.1.76.dist-info}/WHEEL +0 -0
|
@@ -4,7 +4,7 @@ CopilotKit Middleware for LangGraph agents.
|
|
|
4
4
|
Works with any agent (prebuilt or custom).
|
|
5
5
|
|
|
6
6
|
Example:
|
|
7
|
-
from
|
|
7
|
+
from langgraph.prebuilt import create_agent
|
|
8
8
|
from copilotkit import CopilotKitMiddleware
|
|
9
9
|
|
|
10
10
|
agent = create_agent(
|
|
@@ -25,30 +25,19 @@ from langchain.agents.middleware import (
|
|
|
25
25
|
)
|
|
26
26
|
from langgraph.runtime import Runtime
|
|
27
27
|
|
|
28
|
-
from .langgraph import
|
|
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:
|
|
31
|
+
copilotkit: CopilotKitProperties
|
|
43
32
|
|
|
44
33
|
|
|
45
|
-
class CopilotKitMiddleware(AgentMiddleware[
|
|
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 =
|
|
40
|
+
state_schema = StateSchema
|
|
52
41
|
tools: ClassVar[list] = []
|
|
53
42
|
|
|
54
43
|
@property
|
|
@@ -89,10 +78,10 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
|
|
|
89
78
|
# Intercept frontend tool calls after model returns, before ToolNode executes
|
|
90
79
|
def after_model(
|
|
91
80
|
self,
|
|
92
|
-
state:
|
|
81
|
+
state: StateSchema,
|
|
93
82
|
runtime: Runtime[Any],
|
|
94
83
|
) -> dict[str, Any] | None:
|
|
95
|
-
frontend_tools = state.get("copilotkit", {}).get("
|
|
84
|
+
frontend_tools = state.get("copilotkit", {}).get("actions", [])
|
|
96
85
|
if not frontend_tools:
|
|
97
86
|
return None
|
|
98
87
|
|
|
@@ -143,7 +132,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
|
|
|
143
132
|
|
|
144
133
|
async def aafter_model(
|
|
145
134
|
self,
|
|
146
|
-
state:
|
|
135
|
+
state: StateSchema,
|
|
147
136
|
runtime: Runtime[Any],
|
|
148
137
|
) -> dict[str, Any] | None:
|
|
149
138
|
# Delegate to sync implementation
|
|
@@ -152,7 +141,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
|
|
|
152
141
|
# Restore frontend tool calls to AIMessage before agent exits
|
|
153
142
|
def after_agent(
|
|
154
143
|
self,
|
|
155
|
-
state:
|
|
144
|
+
state: StateSchema,
|
|
156
145
|
runtime: Runtime[Any],
|
|
157
146
|
) -> dict[str, Any] | None:
|
|
158
147
|
copilotkit_state = state.get("copilotkit", {})
|
|
@@ -186,7 +175,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
|
|
|
186
175
|
|
|
187
176
|
async def aafter_agent(
|
|
188
177
|
self,
|
|
189
|
-
state:
|
|
178
|
+
state: StateSchema,
|
|
190
179
|
runtime: Runtime[Any],
|
|
191
180
|
) -> dict[str, Any] | None:
|
|
192
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.
|
|
3
|
+
Version: 0.1.76
|
|
4
4
|
Summary: CopilotKit python SDK
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: copilot,copilotkit,langgraph,langchain,ai,langsmith,langserve
|
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Provides-Extra: crewai
|
|
16
|
-
Requires-Dist: ag-ui-langgraph[fastapi] (>=0.0.
|
|
16
|
+
Requires-Dist: ag-ui-langgraph[fastapi] (>=0.0.23)
|
|
17
17
|
Requires-Dist: crewai (==0.118.0) ; extra == "crewai"
|
|
18
18
|
Requires-Dist: fastapi (>=0.115.0,<0.116.0)
|
|
19
19
|
Requires-Dist: langchain (>=0.3.0)
|
|
@@ -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=
|
|
4
|
+
copilotkit/copilotkit_lg_middleware.py,sha256=mG2SbSkL4cIyb6nxRHhbabI_sjopiSsmcRogQj4XQk4,5519
|
|
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=
|
|
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.
|
|
25
|
-
copilotkit-0.1.
|
|
26
|
-
copilotkit-0.1.
|
|
24
|
+
copilotkit-0.1.76.dist-info/METADATA,sha256=We0hdqE7LW0aCioPEf9eZUeA-J5smFGRdmS8PKS1sGQ,2604
|
|
25
|
+
copilotkit-0.1.76.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
26
|
+
copilotkit-0.1.76.dist-info/RECORD,,
|
|
File without changes
|