agent

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentManager

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

func NewAgentManager

func NewAgentManager() *AgentManager

func (*AgentManager) Chat

func (am *AgentManager) Chat(ctx context.Context, messages []Message, opts ChatOptions) (*Response, error)

func (*AgentManager) ListProviders

func (am *AgentManager) ListProviders() []string

func (*AgentManager) RegisterProvider

func (am *AgentManager) RegisterProvider(name string, provider Provider)

func (*AgentManager) SetActiveProvider

func (am *AgentManager) SetActiveProvider(name string) error

type ChatOptions

type ChatOptions struct {
	Model       string
	Temperature float64
	MaxTokens   int
	Tools       []Tool
}

type ContextTracker

type ContextTracker struct {
	MaxTokens      int
	CurrentTokens  int
	CompactionFunc func() string
}

func (*ContextTracker) AddTokens

func (ct *ContextTracker) AddTokens(n int) bool

func (*ContextTracker) NeedsCompaction

func (ct *ContextTracker) NeedsCompaction() bool

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Provider

type Provider interface {
	Name() string
	Chat(ctx context.Context, messages []Message, opts ChatOptions) (*Response, error)
}

type Response

type Response struct {
	Content string `json:"content"`
	Usage   Usage  `json:"usage"`
}

type RetryConfig

type RetryConfig struct {
	MaxRetries  int
	BackoffBase float64
	Retryable   []int
}

func DefaultRetryConfig

func DefaultRetryConfig() RetryConfig

type StuckLoopDetector

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

func NewStuckLoopDetector

func NewStuckLoopDetector(threshold int) *StuckLoopDetector

func (*StuckLoopDetector) Record

func (d *StuckLoopDetector) Record(toolCall string) bool

func (*StuckLoopDetector) Reset

func (d *StuckLoopDetector) Reset()

type Tool

type Tool struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Parameters  string `json:"parameters"`
}

type Usage

type Usage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

Jump to

Keyboard shortcuts

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