Skip to content

Commit 35366f4

Browse files
haiyuan-eng-googlecopybara-github
authored andcommitted
feat: Warn when accessing DEFAULT_SKILL_SYSTEM_INSTRUCTION
This change makes DEFAULT_SKILL_SYSTEM_INSTRUCTION raise a UserWarning when accessed, indicating that its content is experimental and subject to change in minor/patch releases. The constant is also made "private" internally. Co-authored-by: Haiyuan Cao <haiyuan@google.com> PiperOrigin-RevId: 875288217
1 parent 3256a67 commit 35366f4

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/google/adk/tools/skill_toolset.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from typing import Any
2525
from typing import Optional
2626
from typing import TYPE_CHECKING
27+
import warnings
2728

2829
from google.genai import types
2930

@@ -46,7 +47,7 @@
4647
_DEFAULT_SCRIPT_TIMEOUT = 300
4748
_MAX_SKILL_PAYLOAD_BYTES = 16 * 1024 * 1024 # 16 MB
4849

49-
DEFAULT_SKILL_SYSTEM_INSTRUCTION = """You can use specialized 'skills' to help you with complex tasks. You MUST use the skill tools to interact with these skills.
50+
_DEFAULT_SKILL_SYSTEM_INSTRUCTION = """You can use specialized 'skills' to help you with complex tasks. You MUST use the skill tools to interact with these skills.
5051
5152
Skills are folders of instructions and resources that extend your capabilities for specialized tasks. Each skill folder contains:
5253
- **SKILL.md** (required): The main instruction file with skill metadata and detailed markdown instructions.
@@ -638,6 +639,19 @@ async def process_llm_request(
638639
skills = self._list_skills()
639640
skills_xml = prompt.format_skills_as_xml(skills)
640641
instructions = []
641-
instructions.append(DEFAULT_SKILL_SYSTEM_INSTRUCTION)
642+
instructions.append(_DEFAULT_SKILL_SYSTEM_INSTRUCTION)
642643
instructions.append(skills_xml)
643644
llm_request.append_instructions(instructions)
645+
646+
647+
def __getattr__(name: str) -> Any:
648+
if name == "DEFAULT_SKILL_SYSTEM_INSTRUCTION":
649+
warnings.warn(
650+
"DEFAULT_SKILL_SYSTEM_INSTRUCTION is experimental. Its content "
651+
"is internal implementation and will change in minor/patch releases "
652+
"to tune agent performance.",
653+
UserWarning,
654+
stacklevel=2,
655+
)
656+
return _DEFAULT_SKILL_SYSTEM_INSTRUCTION
657+
raise AttributeError(f"module {__name__} has no attribute {name}")

tests/unittests/tools/test_skill_toolset.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ async def test_process_llm_request(
327327
assert "skill2" in instructions[1]
328328

329329

330+
def test_default_skill_system_instruction_warning():
331+
with pytest.warns(
332+
UserWarning, match="DEFAULT_SKILL_SYSTEM_INSTRUCTION is experimental"
333+
):
334+
instruction = skill_toolset.DEFAULT_SKILL_SYSTEM_INSTRUCTION
335+
assert "specialized 'skills'" in instruction
336+
337+
330338
def test_duplicate_skill_name_raises(mock_skill1):
331339
skill_dup = mock.create_autospec(models.Skill, instance=True)
332340
skill_dup.name = "skill1"

0 commit comments

Comments
 (0)