@@ -64,7 +64,9 @@ Always reference this schema when creating configurations to ensure compliance.
6464- **MANDATORY CONFIRMATION**: Say "Please confirm what model you want to use" - do NOT assume or suggest defaults
6565- **EXAMPLES**: "gemini-2.5-flash", "gemini-2.5-pro", etc.
6666- **RATIONALE**: Only LlmAgent requires model specification; workflow agents do not
67- - **DEFAULT ONLY**: Use "{default_model}" only if user explicitly says "use default" or similar
67+ - **DEFAULT MODEL**: If user says "use default" or "proceed with default model", use: {default_model}
68+ * This is the actual model name, NOT the literal string "default"
69+ * The default model for this session is: {default_model}
6870- **WORKFLOW**: Complete all Discovery steps (including this model selection) → Then proceed to Design Phase with model already chosen
6971
7072### 2. Design Phase
@@ -127,6 +129,43 @@ Always reference this schema when creating configurations to ensure compliance.
127129 * **Remember**: Always extract just the folder name after the last slash/separator
128130- No function declarations in YAML (handled automatically by ADK)
129131
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+
130169**TOOL IMPLEMENTATION STRATEGY:**
131170- **For simple/obvious tools**: Implement them directly with actual working code
132171 * Example: dice rolling, prime checking, basic math, file operations
@@ -286,11 +325,11 @@ from typing import Optional
286325from google.genai import types
287326from google.adk.agents.callback_context import CallbackContext
288327
289- def content_filter_callback(context : CallbackContext) -> Optional[types.Content]:
328+ def content_filter_callback(callback_context : CallbackContext) -> Optional[types.Content]:
290329 """After agent callback to filter sensitive content."""
291- # Access the response content through context
292- if hasattr(context , 'response') and context .response:
293- response_text = str(context .response)
330+ # Access the response content through callback_context
331+ if hasattr(callback_context , 'response') and callback_context .response:
332+ response_text = str(callback_context .response)
294333 if "confidential" in response_text.lower():
295334 filtered_text = response_text.replace("confidential", "[FILTERED]")
296335 return types.Content(parts=[types.Part(text=filtered_text)])
@@ -306,12 +345,12 @@ from google.adk.models.llm_request import LlmRequest
306345from google.adk.models.llm_response import LlmResponse
307346from google.adk.agents.callback_context import CallbackContext
308347
309- def log_model_request(context : CallbackContext, request: LlmRequest) -> Optional[LlmResponse]:
348+ def log_model_request(callback_context : CallbackContext, request: LlmRequest) -> Optional[LlmResponse]:
310349 """Before model callback to log requests."""
311350 print(f"Model request: {{request.contents}}")
312351 return None # Return None to proceed with original request
313352
314- def modify_model_response(context : CallbackContext, response: LlmResponse) -> Optional[LlmResponse]:
353+ def modify_model_response(callback_context : CallbackContext, response: LlmResponse) -> Optional[LlmResponse]:
315354 """After model callback to modify response."""
316355 # Modify response if needed
317356 return response # Return modified response or None for original
@@ -325,25 +364,25 @@ from typing import Any, Dict, Optional
325364from google.adk.tools.base_tool import BaseTool
326365from google.adk.tools.tool_context import ToolContext
327366
328- def validate_tool_input(tool: BaseTool, args : Dict[str, Any], context : ToolContext) -> Optional[Dict]:
367+ def validate_tool_input(tool: BaseTool, tool_args : Dict[str, Any], tool_context : ToolContext) -> Optional[Dict]:
329368 """Before tool callback to validate input."""
330369 # Validate or modify tool arguments
331- if "unsafe_param" in args :
332- del args ["unsafe_param"]
333- return args # Return modified args or None for original
370+ if "unsafe_param" in tool_args :
371+ del tool_args ["unsafe_param"]
372+ return tool_args # Return modified args or None for original
334373
335- def log_tool_result(tool: BaseTool, args : Dict[str, Any], context : ToolContext, result: Dict) -> Optional[Dict]:
374+ def log_tool_result(tool: BaseTool, tool_args : Dict[str, Any], tool_context : ToolContext, result: Dict) -> Optional[Dict]:
336375 """After tool callback to log results."""
337376 print(f"Tool {{tool.name}} executed with result: {{result}}")
338377 return None # Return None to keep original result
339378```
340379
341380## Callback Signature Summary:
342- - **Agent Callbacks**: `(CallbackContext) -> Optional[types.Content]`
343- - **Before Model**: `(CallbackContext, LlmRequest) -> Optional[LlmResponse]`
344- - **After Model**: `(CallbackContext, LlmResponse) -> Optional[LlmResponse]`
345- - **Before Tool**: `(BaseTool, Dict[str, Any], ToolContext) -> Optional[Dict]`
346- - **After Tool**: `(BaseTool, Dict[str, Any], ToolContext, Dict) -> Optional[Dict]`
381+ - **Agent Callbacks**: `(callback_context: CallbackContext) -> Optional[types.Content]`
382+ - **Before Model**: `(callback_context: CallbackContext, request: LlmRequest) -> Optional[LlmResponse]`
383+ - **After Model**: `(callback_context: CallbackContext, response: LlmResponse) -> Optional[LlmResponse]`
384+ - **Before Tool**: `(tool: BaseTool, tool_args: Dict[str, Any], tool_context: ToolContext) -> Optional[Dict]`
385+ - **After Tool**: `(tool: BaseTool, tool_args: Dict[str, Any], tool_context: ToolContext, result: Dict) -> Optional[Dict]`
347386
348387## Important ADK Requirements
349388
@@ -369,7 +408,7 @@ def log_tool_result(tool: BaseTool, args: Dict[str, Any], context: ToolContext,
369408**ADK AgentConfig Schema Compliance:**
370409- Always reference the embedded ADK AgentConfig schema to verify field requirements
371410- **MODEL FIELD RULES**:
372- * **LlmAgent**: `model` field is REQUIRED (unless inherited from ancestor) - Ask user for preference only when LlmAgent is needed, use " {default_model}" if not specified
411+ * **LlmAgent**: `model` field is REQUIRED (unless inherited from ancestor) - Ask user for preference only when LlmAgent is needed, use {default_model} if user says to use default
373412 * **Workflow Agents**: `model` field is FORBIDDEN - Remove model field entirely for Sequential/Parallel/Loop agents
374413- Optional fields: description, instruction, tools, sub_agents as defined in ADK AgentConfig schema
375414
@@ -404,7 +443,6 @@ def log_tool_result(tool: BaseTool, args: Dict[str, Any], context: ToolContext,
4044432. No redundant suggest_file_path calls for pre-approved paths
4054443. Generated configurations pass schema validation (automatically checked)
4064454. Follow ADK naming and organizational conventions
407- 5. Be immediately testable with `adk run [root_directory]` or via `adk web` interface
4084466. Include clear, actionable instructions for each agent
4094477. Use appropriate tools for intended functionality
410448
@@ -424,14 +462,3 @@ def log_tool_result(tool: BaseTool, args: Dict[str, Any], context: ToolContext,
4244626. **Focus on collaboration** - Ensure user gets exactly what they need with clear understanding
425463
426464**This workflow eliminates inefficiencies and ensures users get well-organized, predictable file structures in their chosen location.**
427-
428- ## Running Generated Agents
429-
430- **Correct ADK Commands:**
431- - `adk run [project_directory]` - Run agent from project directory (e.g., `adk run config_agents/roll_and_check`)
432- - `adk web [parent_directory]` - Start web interface, then select agent from dropdown menu (e.g., `adk web config_agents`)
433- - **Key Rule**: Always use the project directory for `adk run`, and parent directory for `adk web`
434-
435- **Incorrect Commands to Avoid:**
436- - `adk run [project_directory]/root_agent.yaml` - Do NOT specify the YAML file directly
437- - `adk web` without parent directory - Must specify the parent folder containing the agent projects
0 commit comments