agent

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent added in v0.10.0

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

Agent is the agent with real-time tool call display.

func NewAgent added in v0.10.0

func NewAgent(ctx context.Context, config *AgentConfig) (*Agent, error)

NewAgent creates an agent with MCP tool integration and real-time tool call display

func (*Agent) Close added in v0.10.0

func (a *Agent) Close() error

Close closes the agent and cleans up resources

func (*Agent) GenerateWithLoop added in v0.10.0

func (a *Agent) GenerateWithLoop(ctx context.Context, messages []*schema.Message,
	onToolCall ToolCallHandler, onToolExecution ToolExecutionHandler, onToolResult ToolResultHandler, onResponse ResponseHandler, onToolCallContent ToolCallContentHandler) (*schema.Message, error)

GenerateWithLoop processes messages with a custom loop that displays tool calls in real-time

func (*Agent) GetTools added in v0.10.0

func (a *Agent) GetTools() []tool.BaseTool

GetTools returns the list of available tools

type AgentConfig added in v0.10.0

type AgentConfig struct {
	ModelConfig  *models.ProviderConfig
	MCPConfig    *config.Config
	SystemPrompt string
	MaxSteps     int
}

AgentConfig is the config for agent.

type ResponseHandler added in v0.10.0

type ResponseHandler func(content string)

ResponseHandler is a function type for handling LLM responses

type ToolCallContentHandler added in v0.10.0

type ToolCallContentHandler func(content string)

ToolCallContentHandler is a function type for handling content that accompanies tool calls

type ToolCallHandler added in v0.10.0

type ToolCallHandler func(toolName, toolArgs string)

ToolCallHandler is a function type for handling tool calls as they happen

type ToolExecutionHandler added in v0.11.0

type ToolExecutionHandler func(toolName string, isStarting bool)

ToolExecutionHandler is a function type for handling tool execution start/end

type ToolResultHandler added in v0.10.0

type ToolResultHandler func(toolName, toolArgs, result string, isError bool)

ToolResultHandler is a function type for handling tool results

Jump to

Keyboard shortcuts

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