Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(python): cast result to ToolExecutionResponse for mypy overload resolution

Dhawal Upadhyayd2264c73360f
diff --git a/python/composio/core/models/tool_router_session.py b/python/composio/core/models/tool_router_session.py
index 708be12c9..bfd626772 100644
--- a/python/composio/core/models/tool_router_session.py
+++ b/python/composio/core/models/tool_router_session.py
@@ -190,13 +190,15 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
# Apply after_execute modifiers
if modifiers is not None:
+ from composio.core.models.tools import ToolExecutionResponse
+
type_after: t.Literal["after_execute"] = "after_execute"
result = apply_modifier_by_type(
modifiers=modifiers,
toolkit="composio",
tool=slug,
type=type_after,
- response=result,
+ response=t.cast(ToolExecutionResponse, result),
)
return result