Automated progressive skill discovery and agent patching for ADK
Project description
ADK Progressive Skills
Automate skill discovery and dynamically inject them into your ADK (Agent Development Kit) agents without manual loading or codebase bloat.
Why This Library Is Important
When building agentic applications using Google’s Agent Development Kit, agents often require specialized knowledge and workflows (skills). Traditionally, skills have to be explicitly loaded and mounted on the agent’s tool list, leading to several drawbacks:
- Code Coupling: Agent scripts become coupled to specific skill files, forcing you to modify code whenever you add or modify a skill.
- Context Bloat: Hardcoding all skills into a single agent’s tools list wastes context window tokens and model attention.
- Manual Overhead: Developers must write verbose boilerplates to manually import, instantiate, and pass skills as tools during agent initialization.
adk-progressive-skills solves this by introducing Progressive Skill Discovery. By simply importing this library at the top of your agent script, skills are automatically scanned, prioritized by precedence, and seamlessly injected into your agent’s tools on instantiation.
How Progressive Discovery Works
This library automatically hooks (monkeypatches) the ADK agent constructors (google.adk.agents.llm_agent.LlmAgent and google.adk.agents.Agent). When an agent is initialized:
- Precedence-Aware Scanning: It scans four paths in increasing order of precedence (lowest first, meaning higher precedence paths override duplicate skills from lower ones):
~/.gemini/jetski/skills(Global Jetski skills)~/.gemini/config/skills(Global User configuration skills)~/.agents/skills(User home directory skills).agents/skills(Local workspace directory skills - highest precedence)
- Conflict Resolution: If a skill with the same name exists in multiple search folders, the library keeps only the one from the higher-precedence folder.
- Graceful Loading: If any individual skill folder fails validation or contains errors, the library reports a warning using
warnings.warninstead of crashing your agent. - Dynamic Toolset Injection: It packages the discovered skills inside a
SkillToolsetand appends it to the agent’stoolsparameter, preventing duplicate toolset additions.
Architecture & Workflows
Architecture/Design
graph TD
A[import adk_progressive_skills] --> B(apply_patch)
B --> C[Monkeypatch LlmAgent.__init__]
C --> D[LlmAgent Instantiated]
D --> E[discover_skills]
E --> F[Scan paths in precedence order]
F --> G[~/.gemini/jetski/skills]
F --> H[~/.gemini/config/skills]
F --> I[~/.agents/skills]
F --> J[.agents/skills]
G --> K(skills_by_name)
H --> K
I --> K
J --> K
K --> L[Filter Duplicate Names]
L --> M[Create SkillToolset]
M --> N["Safe Inject into kwargs['tools']"]
N --> O[Call Original LlmAgent.__init__]
User Workflow
sequenceDiagram
actor Developer
participant FS as Local Filesystem
participant Agent as ADK Agent
Developer->>FS: Create skill in .agents/skills/my-skill/SKILL.md
Developer->>Agent: Write agent script importing adk_progressive_skills
Developer->>Agent: Run agent script
Agent->>FS: Automatically scans paths
FS-->>Agent: Discovers my-skill
Agent->>Agent: Injects SkillToolset containing my-skill
Agent-->>Developer: Agent starts with skill dynamically loaded!
Usage Instructions
ADK 1.x Usage
For ADK 1.x style agents, import the progressive skills library at the very top of your entrypoint file:
# 1. Import library first to apply the patches
import adk_progressive_skills
# 2. Import ADK agent classes
from google.adk.agents import Agent
# 3. Instantiate your Agent (skills in .agents/skills/ are automatically loaded)
agent = Agent(
name="my_helper_agent",
instruction="Help user with tasks.",
model="gemini-3.5-flash",
tools=[], # Injected automatically with SkillToolset
)
print(agent.tools)
ADK 2.0 Usage
For ADK 2.0 style agents, import the library first and use LlmAgent:
# 1. Import library first to apply the patches
import adk_progressive_skills
# 2. Import ADK 2.0 agent classes
from google.adk.agents.llm_agent import LlmAgent
# 3. Instantiate your LlmAgent
agent = LlmAgent(
name="my_helper_agent_v2",
instruction="Help user with tasks.",
model="gemini-3.5-flash",
tools=[], # Injected automatically with SkillToolset
)
print(agent.tools)
Context Preservation & Prevention of Context Bloat
To prevent context window bloat and reduce token overhead, the library leverages ADK's native execution-time lazy-loading mechanisms:
- Minimal Initial Overhead: On initialization, the full markdown instructions (
SKILL.mdbody) of discovered skills are withheld from the initial system instructions. Only the skill names and descriptions are exposed to the model (either summarized in the system prompt or made queryable via a corelist_skillstool). - On-Demand Activation: The model must call
load_skill(skill_name="...")to fetch the full markdown body of a skill and append it to the conversation history dynamically. - Lazy Tool Mounting: Any supplementary tools defined in the skill's metadata (
adk_additional_toolsin the YAML frontmatter) are only registered and exposed to the model after the skill has been dynamically activated in that session. - On-Demand Resource Access: Scripts and assets under
scripts/,references/, andresources/are accessed progressively usingload_skill_resource()andrun_skill_script()only when invoked.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adk_progressive_skills-0.1.0.tar.gz.
File metadata
- Download URL: adk_progressive_skills-0.1.0.tar.gz
- Upload date:
- Size: 53.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux rodete","version":null,"id":"rodete","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0740690f3bb5ba11ef786ae5e55c9cc829a6e9685fd492adfe1edaf7ad898b27
|
|
| MD5 |
7d233e8996eae0c996e92a3932892621
|
|
| BLAKE2b-256 |
8b0a476a2f66af152beef3e613ec4ffb1a45b05b3a6479e7529928ca34a14e7f
|
File details
Details for the file adk_progressive_skills-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adk_progressive_skills-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux rodete","version":null,"id":"rodete","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc817a2fa24cd6b15bcc1fc9850c854738f716ea9991f6afd522a2b1587c8af7
|
|
| MD5 |
fbadcaf962e90f488d3555f0d6eaafdf
|
|
| BLAKE2b-256 |
21932761b262a33206641d54cf96b605fa09c7f70e8700fee064ce860791faa9
|