mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix(skill)!: coloate default skill SI with skilltoolset
PiperOrigin-RevId: 870017182
This commit is contained in:
committed by
Copybara-Service
parent
21be6adcb8
commit
fc1f1db005
@@ -19,7 +19,6 @@ import pathlib
|
||||
from google.adk import Agent
|
||||
from google.adk.skills import load_skill_from_dir
|
||||
from google.adk.skills import models
|
||||
from google.adk.skills.prompt import DEFAULT_SKILL_SYSTEM_INSTRUCTION
|
||||
from google.adk.tools import skill_toolset
|
||||
|
||||
greeting_skill = models.Skill(
|
||||
@@ -53,7 +52,7 @@ root_agent = Agent(
|
||||
model="gemini-2.5-flash",
|
||||
name="skill_user_agent",
|
||||
description="An agent that can use specialized skills.",
|
||||
instruction=DEFAULT_SKILL_SYSTEM_INSTRUCTION,
|
||||
instruction=skill_toolset.DEFAULT_SKILL_SYSTEM_INSTRUCTION,
|
||||
tools=[
|
||||
my_skill_toolset,
|
||||
],
|
||||
|
||||
@@ -18,7 +18,6 @@ from .models import Frontmatter
|
||||
from .models import Resources
|
||||
from .models import Script
|
||||
from .models import Skill
|
||||
from .prompt import DEFAULT_SKILL_SYSTEM_INSTRUCTION
|
||||
from .utils import load_skill_from_dir
|
||||
|
||||
__all__ = [
|
||||
@@ -26,6 +25,5 @@ __all__ = [
|
||||
"Resources",
|
||||
"Script",
|
||||
"Skill",
|
||||
"DEFAULT_SKILL_SYSTEM_INSTRUCTION",
|
||||
"load_skill_from_dir",
|
||||
]
|
||||
|
||||
@@ -21,21 +21,6 @@ from typing import List
|
||||
|
||||
from . import models
|
||||
|
||||
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.
|
||||
|
||||
Skills are folders of instructions and resources that extend your capabilities for specialized tasks. Each skill folder contains:
|
||||
- **SKILL.md** (required): The main instruction file with skill metadata and detailed markdown instructions.
|
||||
- **references/** (Optional): Additional documentation or examples for skill usage.
|
||||
- **assets/** (Optional): Templates, scripts or other resources used by the skill.
|
||||
|
||||
This is very important:
|
||||
|
||||
1. Use the `list_skills` tool to discover available skills.
|
||||
2. If a skill seems relevant to the current user query, you MUST use the `load_skill` tool with `name="<SKILL_NAME>"` to read its full instructions before proceeding.
|
||||
3. Once you have read the instructions, follow them exactly as documented before replying to the user. For example, If the instruction lists multiple steps, please make sure you complete all of them in order.
|
||||
4. The `load_skill_resource` tool is for viewing files within a skill's directory (e.g., `references/*`, `assets/*`). Do NOT use other tools to access these files.
|
||||
"""
|
||||
|
||||
|
||||
def format_skills_as_xml(skills: List[models.Frontmatter]) -> str:
|
||||
"""Formats available skills into a standard XML string.
|
||||
|
||||
@@ -29,6 +29,21 @@ from .base_tool import BaseTool
|
||||
from .base_toolset import BaseToolset
|
||||
from .tool_context import ToolContext
|
||||
|
||||
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.
|
||||
|
||||
Skills are folders of instructions and resources that extend your capabilities for specialized tasks. Each skill folder contains:
|
||||
- **SKILL.md** (required): The main instruction file with skill metadata and detailed markdown instructions.
|
||||
- **references/** (Optional): Additional documentation or examples for skill usage.
|
||||
- **assets/** (Optional): Templates, scripts or other resources used by the skill.
|
||||
|
||||
This is very important:
|
||||
|
||||
1. Use the `list_skills` tool to discover available skills.
|
||||
2. If a skill seems relevant to the current user query, you MUST use the `load_skill` tool with `name="<SKILL_NAME>"` to read its full instructions before proceeding.
|
||||
3. Once you have read the instructions, follow them exactly as documented before replying to the user. For example, If the instruction lists multiple steps, please make sure you complete all of them in order.
|
||||
4. The `load_skill_resource` tool is for viewing files within a skill's directory (e.g., `references/*`, `assets/*`). Do NOT use other tools to access these files.
|
||||
"""
|
||||
|
||||
|
||||
@experimental(FeatureName.SKILL_TOOLSET)
|
||||
class ListSkillsTool(BaseTool):
|
||||
|
||||
Reference in New Issue
Block a user