Open Agent Loops
API Reference

SkillRegistry

@open-agent-loops/core


Defined in: skills/registry.ts:39

A named collection of skills you build once and resolve from by name.

Remarks

Composition helper, NOT a loop dependency — the same stance as ToolRegistry. runAgent never sees a registry: you hand it the SkillRegistry.catalog string for the system prompt and the SkillRegistry.tools array for the run. Because it only produces a string and a Tool[], you can adopt it incrementally and drop it anytime without touching the loop.

Fail fast (per the project's error-handling rule): registering a duplicate name (SkillRegistry.register) or resolving an unknown one (SkillRegistry.resolve) throws a descriptive error rather than silently overwriting or dropping a skill — both are almost always wiring bugs.

See

Skill

Example

const skills = new SkillRegistry([helloSkill, githubSkill]);

await runAgent({
  ...opts,
  system: `${baseSystem}\n\n## Available skills\n${skills.catalog()}`,
  tools: [skillTool(skills), ...skills.tools(), ...coreTools],
});

Constructors

Constructor

new SkillRegistry(skills?): SkillRegistry;

Defined in: skills/registry.ts:49

Create a registry, optionally seeded with an initial set of skills.

Parameters

ParameterTypeDefault valueDescription
skillsSkill[][]Initial skills to register, in order. Defaults to empty.

Returns

SkillRegistry

Throws

Error If two seed skills share a name.

Methods

catalog()

catalog(): string;

Defined in: skills/registry.ts:134

Render the always-in-context catalog: one - name: description line per skill.

Returns

string

A newline-joined list of - name: description lines, in registration order.

Remarks

This is the cheap half of progressive disclosure — names and descriptions the model reads every turn to decide which skill to invoke. The expensive instructions are disclosed only when the skill tool is called.


get()

get(name): Skill | undefined;

Defined in: skills/registry.ts:84

Get the skill registered under a name.

Parameters

ParameterTypeDescription
namestringThe skill name to look up.

Returns

Skill | undefined

The registered skill, or undefined if there is none.


has()

has(name): boolean;

Defined in: skills/registry.ts:74

Report whether a skill with this name is registered.

Parameters

ParameterTypeDescription
namestringThe skill name to look up.

Returns

boolean

true if a skill with this name is registered.


list()

list(): Skill[];

Defined in: skills/registry.ts:93

List every registered skill, in registration order.

Returns

Skill[]

All registered skills.


names()

names(): string[];

Defined in: skills/registry.ts:102

List every registered skill name, in registration order.

Returns

string[]

All registered skill names.


register()

register(skill): this;

Defined in: skills/registry.ts:60

Add a skill, keyed by its name.

Parameters

ParameterTypeDescription
skillSkillThe skill to register.

Returns

this

this, so registrations can chain.

Throws

Error If a skill with the same name is already registered.


resolve()

resolve(names): Skill[];

Defined in: skills/registry.ts:113

Resolve a list of names to their skills, in the order requested.

Parameters

ParameterTypeDescription
namesstring[]The skill names to resolve, in order.

Returns

Skill[]

The matching skills, in the requested order.

Throws

Error On the first name that is not registered; the message lists the available names.


tools()

tools(): Tool<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[];

Defined in: skills/registry.ts:151

Flatten every registered skill's tools into a single array.

Returns

Tool<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[]

Every skill's contributed tools, concatenated.

Remarks

Pass the result (alongside the skill tool) as runAgent's tools. Order is registration order, then each skill's own tool order. Duplicate tool names are not de-duplicated here — if that matters, feed the result through a ToolRegistry, which throws on duplicates.

On this page