[RFC] Taxonomy-Driven Skill Routing & Dynamic Context Mutation #5891
Replies: 2 comments 4 replies
-
|
Thanks Victor for joining the community call and talking this out with me for a while. I "lean positive" on what I see here, specifically the pluggable taxonomy. Note that a taxonomy should be in some standard format which is flattend and cleaned up for your "validation of terms", and in my opinion it ought to include definitions which could be used for LLM disambiguation or lookups. JSON-LD with SKOS{
"@context": "http://w3.org",
"@type": "Concept",
"@id": "https://example.com",
"prefLabel": { "@value": "Machine Learning", "@language": "en" },
"altLabel": [
{ "@value": "ML", "@language": "en" },
{ "@value": "Automated Learning", "@language": "en" }
],
"definition": {
"@value": "A branch of artificial intelligence focused on building systems that learn from data.",
"@language": "en"
},
"broader": "https://example.com"
}Flat Key-Value JSONA much simpler approach [
{
"id": "100",
"parentId": null,
"name": "Artificial Intelligence",
"definition": "The simulation of human intelligence by machines."
},
{
"id": "101",
"parentId": "100",
"name": "Machine Learning",
"definition": "Systems that learn from data to improve performance."
}
]
Assuming we adopt a specific taxonomy configuration spec, we parse and extract from it what we need for validation and we can validate skills and map more effectively to our domain. I can see it. Next question: could this start out as an ADK plugin, which you can just do yourself today? |
Beta Was this translation helpful? Give feedback.
-
|
It was pointed out that this feature should belong in a different repo, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Design doc + feature
I am proposing the integration of an enterprise-grade Pluggable Policy & Taxonomy Security Engine directly into Google's Agent Development Kit (ADK).
By classifying prompt contexts using multi-step pipelines and evaluating dynamic business rules (entitlements, roles, feature flags) on the fly, we keep the model strictly in a safe, compliant sandbox while giving enterprises absolute control over skill discovery, skill execution, and dynamic instruction shaping.
Reusing Existing SDK Guards
To keep the library clean and maintain zero duplicate logic, my architecture reuses the existing validation systems in the ADK. It doesn't mean we cannot write a new one, but keeping our code DRY is beneficial and easier to maintain.:
InputValidationErrorfromgoogle.adk.errors.input_validation_errorfor complete parity._validate_path_segmentfunction fromgoogle.adk.artifacts.file_artifact_serviceto validate skill names and path configurations, ensuring zero traversal, null-byte injection, or slash escapes.models.pyfor skill tags and taxonomy identifiers.Public API Library Exports (DX)
Because this is a library (
google-adk), developers should not have to dig into deep internal submodules to import theirblueprints/code/architecture. To ensure a sound Developer Experience (DX), we can expose the interface and presets directly at the package root level:To enable this, we will expose the new entities inside the module entry points with the following files modified and/or created:
policy.py: Our core interfaces and standard implementations. It will be a new file.__init__.py(inside the skills package): ExportsSkillPolicy,TaxonomyResolver, andTaxonomyPipeline.__init__.py(inside the root package): Surfaces the classes at the highest level of the SDK.Dynamic Prompt/Instruction Shaping & Multi-Step Taxonomy
Multi-Step Taxonomy Pipeline
Taxonomy classification can be complex and multi-stage. This technical architecture handles this by defining an abstract
TaxonomyResolverand providing a compositeTaxonomyPipelinethat runs sequential resolvers:LlmRequestor scan the model's own thought-stream block to classify the active security/regulatory domain (e.g.,urn:adk:domain:compliance).I am thinking about this Soft. Dev. pattern/design of a class:
Security & Sanitization
Since we are dealing with taxonomy, we should apply at least the bare minimum of existing sanitization guards. It ensures reasonable safety against prompt hacking and exploit attempts. We can enforce strict schema parsing and string sanitization when loading YAML metadata via standard models. Will it address all possible hacking attempts? Probably not, but would it prevent the most outrageous? Probably yes...
To eliminate directory traversal attacks and path tampering inside the skill tools completely, we can hook directly into tool execution (
LoadSkillTool,LoadSkillResourceTool,RunSkillScriptTool) using native SDK validation:Potential Codebase Changes We Would Have to Make
1. ADK Skills Policy Module
src/google/adk/skills/policy.py(going to me a new file)This module defines the abstract bases and default pipelines:
SkillPolicy,TaxonomyResolver,TaxonomyPipeline, andDefaultSkillPolicy(which combines list-based taxonomy-bind matching with user-defined policies).2. ADK Skills Registry & Parser
src/google/adk/skills/models.pyUpdates the
FrontmatterPydantic model to support list validation, sanitization mapping, and alias matching fortaxonomy-bindsas shown in the validation snippet above.src/google/adk/skills/_utils.pyExpands the whitelist of allowed YAML keys so the lightweight directory validator
_validate_skill_dirdoes not flag the new tags as invalid:3. ADK Toolset & Core Execution
src/google/adk/skills/skill_toolset.pyModifies
SkillToolset,ListSkillsTool, andLoadSkillToolto enable dynamic intercept checks.taxonomy_resolver: Optional[TaxonomyResolver] = Noneandpolicy_engine: Optional[SkillPolicy] = Noneto enforce dynamic entitlements and roles.SkillToolset._list_allowed_skills(self, context, llm_request=None): Evaluates active taxonomies via the resolver, passing thellm_requestcontext for conversation-history scanning. It maps permissions usingpolicy_engine.is_skill_allowed(skill, context)and returns only permitted skills.SkillToolset.process_llm_request: Utilizes_list_allowed_skillswith the activellm_requestto determine visible skills, injecting filtered skills inside the prompt's XML block.LoadSkillToolDynamic Shaping & Safety Guard: Enforces hard assertions using_validate_path_segmentand traversal guards. It re-evaluates policy checks on direct loading (run_async) to block hallucinated tool calls with a strictSKILL_NOT_PERMITTEDsafety message, runningpolicy_engine.shape_instructions(skill, tool_context, instructions)to apply shaped instruction guardrails before returning them to the model.Future-Proofing
Because this design relies entirely on generic string-based namespaces (
urn:adk:*), the ADK remains completely agnostic to the underlying taxonomy dictionary definitions. When central working groups like NIST or AAIF release their finalized taxonomy classifications, developers simply update their YAML frontmatter tags. The core plumbing outlined here requires zero modifications.Note: it was filtered through Gemini to cut the noise. So, if more details are needed, feel free to ask. To understand the logic, please read the code blocks.
Beta Was this translation helpful? Give feedback.
All reactions