skill

package
v0.0.0-...-4d63c84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package skill integrates the standalone github.com/nijaru/agentskills module with Canto's tool and prompt APIs.

The reusable SKILL.md loader, registry, validation, and model types live in the external agentskills module. This package owns the Canto-specific runtime tools and request-time prompt helpers that operate on that shared core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListPrompt

ListPrompt injects a summary list of all available skills.

func ListPromptWithOptions

func ListPromptWithOptions(
	reg *agentskills.Registry,
	opts ListPromptOptions,
) prompt.RequestProcessor

func PreloadPrompt

func PreloadPrompt(skills ...*agentskills.Skill) prompt.RequestProcessor

PreloadPrompt injects the full instructions for a selected skill set.

func RuntimeConfig

func RuntimeConfig(
	ctx context.Context,
	reg *tool.Registry,
	skills ...*agentskills.Skill,
) (agent.RuntimeConfig, error)

RuntimeConfig validates and preloads skills for a runtime-scoped agent view.

Types

type LexicalRouter

type LexicalRouter struct {
	Registry          *agentskills.Registry
	NameWeight        float64
	DescriptionWeight float64
	BodyWeight        float64
	ToolWeight        float64
}

func (*LexicalRouter) SelectRelevant

func (r *LexicalRouter) SelectRelevant(
	_ context.Context,
	taskDescription string,
	limit int,
) ([]SkillMetadata, error)

type ListPromptOptions

type ListPromptOptions struct {
	Router Router
	Query  string
	Limit  int
}

type ManageSkillTool

type ManageSkillTool struct {
	Registry *agentskills.Registry
	// Path is the root directory where skill subdirectories are written.
	// Each skill is stored at {Path}/{name}/SKILL.md.
	Path string
}

ManageSkillTool allows an agent to create, update, or delete SKILL.md files at runtime, enabling closed-loop skill refinement.

func (*ManageSkillTool) Execute

func (t *ManageSkillTool) Execute(_ context.Context, args string) (string, error)

func (*ManageSkillTool) Spec

func (t *ManageSkillTool) Spec() llm.Spec

type ReadSkillTool

type ReadSkillTool struct {
	Registry *agentskills.Registry
}

ReadSkillTool allows an agent to read the full content of a skill.

func (*ReadSkillTool) Execute

func (t *ReadSkillTool) Execute(ctx context.Context, args string) (string, error)

func (*ReadSkillTool) Spec

func (t *ReadSkillTool) Spec() llm.Spec

type Router

type Router interface {
	SelectRelevant(
		ctx context.Context,
		taskDescription string,
		limit int,
	) ([]SkillMetadata, error)
}

type SecurityHooks

type SecurityHooks struct {
	Validators []Validator
}

func DefaultSecurityHooks

func DefaultSecurityHooks() SecurityHooks

func (SecurityHooks) ScopeRegistry

func (h SecurityHooks) ScopeRegistry(
	reg *tool.Registry,
	skills ...*agentskills.Skill,
) (*tool.Registry, error)

func (SecurityHooks) Validate

func (h SecurityHooks) Validate(
	ctx context.Context,
	skills ...*agentskills.Skill,
) error

type SkillMetadata

type SkillMetadata struct {
	Name         string
	Description  string
	AllowedTools []string
}

type Validator

type Validator interface {
	ValidateSkill(ctx context.Context, skill *agentskills.Skill) error
}

type ValidatorFunc

type ValidatorFunc func(ctx context.Context, skill *agentskills.Skill) error

func (ValidatorFunc) ValidateSkill

func (f ValidatorFunc) ValidateSkill(
	ctx context.Context,
	skill *agentskills.Skill,
) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址