agent

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMaxRetries

func WithMaxRetries(max int) opt

WithMaxRetries sets the maximum number of retries for tool execution.

func WithPersistenceManager

func WithPersistenceManager(pm *persistence.PersistenceManager) opt

WithPersistenceManager sets the persistence manager for the agent.

func WithSkills

func WithSkills(skills *skills.Skills) opt

WithSkills sets the skills available to the agent.

func WithTools

func WithTools(tools ...Tool) opt

WithTools sets the tools available to the agent.

Types

type Agent

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

Agent orchestrates multi-step reasoning with tool calling and memory.

func NewAgent

func NewAgent(session *session.Session, opts ...opt) (*Agent, error)

NewAgent creates a new agent with the given configuration.

func (*Agent) Execute

func (a *Agent) Execute(ctx context.Context, userInput string) (string, error)

Execute processes a user request through the agent loop:

type AgentStrings

type AgentStrings struct {
	IntroPrompt                string
	AvailableSkillsHeader      string
	UseSkillsHint              string
	AvailableToolsHeader       string
	ToolCallInstructions       string
	MultipleToolCallsHint      string
	PreferSkillsHint           string
	UserRequestHeader          string
	ToolExecutionResultsHeader string
	ToolHeader                 string
	InputLabel                 string
	ErrorLabel                 string
	OutputLabel                string
	FinalResponsePrompt        string
	ReplanPrompt               string
}

AgentStrings contains all localizable strings for the agent package

func ChineseStrings

func ChineseStrings() AgentStrings

ChineseStrings returns Chinese language strings

func EnglishStrings

func EnglishStrings() AgentStrings

EnglishStrings returns English language strings

func GetStrings

func GetStrings(locale string) AgentStrings

GetStrings returns the appropriate strings based on locale

type Tool

type Tool interface {
	// Name returns the unique identifier for this tool.
	Name() string
	// Description returns a human-readable explanation of what this tool does.
	Description() string
	// Execute runs the tool with the given input and returns the result.
	Execute(ctx context.Context, input json.RawMessage) (json.RawMessage, error)
}

Tool represents an action that an agent can invoke.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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