Class PluginManager

java.lang.Object
com.google.adk.plugins.PluginManager

public class PluginManager extends Object
Manages the registration and execution of plugins.

The PluginManager is an internal class that orchestrates the invocation of plugin callbacks at key points in the SDK's execution lifecycle.

  • Constructor Details

    • PluginManager

      public PluginManager(List<BasePlugin> plugins)
    • PluginManager

      public PluginManager()
  • Method Details

    • registerPlugin

      public void registerPlugin(BasePlugin plugin)
      Registers a new plugin.
      Parameters:
      plugin - The plugin instance to register.
      Throws:
      IllegalArgumentException - If a plugin with the same name is already registered.
    • getPlugin

      public Optional<BasePlugin> getPlugin(String pluginName)
      Retrieves a registered plugin by its name.
      Parameters:
      pluginName - The name of the plugin to retrieve.
      Returns:
      The plugin instance if found, otherwise Optional.empty().
    • runOnUserMessageCallback

      public io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runOnUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage)
    • runBeforeRunCallback

      public io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runBeforeRunCallback(InvocationContext invocationContext)
    • runAfterRunCallback

      public io.reactivex.rxjava3.core.Completable runAfterRunCallback(InvocationContext invocationContext)
    • runOnEventCallback

      public io.reactivex.rxjava3.core.Maybe<Event> runOnEventCallback(InvocationContext invocationContext, Event event)
    • runBeforeAgentCallback

      public io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runBeforeAgentCallback(BaseAgent agent, CallbackContext callbackContext)
    • runAfterAgentCallback

      public io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runAfterAgentCallback(BaseAgent agent, CallbackContext callbackContext)
    • runBeforeModelCallback

      public io.reactivex.rxjava3.core.Maybe<LlmResponse> runBeforeModelCallback(CallbackContext callbackContext, LlmRequest llmRequest)
    • runAfterModelCallback

      public io.reactivex.rxjava3.core.Maybe<LlmResponse> runAfterModelCallback(CallbackContext callbackContext, LlmResponse llmResponse)
    • runOnModelErrorCallback

      public io.reactivex.rxjava3.core.Maybe<LlmResponse> runOnModelErrorCallback(CallbackContext callbackContext, LlmRequest llmRequest, Throwable error)
    • runBeforeToolCallback

      public io.reactivex.rxjava3.core.Maybe<Map<String,Object>> runBeforeToolCallback(BaseTool tool, Map<String,Object> toolArgs, ToolContext toolContext)
    • runAfterToolCallback

      public io.reactivex.rxjava3.core.Maybe<Map<String,Object>> runAfterToolCallback(BaseTool tool, Map<String,Object> toolArgs, ToolContext toolContext, Map<String,Object> result)
    • runOnToolErrorCallback

      public io.reactivex.rxjava3.core.Maybe<Map<String,Object>> runOnToolErrorCallback(BaseTool tool, Map<String,Object> toolArgs, ToolContext toolContext, Throwable error)