Class BasePlugin

java.lang.Object
com.google.adk.plugins.BasePlugin
All Implemented Interfaces:
Plugin
Direct Known Subclasses:
ContextFilterPlugin, GlobalInstructionPlugin, LoggingPlugin, PluginManager, ReplayPlugin

public abstract class BasePlugin extends Object implements Plugin
Base class for creating plugins.

Plugins provide a structured way to intercept and modify agent, tool, and LLM behaviors at critical execution points in a callback manner. While agent callbacks apply to a particular agent, plugins applies globally to all agents added in the runner. Plugins are best used for adding custom behaviors like logging, monitoring, caching, or modifying requests and responses at key stages.

A plugin can implement one or more methods of callbacks, but should not implement the same method of callback for multiple times.

  • Field Details

    • name

      protected final String name
  • Constructor Details

    • BasePlugin

      public BasePlugin(String name)
      Constructs a new plugin with the given name.
      Parameters:
      name - The name of the plugin.
  • Method Details