Skip to content

Skills

Page as Markdown

Package instructions and supporting files as skills, and attach them to an AgentTemplate.

A skillSkillA packaged piece of know-how that an agent can pick up: a directory holding a SKILL.md file of instructions, plus any scripts, command-line tools, or reference files those instructions use. You attach a skill to an AgentTemplate by specifying where it comes from.Learn more packages a piece of know-how that an agent can pick up: a set of instructions, together with whatever scripts, command-line tools, or reference files those instructions depend on. You attach a skill to an AgentTemplateAgentTemplateA Kubernetes custom resource defining what an agent does: its model, system prompt, tools, skills, and plugins. It runs only once an Agent pairs it with a Harness.Learn more by specifying where it comes from, and kagent fetches it and places it where the agent can find it.

About

A skill is a directory whose root holds a SKILL.md file. That file carries front matter naming the skill and describing what it is for, followed by the instructions themselves.

The description makes a skill usable. When an agent starts, it reads the front matter of every skill that is attached to it. The agent then offers those skills to the model as tools that the model can call. The model chooses a skill from its description in the same way that it chooses any other tool. A description that states plainly when to use the skill therefore matters more than the length of the instructions behind it.

A skill can be published on its own, or bundled with other skills in a pluginPluginA bundle that an AgentTemplate attaches with spec.plugins. A plugin contains skills and can also declare Model Context Protocol servers. Plugins follow the Agent Plugins specification.Learn more. For what a plugin contains and how to attach one, see Plugins.

Attach skills to an AgentTemplate

Use spec.skills to attach a standalone skill. Each entry gives the skill a name and an immutable source to fetch it from.

apiVersion: api.kagent.dev/v1alpha3
kind: AgentTemplate
metadata:
  name: incident-responder
  namespace: kagent
spec:
  modelConfig:
    name: default-model-config
  systemPrompt: You help engineers work through production incidents.
  skills:
    - name: incident-triage
      source:
        oci: registry.example.com/skills/incident-triage@sha256:<digest>
FieldDescription
skills[].nameThe name that the skill is mounted under, and the name that the model sees.
skills[].sourceThe location to fetch this one skill from. The source root must contain a SKILL.md file.
source.pathThe directory to select inside the artifact, when the content is not at its root. The path must be relative, and it cannot climb out of the artifact with .. segments.

One AgentTemplate accepts up to 50 standalone skills. To give an agent the skills that a plugin contains, use spec.plugins instead. An AgentTemplate can use both fields at once.

Every source is immutable

A skill or a plugin changes what an agent does, so kagent only accepts artifact references that cannot shift underneath a running agent. Each source specifies exactly one of three kinds of artifact, and every kind must be pinned in its own way.

  • oci: An image reference pinned to a digest, in the form <repository>@sha256:<digest>. A tag alone is rejected, because a tag can be moved to different content later.
  • git: A repository URL together with a full commit identifier. An abbreviated commit, a branch, or a tag is rejected.
  • bucket.s3: An endpoint, bucket, and key, together with the versionId of that exact object version. A region is included where the service requires one for request signing.

Warning

An agent with a git or bucket.s3 source does not become ready. The Actor that builds the golden snapshot fetches the source itself. No egress policy applies to that Actor, so Agent Substrate blocks the download, and the Agent’s Ready condition reports GoldenActorCrashed. An EgressPolicy in the Agent’s egressPolicyRefs field does not resolve the failure, because that field governs Sessions only. Use an oci source until this limitation is fixed.

If a source sets more than one kind, or none of them, the API server rejects the AgentTemplate with the error exactly one of the fields in [oci git bucket] must be set.

For an oci source, the Agent Substrate worker pulls the image with the registry credentials that it uses for workload images. The worker must therefore be able to reach the registry, and a private registry must accept those credentials. The agent’s egress policies do not need to grant access to the registry. Agent Substrate mounts the image in the agent sandbox as a read-only volume, and the agent runtime reads the skill or plugin from that volume.

Each distinct oci image uses one mounted volume, and entries that reference the same image share that volume. Agent Substrate allows 32 volumes for each Actor. kagent reserves three of them for runtime data and leaves the other 29 for oci images. Because kagent runs an agent and its subagents in one Actor, the limit covers the skills and plugins of every AgentTemplate in the subagent tree. kagent rejects a revision over the limit with the error runtime revision has <n> volumes and <n> container mounts; Substrate supports at most 32 volumes and 32 mounts per container.

Publishing a new version means updating the AgentTemplate to reference the new digest, commit, or object version. The update produces a new revision. Agents that are already running keep the content that they started with.

How a skill loads

