[Feature Request]: First-Class Composable `Skill` & `Command` Abstraction for Modular `LlmAgent` Capabilities

Offen
#8,263 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@sanketpatil06 arbeitet bereits daran.

Seit 19.11.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

needs review tools
Is your feature request related to a problem? Please describe.

Currently, LlmAgent treats domain instructions (instruction / global_instruction) as monolithic strings or templates and tools as flat lists of Python functions, BaseTool, or AgentTool instances.

When scaling an agent across multiple domains, business verticals, or evolving prompt/tool versions in production:

  1. Prompt & Tool Coupling: Domain-specific behavioral rules, context, and permitted tools are manually concatenated and wired at agent initialization time rather than encapsulated as a cohesive unit.
  2. Version Coexistence & Reuse: Teams cannot easily package a domain capability (instructions + scoped tools + lifecycle hooks) to reuse across different agents or run multiple versions side-by-side without duplicating agent definitions.
  3. CLI / Runtime Switching: Unlike contributor-side agent skills (.agents/skills/), runtime ADK applications lack a native way to mount, inspect, or dynamically select modular capabilities via code or CLI flags (e.g., adk run).

Describe the solution you'd like

Introduce a first-class, composable Skill primitive (and optional Command action binding) in google.adk that encapsulates scoped instructions, domain context, permitted tools, and lifecycle hooks into a reusable, versioned unit that can be mounted onto an LlmAgent.

Proposed Core API & Design Considerations
  1. Skill Primitive (google.adk.skills.Skill)
    A declarative or class-based container bundling:

    • name & version (e.g., "bigquery_governance", "1.0.0")
    • description (used for routing/discovery or progressive disclosure)
    • instruction (scoped system/domain guidance merged cleanly into the host LlmAgent context)
    • tools / commands (scoped BaseTool / callable actions enabled only when the skill is active)
    • Optional before_skill_callback / after_skill_callback hooks for domain-level guardrails and telemetry.
  2. LlmAgent Composition (skills=[...])
    Allow LlmAgent to accept a list of Skill instances alongside tools:

   from google.adk.agents import LlmAgent
   from google.adk.skills import Skill

   governance_skill = Skill(
       name="schema_governance",
       version="1.0.0",
       description="Enforces snake_case naming and read-only query validation.",
       instruction="Always validate table schemas before generating SQL...",
       tools=[validate_schema_tool, inspect_catalog_tool],
   )

   worker_agent = LlmAgent(
       name="data_engineer_agent",
       model="gemini-2.5-pro",
       instruction="You are a core data engineering worker.",
       skills=[governance_skill],
   )

Progressive Disclosure / Dynamic Activation

Static Mounting: All mounted skills contribute their instructions and tools at agent startup.

On-Demand Activation (Optional): Expose skill metadata (name + description) first and load full instructions/tools into context only when invoked, keeping base token overhead low when an agent holds many skills.

CLI & Runner Integration
Support inspecting or selecting skills at runtime (e.g., adk run --skill schema_governance) and surfacing active skill metadata in Event / Session traces for observability.

Describe alternatives you've considered
Using AgentTool / Sub-Agents: Wrapping every domain capability as a separate sub-agent introduces unnecessary LLM round-trips, session state copying, and delegation latency when the capability is really a reusable skillset (instructions + tools) meant to execute within a single worker's reasoning loop.

Custom User-Space Wrapper Classes (SkillAgent): Implementing custom factory wrappers around LlmAgent works in individual repositories, but fragments ecosystem conventions and prevents native integration with adk web, adk run, and AgentEvaluator.

Reference Implementation & Real-World Context
I have implemented and tested this pattern in production use cases within my open-source repository:

Repository: ozkary/ai-engineering (see /adk)

Architectural Pattern: Decouples a lean worker agent kernel from domain-specific Skills (e.g., domain context, governance rules, and versioned capabilities) and Commands (deterministic tool actions), enabling strict Separation of Concerns (SoC) and multi-version skill coexistence without bloating core agent definitions.

Impact & Backwards Compatibility
100% Additive / Non-Breaking: skills: list[Skill] = [] defaults to empty on LlmAgent, preserving full backwards compatibility with existing instruction and tools definitions.

Testing & Observability: Aligns cleanly with AgentEvaluator and ADK's existing callback/event architecture.

Vorherrschende Sprache
Python
Sterne
22.3k
Forks
4.4k
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
6

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus google/adk-python

Alle Issues in google/adk-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.