Skip to content

changed example to plugin - #2177

Draft
JuanCaCoder wants to merge 1 commit into
mainfrom
GlobalInstructionPlugin_example
Draft

changed example to plugin#2177
JuanCaCoder wants to merge 1 commit into
mainfrom
GlobalInstructionPlugin_example

Conversation

@JuanCaCoder

Copy link
Copy Markdown
Collaborator

Changed the code sample to use the GlobalInstructionPlugin.

@JuanCaCoder

Copy link
Copy Markdown
Collaborator Author

📝 Executive Summary

  • Migrates the Python A2A Consuming Quickstart sample from the deprecated Agent.global_instruction parameter to GlobalInstructionPlugin registered via App(plugins=[...]).
  • Aligns the quickstart with the modern ADK application architecture and prevents runtime DeprecationWarning exceptions while preserving global instruction behavior across sub-agents.
  • Target doc: docs/a2a/quickstart-consuming.md (rendered under /a2a/quickstart-consuming/).

🗂️ PR Consolidation & Verification Mapping

PR / Source Reference Original Section New Section Change Description Codebase Verification
docs/a2a/quickstart-consuming.md #### How it works (Snippet) #### How it works (Snippet) Removed deprecated global_instruction from root_agent = Agent(...); added App(name="a2a_basic", root_agent=root_agent, plugins=[GlobalInstructionPlugin(...)]). ✅ PASS
google/adk/plugins/global_instruction_plugin.py:L58-L85
google/adk/apps/app.py:L53-L83
docs/a2a/quickstart-consuming.md #### How it works (Prose) #### How it works (Admonition) Added !!! note "Global instructions via Plugins" note explaining deprecation of Agent.global_instruction and pointing to GlobalInstructionPlugin. ✅ PASS
google/adk/agents/llm_agent.py:L758-L766
docs/agents/llm-agents.md:L206-L210
docs/a2a/quickstart-consuming.md Introductory text Introductory text Added link to GlobalInstructionPlugin under /plugins/#prebuilt-plugins. ✅ PASS
docs/plugins/index.md:L67-L68

🔍 Technical Verification Report

  1. GlobalInstructionPlugin Implementation & Lifecycle:

    • Source: src/google/adk/plugins/global_instruction_plugin.py:L58-L115
    • Verified: GlobalInstructionPlugin inherits from BasePlugin. Its constructor accepts global_instruction: Union[str, InstructionProvider] = "" and name: str = "global_instruction". In before_model_callback, it resolves static strings or InstructionProvider callables and prepends the instruction to llm_request.config.system_instruction.
  2. Agent.global_instruction Deprecation:

    • Source: src/google/adk/agents/llm_agent.py:L288-L299, L758-L766
    • Verified: The field is marked deprecated in docstrings and emits a runtime DeprecationWarning ("global_instruction field is deprecated and will be removed in a future version. Use GlobalInstructionPlugin instead for the same functionality at the App level.").
  3. App Container Architecture:

    • Source: src/google/adk/apps/app.py:L53-L83
    • Verified: App requires name: str and root_agent: Union[BaseAgent, Any, None]. It accepts plugins: list[BasePlugin] = Field(default_factory=list), which applies registered plugins application-wide across all local and remote sub-agents.
  4. Runner plugins Deprecation:

    • Source: src/google/adk/runners.py:L285-L286, L386-L387
    • Verified: Passing plugins directly to Runner is deprecated in favor of App(plugins=[...]), confirming App as the canonical entry point for plugin registration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant