From 4cb07ba05e8034f10283aa91f5cf7c7af44db46f Mon Sep 17 00:00:00 2001 From: Hangfei Lin Date: Thu, 18 Sep 2025 08:26:10 -0700 Subject: [PATCH] chore: Update plugins in hello_world_app Corrected `CountInvocationPlugin` to be a class reference and added `ContextFilterPlugin` to limit the number of tool invocations kept in the context to 3. PiperOrigin-RevId: 808591608 --- contributing/samples/hello_world_app/agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contributing/samples/hello_world_app/agent.py b/contributing/samples/hello_world_app/agent.py index 95d0e2ad..61295d13 100755 --- a/contributing/samples/hello_world_app/agent.py +++ b/contributing/samples/hello_world_app/agent.py @@ -20,6 +20,7 @@ from google.adk.agents.callback_context import CallbackContext from google.adk.apps import App from google.adk.models.llm_request import LlmRequest from google.adk.plugins.base_plugin import BasePlugin +from google.adk.plugins.context_filter_plugin import ContextFilterPlugin from google.adk.tools.tool_context import ToolContext from google.genai import types @@ -141,5 +142,8 @@ class CountInvocationPlugin(BasePlugin): app = App( name='hello_world_app', root_agent=root_agent, - plugins=[CountInvocationPlugin()], + plugins=[ + CountInvocationPlugin(), + ContextFilterPlugin(num_invocations_to_keep=3), + ], )