Files
Maxim 4a6d364e2c fix(sdk): harden error handling, revert args strictness, shield sleep
Address code review findings across all three SDK variants:

- Shield asyncio.sleep(0.02) with asyncio.shield() so task cancellation
  doesn't prevent returning the tool_call_id after dispatch
- Revert args validation to original permissiveness (JS: undefined-only
  check, Python: no isinstance check) to avoid breaking existing callers
- Add upfront json.dumps() serializability check in Python variants
- Fix compensating TOOL_CALL_END double-emit by tracking dispatched_end
- Add compensating action_execution_end to CrewAI variant (queue_put is
  non-atomic)
- Use exc_info=True in compensating-END error logging
- Export all exception types from copilotkit package root (__init__.py)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-20 00:18:23 +02:00

58 lines
1.4 KiB
Python

"""CopilotKit SDK"""
from .sdk import (
CopilotKitRemoteEndpoint,
CopilotKitContext,
CopilotKitSDK,
CopilotKitSDKContext,
)
from .action import Action
from .exc import (
CopilotKitError,
CopilotKitMisuseError,
ActionNotFoundException,
AgentNotFoundException,
ActionExecutionException,
AgentExecutionException,
)
from .langgraph import CopilotKitState
from .parameter import Parameter
from .agent import Agent
from .langgraph_agui_agent import LangGraphAGUIAgent
from .copilotkit_lg_middleware import CopilotKitMiddleware
from ag_ui_langgraph.middlewares.state_streaming import (
StateStreamingMiddleware,
StateItem,
)
from .header_propagation import (
set_forwarded_headers,
get_forwarded_headers,
install_httpx_hook,
)
__all__ = [
"CopilotKitRemoteEndpoint",
"CopilotKitSDK",
"Action",
"CopilotKitState",
"Parameter",
"Agent",
"CopilotKitContext",
"CopilotKitSDKContext",
"CopilotKitError",
"CopilotKitMisuseError",
"ActionNotFoundException",
"AgentNotFoundException",
"ActionExecutionException",
"AgentExecutionException",
"CrewAIAgent", # pyright: ignore[reportUnsupportedDunderAll] pylint: disable=undefined-all-variable
"LangGraphAGUIAgent",
"CopilotKitMiddleware",
"StateStreamingMiddleware",
"StateItem",
"set_forwarded_headers",
"get_forwarded_headers",
"install_httpx_hook",
]