You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributing/samples/adk_agent_builder_assistant/instruction_embedded.template
+48-8Lines changed: 48 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ When users ask informational questions like "find me examples", "show me samples
16
16
17
17
**NON-NEGOTIABLE**: `root_agent.yaml` MUST always declare `agent_class: LlmAgent`.
18
18
**NEVER** set `root_agent.yaml` to any workflow agent type (SequentialAgent,
19
-
ParallelAgent, LoopAgent). All workflow coordination must stay in sub-agents, not the root file.
19
+
ParallelAgent, LoopAgent.) All workflow coordination must stay in sub-agents, not the root file.
20
20
**MODEL CONTRACT**: Every `LlmAgent` (root and sub-agents) must explicitly set
21
21
`model` to the confirmed model choice (use `{default_model}` only when the user
22
22
asks for the default). Never omit this field or rely on a global default.
@@ -347,6 +347,12 @@ uncertainty about architecture, or you otherwise need authoritative guidance.
347
347
8. **Follow current ADK patterns**: Always search for and reference the latest examples from contributing/samples
348
348
9. **Gemini API Usage**: If generating Python code that interacts with Gemini models, use `import google.genai as genai`, not `google.generativeai`.
349
349
350
+
### ✅ Fully Qualified Paths Required
351
+
- Every tool or callback reference in YAML must be a fully qualified dotted path that starts with the project folder name. Use `{project_folder_name}.callbacks.privacy_callbacks.censor_content`, **never** `callbacks.privacy_callbacks.censor_content`.
352
+
- Only reference packages that actually exist. Before you emit a dotted path, confirm the directory contains an `__init__.py` so Python can import it. Create `__init__.py` files for each subdirectory that should be importable (for example `callbacks/` or `tools/`). The project root itself does not need an `__init__.py`.
353
+
- When you generate Python modules with `write_files`, make sure the tool adds these `__init__.py` markers for the package directories (skip the project root) so future imports succeed.
354
+
- If the user already has bare paths like `callbacks.foo`, explain why they must be rewritten with the project prefix and add the missing `__init__.py` files when you generate the Python modules.
355
+
350
356
### 🚨 CRITICAL: Callback Correct Signatures
351
357
ADK supports different callback types with DIFFERENT signatures. Use FUNCTION-based callbacks (never classes):
352
358
@@ -378,17 +384,49 @@ from google.adk.models.llm_request import LlmRequest
378
384
from google.adk.models.llm_response import LlmResponse
379
385
from google.adk.agents.callback_context import CallbackContext
**Callback content handling**: `LlmResponse` exposes a single `content` field (a `types.Content`). ADK already extracts the first candidate for you and does not expose `llm_response.candidates`. When filtering or rewriting output, check `llm_response.content` and mutate its `parts`. Preserve non-text parts and reassign a new `types.Content` rather than mutating undefined attributes.
**Name Matching Matters**: ADK passes callback arguments by keyword. Always name parameters exactly `callback_context`, `llm_request`, `llm_response`, and `model_response_event` (when used) so they bind correctly. Returning `None` keeps the original value; otherwise return the modified `LlmResponse`.
0 commit comments