schema

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package schema contains a stateful schema-v2 for AgentBase, Mem, and Tool.

Index

Constants

View Source
const TagManual = "manual"

TagManual is for stories that CANNOT be triggered by the LLM orienting story.

View Source
const TagPrompt = "prompt"

TagPrompt is for states with LLM prompts.

View Source
const TagTrigger = "trigger"

TagTrigger is for stories that can be triggered by the LLM orienting story.

Variables

View Source
var (

	// AgentBaseStates contains all the states for the AgentLLM machine.
	AgentBaseStates = ssAB
	// AgentBaseGroups contains all the state groups for the AgentLLM machine.
	AgentBaseGroups = sgAB
)
View Source
var (

	// MemStates contains all the states for the Mem machine.
	MemStates = ssM
	// MemGroups contains all the state groups for the Mem machine.
	MemGroups = sgM
)
View Source
var (

	// ToolStates contains all the states for the Tool machine.
	ToolStates = ssT
	// ToolGroups contains all the state groups for the Tool machine.
	ToolGroups = sgT
)
View Source
var AgentSchema = SchemaMerge(

	ssam.BasicSchema,

	ssam.DisposedSchema,

	ssrpc.NetSourceSchema,
	am.Schema{

		ssAB.ErrLLM: {
			Multi:   true,
			Require: S{Exception},
		},
		ssAB.ErrDB: {
			Multi:   true,
			Require: S{Exception},
		},
		ssAB.ErrMem: {
			Multi:   true,
			Require: S{Exception},
		},
		ssAB.ErrUI: {
			Multi:   true,
			Require: S{ssAB.UIMode},
		},

		ssAB.Start: {Add: S{ssAB.BaseDBStarting, ssAB.HistoryDBStarting}},
		ssAB.Ready: {
			Require: S{ssAB.Start},
			Add:     S{ssAB.Loop},
		},

		ssAB.Loop:         {Require: S{ssAB.Ready}},
		ssAB.InputPending: {Remove: S{ssAB.Prompt}},
		ssAB.InputBlocked: {Remove: S{ssAB.Prompt}},
		ssAB.Requesting:   {},
		ssAB.RequestingTool: {
			Multi: true,
			Add:   S{ssAB.Requesting},
		},
		ssAB.RequestingLLM: {
			Multi: true,
			Add:   S{ssAB.Requesting},
		},
		ssAB.Mock: {},

		ssAB.BaseDBStarting: {
			Require: S{ssAB.Start},
			Remove:  S{ssAB.BaseDBReady},
		},
		ssAB.BaseDBReady: {
			Require: S{ssAB.Start},
			Remove:  S{ssAB.BaseDBStarting},
		},
		ssAB.BaseDBSaving: {Multi: true},
		ssAB.HistoryDBStarting: {
			Require: S{ssAB.Start},
			Remove:  S{ssAB.HistoryDBReady},
		},
		ssAB.HistoryDBReady: {
			Require: S{ssAB.Start},
			Remove:  S{ssAB.HistoryDBStarting},
		},

		ssAB.Prompt: {
			Multi:   true,
			Require: S{ssAB.Start},
			Remove:  S{ssAB.InputPending},
		},
		ssAB.Interrupted: {
			Add:    S{ssAB.InputPending},
			Remove: S{ssAB.Resume},
		},
		ssAB.Resume: {
			Remove: S{ssAB.Interrupted},
		},
		ssAB.Msg: {
			Multi:   true,
			Require: S{ssAB.Start},
		},

		ssAB.UIMode:       {},
		ssAB.UIReady:      {Require: S{ssAB.UIMode}},
		ssAB.UIButtonSend: {Require: S{ssAB.UIMode}},
		ssAB.UIButtonIntt: {Require: S{ssAB.UIMode}},
		ssAB.UISaveOutput: {Require: S{ssAB.UIMode}},
		ssAB.UICleanOutput: {
			Multi:   true,
			Require: S{ssAB.UIMode},
		},
		ssAB.UISessConn: {
			Multi:   true,
			Require: S{ssAB.UIMode},
		},
		ssAB.UISessDisconn: {
			Multi:   true,
			Require: S{ssAB.UIMode},
		},
		ssAB.UISrvListening: {Require: S{ssAB.UIMode}},
	})

AgentSchema represents all relations and properties of AgentBaseStates.

