Skip to content

DynamicSkillsLoader lacks true progressive/tiered skill loading #1400

@pengjunfeng11

Description

@pengjunfeng11

Summary

The current DynamicSkillsLoader and Agent.handle_skills() implementation claims to support Anthropic's tiered progressive skill loading (Tier 1: metadata only → Tier 2: full content on demand), but in practice no progressive loading actually happens. All matched skills have their full content injected into the system prompt in a single step.

Current Behavior

When agent.run(task) is called:

  1. handle_skills(task) is invoked
  2. DynamicSkillsLoader.load_relevant_skills(task) computes cosine similarity and filters skills
  3. All matching skills' full content is immediately concatenated into system_prompt

The load_full_skill(skill_name) method exists as a public API but is never called internally — it's an orphaned method with no integration into the agent's execution pipeline.

Expected Behavior (True Progressive Loading)

A proper tiered implementation would look like:

  • Tier 1 (initialization): Only inject skill name + description into the system prompt, keeping it lightweight
  • Tier 2 (runtime, on-demand): When the agent determines a skill is needed during conversation, dynamically load the full SKILL.md content via load_full_skill() and append it to the context

This requires a mechanism for the agent to "request" a skill at runtime (e.g., a tool/function call), which is currently missing.

Why This Matters

  • Token waste: Loading all full skill content upfront bloats the system prompt, especially with many skills
  • Context window pressure: For agents with many skills, this can consume significant context unnecessarily
  • Documentation mismatch: The docs and code comments reference "Tier 2 progressive disclosure" but the implementation doesn't deliver it

Relevant Code

  • swarms/structs/dynamic_skills_loader.pyDynamicSkillsLoader class
  • swarms/structs/agent.pyhandle_skills(), _load_dynamic_skills_for_task(), load_full_skill()

Suggested Approach

  1. In Tier 1 mode, only append a skill summary (name + description) to the system prompt
  2. Expose load_full_skill as an agent tool/function that the LLM can call mid-conversation
  3. When the LLM invokes the tool, load and inject the full skill content into the context dynamically

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions