agent

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearAgents

func ClearAgents()

func RegisterFactory

func RegisterFactory(agentType string, factory Factory)

Types

type Agent

type Agent interface {
	GetID() string
	GetName() string
	GetType() string
	GetModel() string
	Initialize(config AgentConfig) error
	SendMessage(ctx context.Context, messages []Message) (string, error)
	StreamMessage(ctx context.Context, messages []Message, writer io.Writer) error
	Announce() string
	IsAvailable() bool
	HealthCheck(ctx context.Context) error
}

func CreateAgent

func CreateAgent(config AgentConfig) (Agent, error)

func GetAgent

func GetAgent(id string) (Agent, bool)

func ListAgents

func ListAgents() []Agent

type AgentConfig

type AgentConfig struct {
	ID             string                 `yaml:"id"`
	Type           string                 `yaml:"type"`
	Name           string                 `yaml:"name"`
	Prompt         string                 `yaml:"prompt"`
	Announcement   string                 `yaml:"announcement"`
	Model          string                 `yaml:"model"`
	Temperature    float64                `yaml:"temperature"`
	MaxTokens      int                    `yaml:"max_tokens"`
	CustomSettings map[string]interface{} `yaml:"custom_settings"`
}

type BaseAgent

type BaseAgent struct {
	ID           string
	Name         string
	Type         string
	Config       AgentConfig
	Announcement string
}

func (*BaseAgent) Announce

func (b *BaseAgent) Announce() string

func (*BaseAgent) GetID

func (b *BaseAgent) GetID() string

func (*BaseAgent) GetModel added in v0.0.15

func (b *BaseAgent) GetModel() string

func (*BaseAgent) GetName

func (b *BaseAgent) GetName() string

func (*BaseAgent) GetType

func (b *BaseAgent) GetType() string

func (*BaseAgent) Initialize

func (b *BaseAgent) Initialize(config AgentConfig) error

type Factory

type Factory func() Agent

type Message

type Message struct {
	AgentID   string
	AgentName string
	Content   string
	Timestamp int64
	Role      string // "agent" or "system"
	Metrics   *ResponseMetrics
}

type Registry

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

type ResponseMetrics

type ResponseMetrics struct {
	Duration     time.Duration
	InputTokens  int
	OutputTokens int
	TotalTokens  int
	Model        string
	Cost         float64
}

Jump to

Keyboard shortcuts

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