Imagine an AI agent that has learned to shop on Target—it knows how to search for products, add items to the cart, and check out. Now you want it to work on Walmart too. Two problems immediately arise:
- Problem 1: Over-specialization. The agent’s skills are so tightly wired to Target’s specific layout and functions that they simply don’t transfer to Walmart. It has learned how to use Target, not how to shop online in general.
- Problem 2: Catastrophic forgetting. You might continue to train it on Walmart. It learns—but now it begins to forget how to use Target. Each new site overwrites what the agent knew before.
We propose PolySkill, a framework that solves both problems by borrowing a concept from software engineering—polymorphism. The key idea is to separate what a skill does (e.g., “search for a product”) from how each site implements it. This lets agents build a general “shop online” skill with site-specific details underneath, rather than treating every site as an unrelated, one-off task.
PolySkill improves how often agents reuse learned skills by 1.7x and boosts task success rates by 9.4% on a standard web navigation benchmark (Mind2Web, which covers 2,000 realistic tasks on 137 websites across diverse categories).
The PolySkill Framework

How It Works
Define the Abstract Blueprint
First, create a high-level “schema” for a type of website, (e.g., shopping websites):
class AbstractShoppingSite:
def search_product(query)
def add_to_cart(item, quantity)
def checkout()
Implement Site-Specific Details
Each website gets its own concrete implementation for different skills, (e.g., search_product, add_to_cart). In this example, the skills are implemented as Python functions.
class AmazonSite(AbstractShoppingSite):
def search_product(query):
# Amazon's specific way of searching
class TargetSite(AbstractShoppingSite):
def search_product(query):
# Target's specific way of searching
Build Compositional Skills
Now you can create complex skills that work everywhere:
def purchase_item(query):
item_id = search_product(query) # Works on any shopping site
add_to_cart(item_id) # Works on any shopping site
checkout() # Works on any shopping site
Use the Abstract Class as Prior Knowledge
When the agent encounters a new shopping website (like Walmart), the abstract class guides its learning:
- The agent recognizes: “This is a shopping site”
- It retrieves the AbstractShoppingSite blueprint
- Instead of random exploration, it knows exactly what to learn: implement search_product(), add_to_cart(), and checkout()
- The abstract class provides a structured curriculum for skill acquisition on new websites
This turns unguided exploration into systematic, goal-directed learning. This also prevents catastrophic forgetting as the skills learned on the new website will not overwrite the skills for existing websites.
The Results: Generalization That Works
Skill Reuse Jumps 1.7x
Before PolySkill, agents reused learned skills less than 18% of the time on new websites. With PolySkill, that jumped to 31%—meaning agents actually benefit from their past experience.
Better Performance Across the Board
- Mind2Web (a popular web navigation benchmark): Up to 9.4% success rate improvement
- Unseen websites: 13.9% boost in success rates
- Efficiency: Over 20% fewer steps needed
Generalization Across Websites without Catastrophic Forgetting
When PolySkill agents learn skills for new websites, they don’t “forget” how to use old ones. The abstract structure protects existing knowledge while adding new implementations.

From Specialist to Explorer
We also tested an even more ambitious scenario: what if the agent explores on its own without predefined tasks?
Traditional approaches struggle here because they either:
- Become over-specialized to one site (if they stay put)
- Fail to learn coherent skills (if they wander randomly)
PolySkill’s hierarchical structure provides a learning curriculum for free. The abstract classes tell the agent: “Here are the important things to figure out on this type of site.” The agent can then:
- Recognize that Amazon and Target are both shopping sites
- Know it needs to learn: search, add to cart, checkout
- Explore systematically to implement each skill
- Apply learning to the next shopping site immediately
Result: In self-guided exploration across multiple sites, PolySkill agents achieved 43.1% success rate on held-out tasks, beating carefully hand-crafted curricula.
Why This Matters
Moving Beyond Training Wheels
Current web agents work well on sites they’ve seen but fail on new ones. PolySkill is a step toward agents that can genuinely adapt to the ever-changing open web.
Compositional Intelligence
By building skills from reusable components, agents become more than the sum of their parts. Complex tasks become sequences of familiar patterns.
Continual Learning
The holy grail of AI is systems that keep learning and improving during deployment. PolySkill shows that proper abstraction is key to learning without forgetting.
Beyond Web Agents
PolySkill is not limited to web navigation—it can benefit any agent that needs to learn transferable skills across different environments. For example, a small language model agent interacting with different training infrastructures (like PyTorch, TensorFlow, and JAX) could use polymorphism to recognize that “start training” is the same abstract operation with platform-specific implementations. Similarly, a customer service agent answering questions by searching different knowledge bases could learn generalizable search and retrieval skills that work across multiple backends. By organizing skills through polymorphic abstraction, these agents achieve better performance and higher reuse rates, just as web agents do.
Read the full paper: PolySkill: Learning Generalizable Skills Through Polymorphic Abstraction