View Source
var Exception = am.StateException

Exception is a type alias for the exception state.

View Source
var MemSchema = am.Schema{}

MemSchema represents all relations and properties of MemStates.

View Source
var SAdd = am.SAdd

SAdd is a func alias for merging lists of states.

View Source
var SchemaMerge = am.SchemaMerge

SchemaMerge is a func alias for extending an existing state structure.

View Source
var StateAdd = am.StateAdd

StateAdd is a func alias for adding to an existing state definition.

View Source
var StateSet = am.StateSet

StateSet is a func alias for replacing parts of an existing state definition.

View Source
var ToolSchema = SchemaMerge(

	ssam.BasicSchema,

	ssam.DisposedSchema,

	ssrpc.NetSourceSchema,
	am.Schema{

		ssT.Working: {
			Require: S{ssT.Ready},
			Remove:  S{ssT.Idle},
		},
		ssT.Idle: {
			Auto:    true,
			Require: S{ssT.Ready},
			Remove:  S{ssT.Working},
		},
	})

ToolSchema represents all relations and properties of ToolStates.

Functions

This section is empty.

Types

type AgentBaseGroupsDef added in v0.4.0

type AgentBaseGroupsDef struct{}

AgentBaseGroupsDef contains all the state groups AgentLLM state machine.

type AgentBaseStatesDef added in v0.4.0

type AgentBaseStatesDef struct {
	*am.StatesBase

	ErrLLM string
	ErrDB  string
	ErrMem string
	ErrUI  string

	// AgentLLM is waiting for user input.
	InputPending string
	// User input is blocked by the agent.
	InputBlocked string
	// AgentLLM is currently requesting >=1 tools
	RequestingTool string
	// AgentLLM is currently requesting >=1 LLMs
	RequestingLLM string
	// Requesting implies either RequestingTool or RequestingLLM being active
	Requesting string
	// The machine has been mocked.
	Mock string

	BaseDBStarting string
	BaseDBReady    string
	// BaseDBSaving is lazy query execution.
	BaseDBSaving      string
	HistoryDBStarting string
	HistoryDBReady    string

	// Loop is the agent-user loop (eg dialogue).
	Loop string
	// Prompt is the text the user has sent us.
	Prompt string
	// Interrupted is when the user interrupts the agent, until Resume.
	Interrupted string
	// Resume is the signal from the user to resume after an Interrupted.
	Resume string
	// Msg will output the passed text into the UI.
	Msg string

	UIMode  string
	UIReady string
	// UI button "Send" has been pressed
	UIButtonSend string
	// UI button "Interrupt" has been pressed
	UIButtonIntt   string
	UISaveOutput   string
	UICleanOutput  string
	UISessConn     string
	UISessDisconn  string
	UISrvListening string

	// inherit from BasicStatesDef
	*ssam.BasicStatesDef
	// inherit from DisposedStatesDef
	*ssam.DisposedStatesDef
	// inherit from NetSourceStatesDef
	*ssrpc.NetSourceStatesDef
}

AgentBaseStatesDef contains all the states of the AgentLLM state machine.

type MemGroupsDef added in v0.2.0

type MemGroupsDef struct {
}

MemGroupsDef contains all the state groups Mem state machine.

type MemStatesDef added in v0.2.0

type MemStatesDef struct {
	*am.StatesBase
}

MemStatesDef contains all the states of the Mem state machine.

type S

type S = am.S

S is a type alias for a list of state names.

type State

type State = am.State

State is a type alias for a state definition. See am.State.

type ToolGroupsDef

type ToolGroupsDef struct {
}

ToolGroupsDef contains all the state groups Tool state machine.

type ToolStatesDef

type ToolStatesDef struct {
	*am.StatesBase

	Working string
	Idle    string

	// inherit from BasicStatesDef
	*ssam.BasicStatesDef
	// inherit from DisposedStatesDef
	*ssam.DisposedStatesDef
	// inherit from NetSourceStatesDef
	*ssrpc.NetSourceStatesDef
}

ToolStatesDef contains all the states of the Tool state machine.

type Website

type Website struct {
	URL     string `description:"The URL of the website."`
	Title   string `description:"The title of the website."`
	Content string `description:"The content or a snippet of the website."`
}

Jump to

Keyboard shortcuts

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