Skip to content
This documentation covers kagent while it is in development and can describe unreleased features. For the current release, see the latest docs.

Add a plugin

Page as Markdown

Bundle skills into a plugin, publish it as an image, and attach it to an agent.

Add a plugin

Bundle skills into a plugin, publish it as an image, and attach it to an agent.

About this tutorial

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 is a bundle of skills that you publish and attach as one unit. An agent attaches the plugin once, and lists the skills that it wants from it. Use a plugin to ship a set of skills together, or to share the same set across several agents.

In this tutorial, you turn the skill from Add a skill into a plugin, publish it, and switch the agent to it. The kagent UI has no page for plugins, so you work from the command line. For what a plugin can contain, see Plugins and Core concepts.

Time: about 10 minutes.

Before you begin

  1. Complete Add a skill. This tutorial reuses its release-notes directory, its Dockerfile, and the release-writer agent.

  2. Set the repository for the plugin image. Replace the example value with your own repository. As for the skill, the repository must be public, and the cluster must reach it over HTTPS.

    export PLUGIN_REPO=ghcr.io/<your-org>/release-tools

Build the plugin

A plugin is a directory with a plugin.json manifest at its root and one subdirectory per skill under skills/.

  1. From the release-notes directory, move the skill under skills/ in a new plugin directory.

    cd ..
    mkdir -p release-tools/skills
    mv release-notes release-tools/skills/release-notes
    cd release-tools
  2. Add the manifest. Copy the $schema value exactly, because kagent rejects any other value. Of the other fields, kagent reads only name.

    cat > plugin.json <<'EOF'
    {
      "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
      "name": "release-tools"
    }
    EOF

Publish the plugin

Build the plugin image the same way as a skill image, so that the plugin directory is the root of the image. NODE_ARCH is the node architecture that you set in Add a skill.

  1. Move the Dockerfile to the root of the plugin directory.

    mv skills/release-notes/Dockerfile .
  2. Build and push the image.

    docker buildx build --push --platform "linux/$NODE_ARCH" -t "$PLUGIN_REPO:1.0.0" .
  3. Save the reference with its digest.

    export PLUGIN_OCI="$PLUGIN_REPO@$(docker buildx imagetools inspect --format '{{.Manifest.Digest}}' "$PLUGIN_REPO:1.0.0")"
    echo "$PLUGIN_OCI"

Attach the plugin to the agent

  1. Re-apply the AgentTemplate with plugins instead of skills, and list the skills to enable.

    kubectl apply -f - <<EOF
    apiVersion: api.kagent.dev/v1alpha3
    kind: AgentTemplate
    metadata:
      name: release-writer
      namespace: kagent
    spec:
      modelConfig:
        name: default-model-config
      description: Writes release notes from commit subjects.
      systemPrompt: You help maintainers turn commit history into release notes.
      plugins:
        - source:
            oci: ${PLUGIN_OCI}
          skills:
            - release-notes
    EOF

    Important

    A plugin enables only the skills that you list. If you omit skills, or leave it empty, the agent gets none of them, and kagent accepts the empty list without an error.

  2. Wait for the agent to report Ready again. kagent pulls the plugin image while it prepares the new revision.

    kubectl wait agent/release-writer -n kagent --for=condition=Ready --timeout=5m

Verify the plugin

  1. Check that the agent is ready.

    kubectl get agent release-writer -n kagent

    The READY column shows True.

  2. In the kagent UI, open the agent, start a New chat, and ask What skills do you have? The agent reports release-notes, the same as before. A chat that you started earlier keeps the version of the agent that it began with, so use a new one.

What you built

The same agent, now taking its skill from a plugin. Along the way, you used these features:

FeatureWhat you didRead more
PluginsBundled a skill with a plugin.json manifest, and published it as one imagePlugins
Plugin skill selectionListed the skills to enable from the pluginAttach a plugin to an AgentTemplate

Clean up

  1. Delete the agent and its template.

    kubectl delete agent release-writer -n kagent
    kubectl delete agenttemplate release-writer -n kagent
  2. Optional: Delete the plugin and skill images from your registry, and the local release-tools directory.

Next steps