@@ -470,11 +470,17 @@ def _populate_actions_data(self):
470470 if parameters_schema is None :
471471 logger .warning (f"Parameters schema is None for action key: { action_key } " )
472472 # Still add the action but with empty fields
473+ # Extract version information from the tool
474+ version = tool_dict .get ("version" )
475+ available_versions = tool_dict .get ("available_versions" , [])
476+
473477 self ._action_schemas [action_key ] = tool_dict
474478 self ._actions_data [action_key ] = {
475479 "display_name" : display_name ,
476480 "action_fields" : [],
477481 "file_upload_fields" : set (),
482+ "version" : version ,
483+ "available_versions" : available_versions ,
478484 }
479485 continue
480486
@@ -488,11 +494,17 @@ def _populate_actions_data(self):
488494 parameters_schema = parameters_schema .__dict__
489495 else :
490496 logger .warning (f"Cannot process parameters schema for { action_key } , skipping" )
497+ # Extract version information from the tool
498+ version = tool_dict .get ("version" )
499+ available_versions = tool_dict .get ("available_versions" , [])
500+
491501 self ._action_schemas [action_key ] = tool_dict
492502 self ._actions_data [action_key ] = {
493503 "display_name" : display_name ,
494504 "action_fields" : [],
495505 "file_upload_fields" : set (),
506+ "version" : version ,
507+ "available_versions" : available_versions ,
496508 }
497509 continue
498510
@@ -531,22 +543,34 @@ def _populate_actions_data(self):
531543 elif field_name in original_descriptions :
532544 field_schema ["description" ] = original_descriptions [field_name ]
533545 except (KeyError , TypeError , ValueError ):
546+ # Extract version information from the tool
547+ version = tool_dict .get ("version" )
548+ available_versions = tool_dict .get ("available_versions" , [])
549+
534550 self ._action_schemas [action_key ] = tool_dict
535551 self ._actions_data [action_key ] = {
536552 "display_name" : display_name ,
537553 "action_fields" : [],
538554 "file_upload_fields" : set (),
555+ "version" : version ,
556+ "available_versions" : available_versions ,
539557 }
540558 continue
541559
542560 if flat_schema is None :
543561 logger .warning (f"Flat schema is None for action key: { action_key } " )
544562 # Still add the action but with empty fields so the UI doesn't break
563+ # Extract version information from the tool
564+ version = tool_dict .get ("version" )
565+ available_versions = tool_dict .get ("available_versions" , [])
566+
545567 self ._action_schemas [action_key ] = tool_dict
546568 self ._actions_data [action_key ] = {
547569 "display_name" : display_name ,
548570 "action_fields" : [],
549571 "file_upload_fields" : set (),
572+ "version" : version ,
573+ "available_versions" : available_versions ,
550574 }
551575 continue
552576
@@ -619,20 +643,32 @@ def _populate_actions_data(self):
619643 clean_field_name = p_name .replace ("[0]" , "" )
620644 self ._bool_variables .add (clean_field_name )
621645
646+ # Extract version information from the tool
647+ version = tool_dict .get ("version" )
648+ available_versions = tool_dict .get ("available_versions" , [])
649+
622650 self ._action_schemas [action_key ] = tool_dict
623651 self ._actions_data [action_key ] = {
624652 "display_name" : display_name ,
625653 "action_fields" : action_fields ,
626654 "file_upload_fields" : file_upload_fields ,
655+ "version" : version ,
656+ "available_versions" : available_versions ,
627657 }
628658
629659 except (KeyError , TypeError , ValueError ) as flatten_error :
630660 logger .error (f"flatten_schema failed for { action_key } : { flatten_error } " )
661+ # Extract version information from the tool
662+ version = tool_dict .get ("version" )
663+ available_versions = tool_dict .get ("available_versions" , [])
664+
631665 self ._action_schemas [action_key ] = tool_dict
632666 self ._actions_data [action_key ] = {
633667 "display_name" : display_name ,
634668 "action_fields" : [],
635669 "file_upload_fields" : set (),
670+ "version" : version ,
671+ "available_versions" : available_versions ,
636672 }
637673 continue
638674
@@ -2507,12 +2543,23 @@ def execute_action(self):
25072543
25082544 arguments [final_field_name ] = value
25092545
2510- # Execute using new SDK
2511- result = composio .tools .execute (
2512- slug = action_key ,
2513- arguments = arguments ,
2514- user_id = self .entity_id ,
2515- )
2546+ # Get the version from the action data
2547+ version = self ._actions_data .get (action_key , {}).get ("version" )
2548+ if version :
2549+ logger .info (f"Executing { action_key } with version: { version } " )
2550+
2551+ # Execute using new SDK with version parameter
2552+ execute_params = {
2553+ "slug" : action_key ,
2554+ "arguments" : arguments ,
2555+ "user_id" : self .entity_id ,
2556+ }
2557+
2558+ # Only add version if it's available
2559+ if version :
2560+ execute_params ["version" ] = version
2561+
2562+ result = composio .tools .execute (** execute_params )
25162563
25172564 if isinstance (result , dict ) and "successful" in result :
25182565 if result ["successful" ]:
0 commit comments