diff --git a/contributing/samples/adk_agent_builder_assistant/agent_builder_assistant.py b/contributing/samples/adk_agent_builder_assistant/agent_builder_assistant.py index a1b38fbb..4bb6d592 100644 --- a/contributing/samples/adk_agent_builder_assistant/agent_builder_assistant.py +++ b/contributing/samples/adk_agent_builder_assistant/agent_builder_assistant.py @@ -26,6 +26,7 @@ from google.adk.tools import AgentTool from google.adk.tools import FunctionTool from google.genai import types +from .sub_agents.adk_knowledge_agent import create_adk_knowledge_agent from .sub_agents.google_search_agent import create_google_search_agent from .sub_agents.url_context_agent import create_url_context_agent from .tools.cleanup_unused_files import cleanup_unused_files @@ -71,9 +72,14 @@ class AgentBuilderAssistant: # - Maintains compatibility with existing ADK tool ecosystem # Built-in ADK tools wrapped as sub-agents + adk_knowledge_agent = create_adk_knowledge_agent() google_search_agent = create_google_search_agent() url_context_agent = create_url_context_agent() - agent_tools = [AgentTool(google_search_agent), AgentTool(url_context_agent)] + agent_tools = [ + AgentTool(adk_knowledge_agent), + AgentTool(google_search_agent), + AgentTool(url_context_agent), + ] # CUSTOM FUNCTION TOOLS: Agent Builder specific capabilities # diff --git a/contributing/samples/adk_agent_builder_assistant/instruction_embedded.template b/contributing/samples/adk_agent_builder_assistant/instruction_embedded.template index f4836a2a..4cb61d8e 100644 --- a/contributing/samples/adk_agent_builder_assistant/instruction_embedded.template +++ b/contributing/samples/adk_agent_builder_assistant/instruction_embedded.template @@ -194,6 +194,9 @@ Always reference this schema when creating configurations to ensure compliance. ### ADK Knowledge and Research Tools +#### Remote Semantic Search +- **adk_knowledge_agent**: Search ADK knowledge base for ADK examples, patterns, and documentation + #### Web-based Research - **google_search_agent**: Search web for ADK examples, patterns, and documentation (returns full page content as results) - **url_context_agent**: Fetch content from specific URLs when mentioned in search results or user queries (use only when specific URLs need additional fetching) @@ -207,8 +210,10 @@ Always reference this schema when creating configurations to ensure compliance. * Follow up with **read_files** to get complete file contents **Research Workflow for ADK Questions:** +Mainly rely on **adk_knowledge_agent** for ADK questions. Use other tools only when the knowledge agent doesn't have enough information. + 1. **search_adk_source** - Find specific code patterns with regex -2. **read_files** - Read complete source files for detailed analysis +2. **read_files** - Read complete source files for detailed analysis 3. **google_search_agent** - Find external examples and documentation 4. **url_context_agent** - Fetch specific GitHub files or documentation pages @@ -224,6 +229,10 @@ Always reference this schema when creating configurations to ensure compliance. **Research Tool Usage Patterns:** +**Default Research Tool:** +Use **adk_knowledge_agent** as the primary research tool for ADK questions. +Use other tools only when the knowledge agent doesn't have enough information. + **For ADK Code Questions (NEW - Preferred Method):** 1. **search_adk_source** - Find exact code patterns: * Class definitions: `"class FunctionTool"` or `"class.*Agent"` diff --git a/contributing/samples/adk_agent_builder_assistant/sub_agents/__init__.py b/contributing/samples/adk_agent_builder_assistant/sub_agents/__init__.py index af422f96..e0340013 100644 --- a/contributing/samples/adk_agent_builder_assistant/sub_agents/__init__.py +++ b/contributing/samples/adk_agent_builder_assistant/sub_agents/__init__.py @@ -14,7 +14,12 @@ """Sub-agents for Agent Builder Assistant.""" +from .adk_knowledge_agent import create_adk_knowledge_agent from .google_search_agent import create_google_search_agent from .url_context_agent import create_url_context_agent -__all__ = ['create_google_search_agent', 'create_url_context_agent'] +__all__ = [ + 'create_adk_knowledge_agent', + 'create_google_search_agent', + 'create_url_context_agent', +] diff --git a/contributing/samples/adk_agent_builder_assistant/sub_agents/adk_knowledge_agent.py b/contributing/samples/adk_agent_builder_assistant/sub_agents/adk_knowledge_agent.py new file mode 100644 index 00000000..c95ff018 --- /dev/null +++ b/contributing/samples/adk_agent_builder_assistant/sub_agents/adk_knowledge_agent.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Sub-agent for ADK Knowledge.""" + +from google.adk.agents.llm_agent import Agent +from google.adk.agents.remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH +from google.adk.agents.remote_a2a_agent import RemoteA2aAgent + + +def create_adk_knowledge_agent() -> Agent: + """Create a sub-agent that only uses google_search tool.""" + return RemoteA2aAgent( + name="adk_knowledge_agent", + description=( + "Agent for performing Vertex AI Search to find ADK knowledge and" + " documentation" + ), + agent_card=( + f"https://adk-agent-builder-knowledge-service-654646711756.us-central1.run.app/a2a/adk_knowledge_agent{AGENT_CARD_WELL_KNOWN_PATH}" + ), + )