MCPcopy
hub / github.com/CopilotKit/CopilotKit / execute_action

Method execute_action

sdk-python/copilotkit/sdk.py:269–295  ·  view source on GitHub ↗

Execute an action

(
        self,
        *,
        context: CopilotKitContext,
        name: str,
        arguments: dict,
    )

Source from the content-addressed store, hash-verified

267 return action
268
269 def execute_action(
270 self,
271 *,
272 context: CopilotKitContext,
273 name: str,
274 arguments: dict,
275 ) -> Coroutine[Any, Any, ActionResultDict]:
276 """
277 Execute an action
278 """
279
280 action = self._get_action(context=context, name=name)
281
282 self._log_request_info(
283 title="Handling execute action request:",
284 data=[
285 ("Context", context),
286 ("Action", action.dict_repr()),
287 ("Arguments", arguments),
288 ],
289 )
290
291 try:
292 result = action.execute(arguments=arguments)
293 return result
294 except Exception as error:
295 raise ActionExecutionException(name, error) from error
296
297 def execute_agent( # pylint: disable=too-many-arguments
298 self,

Callers 1

handle_execute_actionFunction · 0.80

Calls 5

_get_actionMethod · 0.95
_log_request_infoMethod · 0.95
executeMethod · 0.65
dict_reprMethod · 0.45

Tested by

no test coverage detected