็™ป้Œฒใ—ใฆๆ‹›ๅพ…ใƒชใƒณใ‚ฏใ‚’ๅ…ฑๆœ‰ใ™ใ‚‹ใจใ€ๅ‹•็”ปๅ†็”Ÿๅ ฑ้…ฌใจ็ดนไป‹ๅ ฑ้…ฌใ‚’็ฒๅพ—ใงใใพใ™ใ€‚

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
ๅ‚ๅŠ  May 2026
284 ใƒ•ใ‚ฉใƒญใƒผไธญ    449 ใƒ•ใ‚กใƒณ
# Practical and Useful Patterns with ADK ## ๐Ÿ“š Load Knowledge On-Demand with ADK Skills Stuffing all knowledge into your agent's instructions blows up token costs. ADK **Skills** let you load workflows and knowledge on-demand โ€” only when relevant โ€” saving tokens while extending capabilities! ๐Ÿš€ ## ๐Ÿ“Œ Title Skills for Agents ## ๐Ÿ”— URL ## ๐Ÿงฉ Overview A Skill is a self-contained unit of functionality that an ADK agent can use to perform a specific task. It packages instructions, references, assets, and scripts, loading them only when the agent needs them. Skills follow a 3-level architecture: - **L1 (Metadata)**: `SKILL.md` frontmatter enables skill discovery - **L2 (Instructions)**: Main instructions in the `SKILL.md` body - **L3 (Resources)**: Supporting materials in `references/`, `assets/`, `scripts/` By loading only when needed, Skills optimize context window usage and minimize token consumption. ## ๐Ÿ›  How to Use **Directory structure:** ``` my_agent/ skills/ code_review/ SKILL.md # Required: metadata + instructions references/ CHECKLIST.md # Detailed review checklist assets/ template.json # Review output template scripts/ # Lint execution script ``` **Python integration:** Import `load_skill_from_dir` from `google.adk.skills` and `skill_toolset` from ` along with `pathlib`. Call `load_skill_from_dir()` with the path `pathlib.Path(__file__).parent / "skills" / "code_review"` to load the skill from its directory. Then create a `skill_toolset.SkillToolset(skills=[code_review_skill])` and pass it to the `Agent` constructor via the `tools` parameter. The agent is created with `model="gemini-flash-latest"` and `name="dev_assistant"`, gaining on-demand access to the skill through the toolset. ## ๐Ÿ— Practical Usage **Skills for a DevOps agent:** ``` skills/ code_review/ SKILL.md # "Code Review Checklist" references/ CHECKLIST.md # Detailed review criteria release/ SKILL.md # "Release Procedure" references/ PROCEDURE.md # Step-by-step release flow assets/ changelog.tmpl # CHANGELOG template incident/ SKILL.md # "Incident Response" references/ RUNBOOK.md # Incident response runbook scripts/ # Slack notification script ``` The agent loads `code_review` only when asked to review code, and `release` only when asked to deploy. No need to keep all skills loaded at all times, dramatically reducing token consumption. **Inline skills (TypeScript):** ```typescript const releaseSkill: Skill = { frontmatter: { name: 'release-procedure', description: 'Standard release procedure with checklist', }, instructions: "Follow the release checklist step by step...", resources: { references: { 'checklist.md': '1. Run tests\n2. Update version\n3. Create tag...', }, }, }; const skillTools = new SkillToolset([releaseSkill]); ``` ## ๐Ÿ’ก Use Cases - ๐Ÿ“‹ **Code review checklists**: Load detailed review criteria only when reviews are requested - ๐Ÿš€ **Release procedures**: Load step-by-step deployment guides and templates only at release time - ๐Ÿ”ง **Troubleshooting**: Load runbooks and notification scripts only during incidents - ๐Ÿ“ **Document authoring**: Load type-specific templates and guidelines per document type - ๐ŸŽ“ **Employee onboarding**: Load relevant knowledge base sections based on questions ## โš ๏ธ Caveats - Skills are experimental (Python v1.25.0+, TypeScript v0.6.1+, Go v1.2.0+) - `SKILL.md` is required; include `name` and `description` in frontmatter - Skill discovery accuracy depends on description quality โ€” write clear descriptions - Large resource files impact token consumption; keep them minimal - Be mindful of script execution permissions and security ## โœจ Closing Skills implement "load knowledge only when needed" in an elegant way. Instead of cramming everything into instructions, modularize capabilities as Skills to keep token costs low while extending your agent's abilities infinitely. DevOps, customer support, education โ€” the pattern applies everywhere! #ADK# #AIAgent#
ใ‚‚ใฃใจ่ฆ‹ใ‚‹