Skip to content

Commit 84c1fae

Browse files
xuanyang15copybara-github
authored andcommitted
chore: Introduce the remote A2A ADK Knowledge Agent to Agent Builder Assistant
PiperOrigin-RevId: 815543707
1 parent c6dd444 commit 84c1fae

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

contributing/samples/adk_agent_builder_assistant/agent_builder_assistant.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from google.adk.tools import FunctionTool
2727
from google.genai import types
2828

29+
from .sub_agents.adk_knowledge_agent import create_adk_knowledge_agent
2930
from .sub_agents.google_search_agent import create_google_search_agent
3031
from .sub_agents.url_context_agent import create_url_context_agent
3132
from .tools.cleanup_unused_files import cleanup_unused_files
@@ -71,9 +72,14 @@ def create_agent(
7172
# - Maintains compatibility with existing ADK tool ecosystem
7273

7374
# Built-in ADK tools wrapped as sub-agents
75+
adk_knowledge_agent = create_adk_knowledge_agent()
7476
google_search_agent = create_google_search_agent()
7577
url_context_agent = create_url_context_agent()
76-
agent_tools = [AgentTool(google_search_agent), AgentTool(url_context_agent)]
78+
agent_tools = [
79+
AgentTool(adk_knowledge_agent),
80+
AgentTool(google_search_agent),
81+
AgentTool(url_context_agent),
82+
]
7783

7884
# CUSTOM FUNCTION TOOLS: Agent Builder specific capabilities
7985
#

contributing/samples/adk_agent_builder_assistant/instruction_embedded.template

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ Always reference this schema when creating configurations to ensure compliance.
194194

195195
### ADK Knowledge and Research Tools
196196

197+
#### Remote Semantic Search
198+
- **adk_knowledge_agent**: Search ADK knowledge base for ADK examples, patterns, and documentation
199+
197200
#### Web-based Research
198201
- **google_search_agent**: Search web for ADK examples, patterns, and documentation (returns full page content as results)
199202
- **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.
207210
* Follow up with **read_files** to get complete file contents
208211

209212
**Research Workflow for ADK Questions:**
213+
Mainly rely on **adk_knowledge_agent** for ADK questions. Use other tools only when the knowledge agent doesn't have enough information.
214+
210215
1. **search_adk_source** - Find specific code patterns with regex
211-
2. **read_files** - Read complete source files for detailed analysis
216+
2. **read_files** - Read complete source files for detailed analysis
212217
3. **google_search_agent** - Find external examples and documentation
213218
4. **url_context_agent** - Fetch specific GitHub files or documentation pages
214219

@@ -224,6 +229,10 @@ Always reference this schema when creating configurations to ensure compliance.
224229

225230
**Research Tool Usage Patterns:**
226231

232+
**Default Research Tool:**
233+
Use **adk_knowledge_agent** as the primary research tool for ADK questions.
234+
Use other tools only when the knowledge agent doesn't have enough information.
235+
227236
**For ADK Code Questions (NEW - Preferred Method):**
228237
1. **search_adk_source** - Find exact code patterns:
229238
* Class definitions: `"class FunctionTool"` or `"class.*Agent"`

contributing/samples/adk_agent_builder_assistant/sub_agents/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515
"""Sub-agents for Agent Builder Assistant."""
1616

17+
from .adk_knowledge_agent import create_adk_knowledge_agent
1718
from .google_search_agent import create_google_search_agent
1819
from .url_context_agent import create_url_context_agent
1920

20-
__all__ = ['create_google_search_agent', 'create_url_context_agent']
21+
__all__ = [
22+
'create_adk_knowledge_agent',
23+
'create_google_search_agent',
24+
'create_url_context_agent',
25+
]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Sub-agent for ADK Knowledge."""
16+
17+
from google.adk.agents.llm_agent import Agent
18+
from google.adk.agents.remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH
19+
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent
20+
21+
22+
def create_adk_knowledge_agent() -> Agent:
23+
"""Create a sub-agent that only uses google_search tool."""
24+
return RemoteA2aAgent(
25+
name="adk_knowledge_agent",
26+
description=(
27+
"Agent for performing Vertex AI Search to find ADK knowledge and"
28+
" documentation"
29+
),
30+
agent_card=(
31+
f"https://adk-agent-builder-knowledge-service-654646711756.us-central1.run.app/a2a/adk_knowledge_agent{AGENT_CARD_WELL_KNOWN_PATH}"
32+
),
33+
)

0 commit comments

Comments
 (0)