TAI BUI
Back to curriculum
BuildPython

Skill Libraries and Lifelong Learning (Voyager)

Voyager (Wang et al., TMLR 2024) treats executable code as a skill: named, retrievable, composable, and refined by environment feedback. It is the reference architecture for Claude Agent SDK skills, skillkit, and the 2026 skill-library pattern.

TIME: ~75 minutesPREREQUISITES: Phase 14 · 07 (MemGPT), Phase 14 · 08 (Letta Blocks)

Learning Objectives

  • Name Voyager's three components — automatic curriculum, skill library, iterative prompting — and the role of each.
  • Explain why Voyager makes the action space code, not primitive commands.
  • Implement a stdlib skill library with registration, retrieval, composition, and failure-driven refinement.
  • Map Voyager's pattern onto the 2026 Claude Agent SDK skills and the skillkit ecosystem.

The Problem

An agent that rebuilds every capability from scratch each session fails in three ways:

  1. It wastes tokens. Every task re-elicits the same reasoning.
  2. It loses progress. A correction learned in session A never reaches session B.
  3. It fails at long-horizon composition. Complex tasks need hierarchies of capabilities, and a one-shot prompt cannot express them.

Voyager's answer is to treat each reusable capability as a named chunk of code in a library. The library retrieves skills by similarity, composes them with other skills, and refines them from execution feedback.

Warm-up0/3
1. Why do memory systems like MemGPT store information outside the model's context window?Warm-up
2. An agent retries a failing step and keeps getting the same wrong result. Which input would help its next attempt most?Warm-up
3. A team keeps pasting the same working helper function into every new script. What is the usual better practice?Warm-up
Check: The Problem0/1
1. Why can a one-shot prompt not handle long-horizon tasks well, in the skill-library view?Explain

The Concept

A skill library is a persistent store of named, executable code that an agent can search, compose, and refine. Voyager (arXiv:2305.16291) builds an entire agent around one.

Three components

Voyager structures an agent around three pieces:

  1. Automatic curriculum. A curiosity-driven proposer picks the next task based on the agent's current skill set and the environment state. Exploration is bottom-up.
  2. Skill library. Each skill is executable code, added when a task succeeds. Retrieval matches the query against skill descriptions by similarity.
  3. Iterative prompting mechanism. When a skill fails, the agent gets execution errors, environment feedback, and self-verification output, then refines the skill.

In the Minecraft evaluation (Wang et al., 2024), Voyager got 3.3x more unique items, reached stone tools 8.5x faster and iron tools 6.4x faster, and traversed 2.3x more map than the baselines. Those numbers are specific to Minecraft, but the pattern transfers.

Action space = code

Most agents emit primitive commands. Voyager emits JavaScript functions. A skill looks like this:

async function craftIronPickaxe(bot) {
  await mineIron(bot, 3);
  await mineStick(bot, 2);
  await placeCraftingTable(bot);
  await craft(bot, 'iron_pickaxe');
}

It is composed from sub-skills, stored keyed on its description and embedding, and retrieved as a program rather than a prompt. Voyager's skills are JavaScript; the Build It toy below keeps its code as Python strings next to plain Python callables.

The 2026 Claude Agent SDK skill is the same idea: a named, retrievable chunk of code plus instructions that the agent loads on demand.

Skill retrieval

Say the new task is "make a diamond pickaxe." The agent:

  1. Embeds the task description.
  2. Queries the skill library for the top-k similar skills.
  3. Retrieves craftIronPickaxe, mineDiamond, placeCraftingTable, and so on.
  4. Composes the new skill from the retrieved pieces plus whatever new logic it needs.

MCP resources (Phase 13) and Agent SDK skills implement this same pattern: retrieval over a knowledge or code surface, scoped to the current task.

Iterative refinement

The feedback loop runs like this:

  1. The agent writes a skill.
  2. The skill runs against the environment.
  3. One of three signals comes back: success, error (with a stack trace), or self-verification failure.
  4. The agent rewrites the skill using that signal as context.
  5. The loop repeats until success or a maximum number of rounds.

This is Self-Refine (Lesson 05) applied to code generation, with the environment doing the verifying. CRITIC (Lesson 05) is the same pattern with external tools as the verifier.

Curriculum and exploration

The curriculum module proposes tasks like "build a shelter near the lake" based on what the agent has and what it hasn't done yet. It reads the environment state and the skill inventory, then picks a task just above current capability, which is the exploration sweet spot.

For a production agent, this becomes a "what's missing" operator: given the current library and a domain, which skills aren't covered yet? Teams typically run this by hand as a curriculum review.

Where this pattern goes wrong

  • Skill library rot. The same skill gets added ten times under slightly different descriptions. Deduplicate on write so retrieval returns one.
  • Composed-skill drift. A parent skill depends on a child that was later refined. Version your skills. A parent pinned to v1 does not pick up v3 on its own.
  • Retrieval quality. Vector retrieval over skill descriptions degrades once the library grows past a few hundred skills. Supplement it with tag filters and hard constraints ("only skills with category=tooling").
