MCPcopy Index your code
hub / github.com/google/adk-python / _instantiate_extra_plugins

Method _instantiate_extra_plugins

src/google/adk/cli/api_server.py:761–777  ·  view source on GitHub ↗

Instantiate extra plugins from the configured list. Returns: List of instantiated BasePlugin objects.

(self)

Source from the content-addressed store, hash-verified

759 )
760
761 def _instantiate_extra_plugins(self) -> list[BasePlugin]:
762 """Instantiate extra plugins from the configured list.
763
764 Returns:
765 List of instantiated BasePlugin objects.
766 """
767 extra_plugins_instances = []
768 for qualified_name in self.extra_plugins:
769 try:
770 plugin_obj = self._import_plugin_object(qualified_name)
771 if isinstance(plugin_obj, BasePlugin):
772 extra_plugins_instances.append(plugin_obj)
773 elif issubclass(plugin_obj, BasePlugin):
774 extra_plugins_instances.append(plugin_obj(name=qualified_name))
775 except Exception as e:
776 logger.error("Failed to load plugin %s: %s", qualified_name, e)
777 return extra_plugins_instances
778
779 def _import_plugin_object(self, qualified_name: str) -> Any:
780 """Import a plugin object (class or instance) from a fully qualified name.

Callers 1

get_runner_asyncMethod · 0.95

Calls 3

_import_plugin_objectMethod · 0.95
appendMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected