Files
David Gageot aadc69b093 Support filtering skills by name in agent YAML
The agent `skills` field now accepts a list that mixes sources and
skill names. Items equal to "local" or starting with http:// or
https:// are classified as sources; any other string is treated as
the name of a specific skill to expose to the agent.

When only skill names are given, the `local` source is used by
default, so `skills: [git, docker]` loads local skills and keeps
only those two. `skills: true` and `skills: false` still work as
before.

Changes:

* Add an Include field to latest.SkillsConfig and extend the
  YAML/JSON Marshal and Unmarshal methods to classify list items
  into Sources and Include, with symmetric round-trip.
* Apply the filter in teamloader.LoadWithConfig via a new
  filterSkillsByName helper. Unmatched names are logged as a
  warning; duplicate-name skills (e.g. one local, one remote) are
  all kept so downstream code can resolve precedence.
* Reject empty strings inside the list in validateSkillsConfiguration.
* Update agent-schema.json so `skills` is `oneOf` boolean or array.
* Add an examples/skills_filter.yaml and update the documentation
  (Skills feature page + Agent Config reference).

Closes #2404.

Assisted-By: docker-agent
2026-04-21 10:00:31 +02:00

30 lines
1.1 KiB
YAML

#!yaml
# Skills filter example.
#
# The `skills` field accepts either:
# - `true` / `false` to enable/disable skills discovery entirely.
# - A list combining skill sources and/or skill names to include.
#
# Items equal to "local" or starting with http:// or https:// are treated as
# sources (where to discover skills from). Any other string is treated as the
# name of a specific skill to expose to the agent. When only skill names are
# given, the `local` source is used by default.
#
# The agent below loads skills from the local workspace but only exposes the
# `commit` and `poem` skills. Any other discovered skills (including the
# built-in `bump-go-dependencies`) will be hidden from the model.
agents:
root:
model: openai/gpt-4o-mini
description: A small agent that demonstrates filtering skills by name.
instruction: |
You are a helpful assistant. Use the available skills when the user's
request matches one.
# Only expose the "commit" and "poem" skills from the locally discovered set.
skills:
- commit
- poem
toolsets:
- type: shell
- type: filesystem