kagent does not fetch a skill when you apply an AgentTemplate. The compiled revision records the source of each skill, and the skill arrives when the agent starts. For an oci source, Agent Substrate pulls the image from the Worker and mounts it as read-only into the ActorActorThe sandboxed unit of compute, provided by Agent Substrate, that runs a Session's conversation loop. Every Session is backed by one.Learn more before the runtime starts. For a git or bucket source, the Actor fetches the files itself. The runtime then copies each enabled skill into the directory that its Harness reads, which is /skills/<skill-name> on a kagent Harness.

Because kagent fetches a skill this late, review the following considerations.

  • A wrong source still compiles. kagent validates skill names before it accepts an AgentTemplate, but it never checks that the artifact exists or that it contains a SKILL.md file. A bad digest produces a revision that reports Ready, and the agent then fails to start.
  • A private registry needs Worker credentials. Agent Substrate pulls an oci source with the registry credentials that the Worker uses for workload images. Kubernetes imagePullSecrets on a pod do not configure that pull.
  • Each Actor mounts up to 29 distinct skill images. Images shared by several skills or plugins count once. A revision that needs more fails when kagent builds its ActorTemplate.
  • Scripts run in the runtime image. A skill’s scripts get whatever the Harness image provides. The kagent runtime image is Alpine Linux with bash, git, and the standard Alpine utilities, and it does not include Python.

Skill tools and built-in tools

On a kagent Harness, every agent has kagent’s built-in tools, even without a skill. A skill runs its scripts with the built-in bash tool. Attaching a skill also adds the skill tools, which read skills. The claude and codex Harness runtimes also take skills. They expose the skills through their own coding agent’s tools.

ToolAvailabilityWhat it does
list_skillsWith a skillLists the attached skills with their names and descriptions.
load_skillWith a skillReads a skill’s full SKILL.md instructions.
load_skill_resourceWith a skillReads one file inside a skill directory, such as a reference document.
read_fileBuilt-inReads a file, with line numbers.
write_fileBuilt-inWrites a file, and creates its parent directories.
edit_fileBuilt-inReplaces an exact string in a file. The edit fails when the string occurs more than once, unless the agent asks to replace every occurrence.
list_filesBuilt-inLists the contents of a directory.
grep_fileBuilt-inSearches a file, or a directory recursively, for a regular expression.
bashBuilt-inRuns a command in a new shell. A command stops after 60 seconds by default. The agent can raise that limit to 600 seconds for one call. The tool combines standard output and standard error, and truncates the result at 64 KiB. When the call returns, the tool stops every process that the command started.

The built-in tools accept an absolute path or a path relative to the workspace, /data/workspace. The root agent and its subagents share the workspace. The workspace starts empty, and its files survive when the Actor is suspended and resumed. A command that is still running does not survive.

A Harness does not have a per-agent setting for the built-in tools. The config.runtimeDefaults.builtinTools Helm values change the built-in tools for every agent in the installation.

config:
  runtimeDefaults:
    builtinTools:
      disableFileSearch: true
      disableBash: true
ValueDescription
disableFileSearchSet to true to remove list_files and grep_file from the root agent and from every subagent. Defaults to false. This value replaces skillTools.fileSearchTools from earlier releases, with the opposite meaning.
disableBashSet to true to remove the bash tool from the root agent and from every subagent. The agent keeps the file tools, and still loads skills. Defaults to false.
disableAskUserSet to true to remove the ask_user tool. Defaults to false. For more information, see Disable questions.
bashVenvPathThe path to a Python virtual environment in the Harness image. The bash tool adds the environment’s bin directory to the start of PATH, and sets VIRTUAL_ENV. The kagent runtime image does not include Python. To use this value, build a Harness image that includes the environment. Defaults to empty.

When you attach a skill, the runtime appends the name and description of each attached skill to the model request, together with an instruction to call load_skill before the agent acts on a skill. The model therefore sees each skill before the agent calls any tool.

Important

The bash tool gives the agent shell access inside its own Actor sandbox, and the sandbox is the boundary that contains the agent. The file tools are not limited to the workspace. They read and write anywhere in the sandbox, including /skills, so one skill’s instructions can change another skill’s files. Review a skill before you attach it, and treat the egress that you grant the Actor as the reach that the skill has.

Naming rules

kagent checks skill names before it fetches anything. These rules apply to every skill on an AgentTemplate, whether the skill is standalone or comes from a plugin.

  • A name must be a single path component. A name containing a slash, or a name of . or .., is rejected.
  • Names must be unique across the whole AgentTemplate. Because standalone skills and plugin skills are mounted into the same place, a standalone skill cannot reuse the name of an enabled plugin skill, and two plugins cannot both contribute the same name.