Class PluginManager
java.lang.Object
com.google.adk.plugins.PluginManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a registered plugin by its name.voidregisterPlugin(BasePlugin plugin) Registers a new plugin.io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runAfterAgentCallback(BaseAgent agent, CallbackContext callbackContext) io.reactivex.rxjava3.core.Maybe<LlmResponse> runAfterModelCallback(CallbackContext callbackContext, LlmResponse llmResponse) io.reactivex.rxjava3.core.CompletablerunAfterRunCallback(InvocationContext invocationContext) runAfterToolCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext, Map<String, Object> result) io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runBeforeAgentCallback(BaseAgent agent, CallbackContext callbackContext) io.reactivex.rxjava3.core.Maybe<LlmResponse> runBeforeModelCallback(CallbackContext callbackContext, LlmRequest llmRequest) io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runBeforeRunCallback(InvocationContext invocationContext) runBeforeToolCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext) io.reactivex.rxjava3.core.Maybe<Event> runOnEventCallback(InvocationContext invocationContext, Event event) io.reactivex.rxjava3.core.Maybe<LlmResponse> runOnModelErrorCallback(CallbackContext callbackContext, LlmRequest llmRequest, Throwable error) runOnToolErrorCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext, Throwable error) io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> runOnUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage)
-
Constructor Details
-
PluginManager
-
PluginManager
public PluginManager()
-
-
Method Details
-
registerPlugin
Registers a new plugin.- Parameters:
plugin- The plugin instance to register.- Throws:
IllegalArgumentException- If a plugin with the same name is already registered.
-
getPlugin
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
-
runAfterToolCallback
-
runOnToolErrorCallback
-