Loading
How skills enter a session: the catalog and load_skill, plus always, router, trigger and manual loads.
A session starts small. The model sees the base instructions, any always skills, a short catalog of the skills it
may load, and one tool, load_skill.
<available_skills>
<skill name="docs">Answer how-to questions from the help center. Use for questions about features and settings.</skill>
<skill name="refunds">Issue refunds for damaged, late or wrong orders. Use when a customer asks for money back.</skill>
</available_skills>Strategies
loading | Who decides | Where the instructions go |
|---|---|---|
always | You, up front | The static part of the system prompt |
model (default) | The model, by calling load_skill | The load_skill tool result, in the conversation |
router | A router, on each new user input | The session part of the system prompt; not in the catalog, and the model cannot load it |
trigger | Matchers on the user input, or a tool_called rule | The session part of the system prompt; not in the catalog, and the model cannot load it |
manual | Your code only (session.load) | The session part of the system prompt; hidden from the catalog and the model |
A session can mix them. requires loads dependencies first, through the same strategy as the skill that needs
them: a dependency must be a model skill inside allow, so a model load can never pull in a gate. A router or
trigger skill is a gate the
model cannot open by naming it; the catalog and the load_skill enum list only model skills.
load_skill
{
"name": "load_skill",
"input_schema": {
"type": "object",
"properties": { "name": { "type": "string", "enum": ["docs", "refunds"] } },
"required": ["name"],
"additionalProperties": false
}
}The enum lists exactly the loadable skills, sorted, so the model cannot ask for one that does not exist and the
schema never changes for the life of the registry. The result carries the instructions wrapped as the Agent Skills
client guide recommends (<skill_content name="refunds">...</skill_content>, with <skill_resources> inside when the
skill has files). Loading an already loaded skill returns already_loaded with no body.
Every outcome is a value the model can read and recover from: loaded, already_loaded, over_budget (with how
many tokens are free and what to unload), not_found, not_allowed. When your code makes a mistake instead
(session.load("typo")), it raises SkillNotFound.
Large catalogs
Above catalog_limit (TypeScript catalogLimit) loadable skills, default 64, the enum would cost more than it saves. The registry switches to
search mode: the catalog shows the count, a search_skills(query) tool returns the best matches (BM25, offline and
deterministic), and load_skill takes a plain name.
The transcript is the state
Every model load is a load_skill call and result in the conversation, and input triggers are functions of the
user's messages. So a session can be rebuilt from any message list (Anthropic, OpenAI, AI SDK, LangChain and Pydantic
AI shapes) with no extra storage. Replay is strict: only calls in messages the model wrote count, a load_skill
counts only once its result is in the transcript (an aborted step loaded nothing), and input triggers fire again for
each user message, in order. Other tool calls in a history are never replayed: a transcript cannot prove a call
succeeded, and a client can write one, so tool_called triggers fire only from calls the live session ran and saw
succeed. Router picks, code loads and tool_called trigger loads are not rebuilt from the transcript: adapters keep
them in the framework's state, or you pass the saved state.
One limit: an unload() from code is not in the transcript, so a session rebuilt from messages replays the
model's original load_skill and loads the skill again, even with state passed. If your host unloads skills, persist
the session's state and rebuild from it without replaying the messages, or unload again after rebuilding.
Saved state is checked when it is restored: a model load of a skill the model may not load, a router load of a skill no configured router may pick, or a trigger
load of a skill that is not a trigger skill, is refused and listed in session.rejected. Code loads (via: manual)
are your own decision and are kept, so never let a client write the state you pass in: the LangGraph adapter keeps it
under a private graph key for exactly that reason. The registry holds no per-conversation state, so one registry
serves every request in a process.