agent

package
v0.0.0-...-32dd017 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent orchestrates LLM tool-use conversations.

func New

func New(
	log logger.Logger,
	llmProvider provider.Provider,
	services *baseservices.BaseServices,
	badgerDB *badgerdb.DB,
) *Agent

New creates a new Agent.

func (*Agent) ClearConversation

func (a *Agent) ClearConversation(ctx context.Context, userID int64) error

ClearConversation clears the conversation history for a user.

func (*Agent) Process

func (a *Agent) Process(ctx context.Context, userID int64, text string) (string, error)

Process handles a user message: loads conversation history, runs the agent loop, and returns the final text response.

type ConversationStore

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

ConversationStore manages per-user conversation history in BadgerDB.

func NewConversationStore

func NewConversationStore(db *badgerdb.DB) *ConversationStore

NewConversationStore creates a new ConversationStore.

func (*ConversationStore) Clear

func (s *ConversationStore) Clear(ctx context.Context, userID int64) error

Clear removes conversation history for a user.

func (*ConversationStore) Load

func (s *ConversationStore) Load(ctx context.Context, userID int64) ([]provider.ChatMessage, error)

Load retrieves the conversation history for a user. Returns empty slice if no history exists.

func (*ConversationStore) Save

func (s *ConversationStore) Save(ctx context.Context, userID int64, messages []provider.ChatMessage) error

Save stores conversation history, keeping only the last N messages.

type Executor

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

Executor dispatches tool calls to the appropriate service methods.

func NewExecutor

func NewExecutor(services *baseservices.BaseServices) *Executor

NewExecutor creates a new Executor.

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, userID int64, call provider.ToolCall) (string, error)

Execute runs a tool call and returns the JSON result string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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