copilotkit 0.1.75a6__tar.gz → 0.1.75a8__tar.gz

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.
Files changed (26) hide show
  1. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/PKG-INFO +1 -1
  2. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/copilotkit_lg_middleware.py +9 -21
  3. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/langgraph.py +4 -0
  4. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/pyproject.toml +1 -1
  5. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/README.md +0 -0
  6. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/__init__.py +0 -0
  7. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/action.py +0 -0
  8. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/agent.py +0 -0
  9. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/crewai/__init__.py +0 -0
  10. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/crewai/copilotkit_integration.py +0 -0
  11. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/crewai/crewai_agent.py +0 -0
  12. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/crewai/crewai_sdk.py +0 -0
  13. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/exc.py +0 -0
  14. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/html.py +0 -0
  15. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/integrations/__init__.py +0 -0
  16. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/integrations/fastapi.py +0 -0
  17. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/langchain.py +0 -0
  18. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/langgraph_agent.py +0 -0
  19. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/langgraph_agui_agent.py +0 -0
  20. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/logging.py +0 -0
  21. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/parameter.py +0 -0
  22. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/protocol.py +0 -0
  23. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/runloop.py +0 -0
  24. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/sdk.py +0 -0
  25. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/types.py +0 -0
  26. {copilotkit-0.1.75a6 → copilotkit-0.1.75a8}/copilotkit/utils.py +0 -0
@@ -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
@@ -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
@@ -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
  [tool.poetry]
2
2
  name = "copilotkit"
3
- version = "0.1.75-alpha.6"
3
+ version = "0.1.75-alpha.8"
4
4
  description = "CopilotKit python SDK"
5
5
  authors = ["Markus Ecker <markus.ecker@gmail.com>"]
6
6
  license = "MIT"
File without changes