Class ReplayPlugin
java.lang.Object
com.google.adk.plugins.BasePlugin
com.google.adk.plugins.ReplayPlugin
- All Implemented Interfaces:
Plugin
Plugin for replaying ADK agent interactions from recordings.
-
Field Summary
Fields inherited from class BasePlugin
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.CompletableafterRunCallback(InvocationContext invocationContext) Callback executed after an ADK runner run has completed.io.reactivex.rxjava3.core.Maybe<LlmResponse> beforeModelCallback(CallbackContext callbackContext, LlmRequest.Builder llmRequest) Callback executed before a request is sent to the model.io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> beforeRunCallback(InvocationContext invocationContext) Callback executed before the ADK runner runs.beforeToolCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext) Callback executed before a tool is called.Methods inherited from class BasePlugin
getNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Plugin
afterAgentCallback, afterModelCallback, afterToolCallback, beforeAgentCallback, close, onEventCallback, onModelErrorCallback, onToolErrorCallback, onUserMessageCallbackModifier and TypeMethodDescriptiondefault io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> afterAgentCallback(BaseAgent agent, CallbackContext callbackContext) Callback executed after an agent's primary logic has completed.default io.reactivex.rxjava3.core.Maybe<LlmResponse> afterModelCallback(CallbackContext callbackContext, LlmResponse llmResponse) Callback executed after a response is received from the model.afterToolCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext, Map<String, Object> result) Callback executed after a tool has been called.default io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> beforeAgentCallback(BaseAgent agent, CallbackContext callbackContext) Callback executed before an agent's primary logic is invoked.default io.reactivex.rxjava3.core.Completableclose()Method executed when the runner is closed.default io.reactivex.rxjava3.core.Maybe<Event> onEventCallback(InvocationContext invocationContext, Event event) Callback executed after an event is yielded from runner.default io.reactivex.rxjava3.core.Maybe<LlmResponse> onModelErrorCallback(CallbackContext callbackContext, LlmRequest.Builder llmRequest, Throwable error) Callback executed when a model call encounters an error.onToolErrorCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext, Throwable error) Callback executed when a tool call encounters an error.default io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> onUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage) Callback executed when a user message is received before an invocation starts.
-
Constructor Details
-
ReplayPlugin
public ReplayPlugin() -
ReplayPlugin
-
-
Method Details
-
beforeRunCallback
public io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content> beforeRunCallback(InvocationContext invocationContext) Description copied from interface:PluginCallback executed before the ADK runner runs.- Parameters:
invocationContext- The context for the entire invocation.- Returns:
- An optional Content to halt execution. Returning Empty to proceed normally.
-
beforeModelCallback
public io.reactivex.rxjava3.core.Maybe<LlmResponse> beforeModelCallback(CallbackContext callbackContext, LlmRequest.Builder llmRequest) Description copied from interface:PluginCallback executed before a request is sent to the model.- Parameters:
callbackContext- The context for the current agent call.llmRequest- The mutable request builder, allowing modification of the request before it is sent to the model.- Returns:
- An optional LlmResponse to trigger an early exit. Returning Empty to proceed normally.
-
beforeToolCallback
public io.reactivex.rxjava3.core.Maybe<Map<String,Object>> beforeToolCallback(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext) Description copied from interface:PluginCallback executed before a tool is called.- Parameters:
tool- The tool instance that is about to be executed.toolArgs- The dictionary of arguments to be used for invoking the tool.toolContext- The context specific to the tool execution.- Returns:
- An optional Map to stop the tool execution and return this response immediately. Returning Empty to proceed normally.
-
afterRunCallback
Description copied from interface:PluginCallback executed after an ADK runner run has completed.- Parameters:
invocationContext- The context for the entire invocation.
-