tool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tool holds the registry of actions the agent may take. Every tool declares a capability class so the policy layer can gate whole categories without knowing individual tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class string

Class is what a tool is allowed to touch, from the policy engine's point of view. One class per tool, the strongest thing it does.

const (
	ClassRead  Class = "read"  // reads local state
	ClassNet   Class = "net"   // talks to the network
	ClassWrite Class = "write" // mutates local state
	ClassExec  Class = "exec"  // runs arbitrary code
)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is an ordered set of tools. The zero value and the nil pointer are both empty, usable registries.

func NewRegistry

func NewRegistry(tools ...Tool) *Registry

NewRegistry builds a registry from tools, keeping order.

func (*Registry) Add

func (r *Registry) Add(t Tool)

Add appends a tool, replacing any existing tool of the same name.

func (*Registry) Defs

func (r *Registry) Defs() []provider.Tool

Defs renders the registry the way a model request wants it.

func (*Registry) Get

func (r *Registry) Get(name string) (*Tool, bool)

Get looks a tool up by name.

type Tool

type Tool struct {
	Name        string
	Description string
	Class       Class
	Schema      json.RawMessage
	Run         func(ctx context.Context, input json.RawMessage) (string, error)
}

Tool is one callable action.

Jump to

Keyboard shortcuts

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