Check: The Concept0/22
1. How does the automatic curriculum pick the next task?Define
2. In a Voyager-style agent, what is a skill?Define
3. What is a skill library?Define
4. What does composition mean for skills in a library?Define
5. What is iterative refinement in Voyager's skill loop?Define
6. What does action-space-as-code mean?Define
7. What does dedup on write do in a skill library?Define
8. When does Voyager add a new skill to its library?Define
9. What three signals can return from a skill execution attempt?Define
10. Why does Voyager emit JavaScript functions instead of primitive commands?Explain
11. How does Voyager's refinement loop relate to Self-Refine?Explain
12. Voyager's Minecraft evaluation reports 3.3x more unique items and 8.5x faster stone tools than the baselines. What does the lesson say about those numbers?Explain
13. Why does the lesson recommend dedup on write for the skill library?Explain
14. What problem does composed-skill drift describe?Explain
15. What does the lesson say happens to skill retrieval as the library grows past a few hundred skills, and how should you compensate?Explain
16. A new task arrives: make a diamond pickaxe. What should the agent do first?Apply
17. A skill fails in round 2 of at most 5 and the environment returns a stack trace. What does the loop do next?Apply
18. Searching 'craft pickaxe' returns ten skills with near-identical descriptions. Which practice was skipped?Analyze
19. A child skill was refined, and a parent that worked last week now fails. Which fix targets the cause?Analyze
20. At 800 skills, a query that needs a tooling skill keeps returning loosely similar skills from other areas. What fits best?Analyze
21. A data agent composes SQL skills, and a refined shared join helper must not change reports already built on it. Which design fits?Design
22. You are launching a skill library for Terraform agents and have no time to build a curriculum module. What should you prioritize?Design

Build It

code/main.py implements a stdlib skill library with these pieces:

  • Skill: name, description, code (as a string), a callable fn, version, tags, depends_on, and a history of earlier code.
  • SkillLibrary: register, search (token overlap), topo_order and execute (composition by topological sort of dependencies), and refinement via re-registering a name, which bumps the version.
  • A scripted agent that registers three primitive skills, composes a fourth, hits a failure, and refines it.

The Concept section describes retrieval by embedding similarity. The toy uses token overlap (Jaccard score on description words) so it stays stdlib-only; Exercise 3 swaps in real embeddings. Two other simplifications: "dedup on write" here means exact name match (a second registration of the same name becomes a version bump, not a new entry), and the toy has no cycle detection or version pinning. Exercises 1 and 2 add those.

Run it:

python3 code/main.py

The trace shows library writes, retrieval, composition, a failed execution, and a v2 refinement. That is Voyager's loop end to end.

Check: Build It0/5
1. The toy library scores retrieval as Jaccard overlap of description words. Query: 'craft iron pickaxe'. Skill description: 'craft iron tools'. What is the score?Apply
2. In the toy, craftIronPickaxe depends on mineIron, mineStick and placeCraftingTable. In what order does execute run them?Apply
3. The toy holds crafting at version 1. The agent registers another skill named crafting with fixed code. What happens?Apply
4. In the toy, a parent has depends_on set to the bare name crafting. Crafting is refined from v1 to v2. Which version does the parent run next?Apply
5. A teammate says the toy raises an error when skill A depends on B and B depends on A. What is wrong with that assumption?Analyze

Use It

  • Claude Agent SDK skills (Anthropic): the 2026 reference. Each skill has a description, code, and instructions, and is loaded on demand during an agent session.
  • skillkit (npm: skillkit): cross-agent skill management for 32+ AI coding agents.
  • Custom skill libraries: domain-specific ones, like SQL skills for data agents or Terraform skills for infra agents. The Voyager pattern scales down well.
  • OpenAI Agents SDK tools: the low end of the spectrum, where each tool is a lightweight skill.
Check: Use It0/2
1. What is skillkit, per the lesson's Use It section?Define
2. Which 2026 product is the lesson's clearest match for the Voyager skill?Explain

Ship It

outputs/skill-skill-library.md generates a Voyager-shaped skill library for any target runtime, with registration, retrieval, versioning, and refinement wired in.

Author's Note

Spend your effort on library hygiene before anything else. The curriculum module is the glamorous part of Voyager, but the three failure modes in this lesson (duplicate skills, drifting parents, retrieval that degrades as the library grows) are all about keeping the library clean, and none of them need a curriculum to show up. Deduplicate on write, pin versions from the first day a skill depends on another, and put tag filters next to your similarity search before the library gets big. The lesson also says most teams run the curriculum step by hand, and I'd start there too. A library you can trust is worth more than a clever proposer feeding a messy one.

Exercises

  1. Add a dependency-cycle detector to topo_order(). Today its visited set stops an infinite loop but silently returns an order. What should happen when skill A depends on B and B depends on A? Should that be an error or a warning?
  2. Implement per-skill version pinning (depends_on currently holds bare names, so a parent always runs the latest child). When a parent skill composes child crafting@1, a refinement to crafting@2 must not silently upgrade the parent.
  3. Replace token-overlap retrieval with sentence-transformers embeddings (or a stdlib BM25 implementation). Measure retrieval@5 on a 50-skill toy library.
  4. Add a "curriculum" agent: given the current library and a domain description, propose 5 missing skills. Run it weekly.
  5. Read Anthropic's Claude Agent SDK skill docs and port the toy library to the SDK's skill schema. What changes about discoverability?

Key Terms

TermWhat people sayWhat it actually means
Skill"Reusable capability"Named chunk of code + description, retrievable by similarity
Skill library"Agent memory of how-to"Persistent store of skills, searchable and composable
Curriculum"Task proposer"Bottom-up goal generator driven by current capability gap
Composition"Skill DAG"Skills invoking skills; topologically sorted on execution
Iterative refinement"Self-correcting loop"Env feedback + errors + self-verification fold back into the next version
Action-space-as-code"Programmatic actions"Emit functions, not primitive commands, for temporally extended behavior
Dedup on write"Skill collapse"Near-duplicate descriptions collapse to one canonical skill

Further Reading

Code

Ships With