Skip to content

Commit d22b8bf

Browse files
seanzhougooglecopybara-github
authored andcommitted
chore: Clarify how to use adk built-in tool in instruction
PiperOrigin-RevId: 818987709
1 parent dfb8638 commit d22b8bf

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

contributing/samples/adk_agent_builder_assistant/instruction_embedded.template

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,43 @@ Always reference this schema when creating configurations to ensure compliance.
129129
* **Remember**: Always extract just the folder name after the last slash/separator
130130
- No function declarations in YAML (handled automatically by ADK)
131131

132+
**🚨 CRITICAL: Built-in Tools vs Custom Tools**
133+
134+
**ADK Built-in Tools** (use directly, NO custom Python file needed):
135+
- **Naming**: Use simple name WITHOUT dots (e.g., `google_search`, NOT `google.adk.tools.google_search`)
136+
- **No custom code**: Do NOT create Python files for built-in tools
137+
- **Available built-in tools**:
138+
* `google_search` - Google Search tool
139+
* `enterprise_web_search` - Enterprise web search
140+
* `google_maps_grounding` - Google Maps grounding
141+
* `url_context` - URL context fetching
142+
* `VertexAiSearchTool` - Vertex AI Search (class name)
143+
* `exit_loop` - Exit loop control
144+
* `get_user_choice` - User choice interaction
145+
* `load_artifacts` - Load artifacts
146+
* `load_memory` - Load memory
147+
* `preload_memory` - Preload memory
148+
* `transfer_to_agent` - Transfer to another agent
149+
150+
**Example - Built-in Tool Usage (CORRECT):**
151+
```yaml
152+
tools:
153+
- name: google_search
154+
- name: url_context
155+
```
156+
157+
**Example - Built-in Tool Usage (WRONG):**
158+
```yaml
159+
tools:
160+
- name: cb.tools.google_search_tool.google_search_tool # ❌ WRONG - treating built-in as custom
161+
```
162+
**DO NOT create Python files like `tools/google_search_tool.py` for built-in tools!**
163+
164+
**Custom Tools** (require Python implementation):
165+
- **Naming**: Use dotted path: `{{project_folder_name}}.tools.{{module_name}}.{{function_name}}`
166+
- **Require Python file**: Must create actual Python file in `tools/` directory
167+
- **Example**: `my_project.tools.dice_tool.roll_dice` → requires `tools/dice_tool.py` with `roll_dice()` function
168+
132169
**TOOL IMPLEMENTATION STRATEGY:**
133170
- **For simple/obvious tools**: Implement them directly with actual working code
134171
* Example: dice rolling, prime checking, basic math, file operations

0 commit comments

Comments
 (0)