toolkit

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toolkit is the machine that answers requests for tools: an open gives its instructions and its tools, and a call runs one tool. Its tools are written in its definition, or one job answers every request.

Index

Constants

View Source
const (
	Open   = "open"
	Call   = "call"
	Resume = "resume"
	Cancel = "cancel"
)

What a request asks, as its do: says.

View Source
const (
	KindTool    = "tool"
	KindToolkit = "toolkit"
)

The kinds of tool an open gives.

View Source
const (
	DefaultResume = 10 * time.Minute
)

DefaultResume is how long a resume waits for work to end by default, and defaultWait how long it waits between two asks where the answer gives no time.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer added in v0.51.0

type Answer struct {
	Ended    bool
	Result   any
	Working  any
	Requests any
	State    any
}

Answer is the answer to a call or a resume: a result, which ends the call, or working or requests for input, with the state a resume gives back.

func AnswerOf added in v0.51.0

func AnswerOf(answer any) (Answer, bool)

AnswerOf reads the answer to a call or a resume, or gives false for one that holds no result and no state with working or requests.

type Item added in v0.51.0

type Item struct {
	Kind        string         `json:"kind"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitzero"`
	Args        map[string]any `json:"args,omitzero"`
}

An Item is one tool or toolkit an open gives: its kind, its name, its description and, for a tool, the shape of its arguments.

func ItemOf added in v0.51.0

func ItemOf(written any) (Item, error)

ItemOf reads one item of an open's tools, and says what is wrong with it. A tool with no shape of its arguments takes an object.

func (Item) Value added in v0.51.0

func (e Item) Value() map[string]any

Value gives the item as an answer holds it.

type Opened added in v0.51.0

type Opened struct {
	Instructions string
	Tools        []Item
}

Opened is the answer to an open: the instructions, and each item.

func OpenedOf added in v0.51.0

func OpenedOf(answer any) (Opened, error)

OpenedOf reads the answer to an open, and says what is wrong with it. Anything else an item holds is dropped.

func (Opened) Value added in v0.51.0

func (o Opened) Value() map[string]any

Value gives the answer to an open as a run ends with it.

type Request added in v0.51.0

type Request struct {
	Do        string
	Toolkit   []string
	Tool      string
	Args      any
	State     any
	Responses any
	Said      string // what the caller says of the call, which a hook reads
}

A Request is what a run of a toolkit is asked, as its input's request: gives it. Toolkit is the path of names to a toolkit inside this one.

func (Request) Value added in v0.51.0

func (r Request) Value() map[string]any

Value gives the request as a run's input holds it.

type Tool

type Tool struct {
	machine.ToolSpec
}

Tool is a named job a call runs, with its description and the shape of its arguments, a JSON Schema of an object. Written machine: or call: it names a machine, whose description it takes, and its arguments are that machine's input without the names the tool fixes.

type Toolkit

type Toolkit struct {
	// Instructions are the text an open gives, filled from the input.
	Instructions string           `json:"instructions,omitzero"`
	Tools        map[string]*Tool `json:"tools,omitzero"`
	// Job answers every request, in place of Instructions and Tools.
	Job *machine.JobSpec `json:"job,omitzero"`
	// Resume is how long a resume waits for work to end; ten minutes if it
	// says nothing.
	Resume machine.Duration `json:"resume,omitzero"`
}

Toolkit is the full form of the fields of a definition that only a toolkit has. It has Tools, or Job.

Jump to

Keyboard shortcuts

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