agent

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 3 modules, 4 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 agent is the machine whose tools a model picks: the model is asked what to do, the tools it picks are run, the results go back to it, and this repeats until it answers without asking for a tool.

Index

Constants

View Source
const DefaultTurns = 20

DefaultTurns is how many turns an agent has unless it says otherwise.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Model  Model            `json:"model"`
	System string           `json:"system,omitzero"`
	Prompt any              `json:"prompt,omitzero"`
	Tools  map[string]*Tool `json:"tools,omitzero"`
	// Toolkits are groups of tools the model is shown once it opens them.
	// A toolkit's tools are among Tools, each naming its toolkit.
	Toolkits map[string]*Toolkit `json:"toolkits,omitzero"`
	// Turns is how many turns the agent has; twenty if it says nothing.
	Turns int `json:"turns,omitzero"`
	// Reply is the shape of the reply in the agent's result, where it is
	// data and not text: a JSON Schema of an object.
	Reply map[string]any `json:"reply,omitzero"`
	// Conversation is a conversation so far, to carry on from.
	Conversation any `json:"conversation,omitzero"`
	// Turn is the job that makes a turn.
	Turn *machine.JobSpec `json:"turn"`
}

Agent is the full form of the fields of a definition that only an agent has.

type Decision added in v0.23.0

type Decision struct {
	Model Model `json:"model"`
	// State is the text or data the questions are about.
	State any `json:"state,omitzero"`
	// Questions are the questions, each under its name, as the model's
	// service takes them.
	Questions any `json:"questions,omitzero"`
	// Decide is the job that puts the questions to the model.
	Decide *machine.JobSpec `json:"decide"`
}

Decision is the full form of the fields of a definition that only a decision has.

type Model

type Model struct {
	Name string `json:"name"`
	// Secret is the name of the secret that is the service's key.
	Secret string `json:"secret,omitzero"`
	// Service is which service's way of talking is spoken; it follows from
	// the model's name where it is not given.
	Service string `json:"service,omitzero"`
	// Address is where the service lives, for one that is not at its usual
	// place.
	Address string `json:"address,omitzero"`
	Effort  string `json:"effort,omitzero"`
	// ReplyTokens is the most a reply may hold, in tokens.
	ReplyTokens int `json:"reply_tokens,omitzero"`
	// Own are the tools of its own that a model run as a program may use:
	// tools Corbie does not run.
	Own []string `json:"own,omitzero"`
}

Model names the model an agent's turns are sent to.

type Tool

type Tool struct {
	Description string           `json:"description"`
	Args        map[string]any   `json:"args,omitzero"`
	Job         *machine.JobSpec `json:"job"`
	// Agent says the tool's job is an agent: the model is shown what that
	// agent replied, and not the conversation it had.
	Agent bool `json:"agent,omitzero"`
	// List is a job that lists tools, each with its description and the
	// shape of its arguments, in place of Description and Args: Job runs
	// each of them.
	List *machine.JobSpec `json:"list,omitzero"`
	// Toolkit names the toolkit the tool is in, if it is in one.
	Toolkit string `json:"toolkit,omitzero"`
	// Call is the location of the machine the tool calls, where it is
	// written as call:. Its description and its arguments are that
	// machine's; Job calls it, with the input the tool fixes, and the
	// model's arguments are added to that input.
	Call string `json:"call,omitzero"`
	// When is a condition on the agent's input, checked when the run
	// starts: the tool is offered only if it holds.
	When string `json:"when,omitzero"`
}

Tool is a named job a model may pick, with its description and the shape of its arguments, a JSON Schema of an object.

type Toolkit

type Toolkit struct {
	Description string `json:"description"`
	// Instructions are the text the model is given when it opens the
	// toolkit, filled from the agent's input then.
	Instructions string `json:"instructions,omitzero"`
	// Approve marks the toolkit's opening for approval.
	Approve bool `json:"approve,omitzero"`
	// When is a condition on the agent's input, checked when the run
	// starts: the toolkit is offered only if it holds.
	When string `json:"when,omitzero"`
	// Meta is data Corbie keeps and never reads.
	Meta any `json:"meta,omitzero"`
}

Toolkit is a group of tools the model is shown once it opens it.

Jump to

Keyboard shortcuts

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