agents

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSuccessRate

func CalculateSuccessRate(metrics []*EvaluationMetrics) float64

CalculateSuccessRate calculates success rate from historical metrics

func ClassifyFileType

func ClassifyFileType(filename string) string

ClassifyFileType classifies a file based on its extension

func EnsureAgentsInitialized added in v0.9.9

func EnsureAgentsInitialized() error

EnsureAgentsInitialized is a convenience function that ensures the agent system is initialized. Safe to call multiple times.

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration for display

func GetAverageLatency

func GetAverageLatency(metrics []*EvaluationMetrics) time.Duration

GetAverageLatency calculates average latency from historical metrics

func GetCostEstimate

func GetCostEstimate(plan *ExecutionPlan, model string) float64

GetCostEstimate estimates the cost of a query before execution

func GetDefaultAgentDir added in v0.9.9

func GetDefaultAgentDir() (string, error)

GetDefaultAgentDir returns the appropriate default directory for agents based on whether we're in development mode or deployed

func InitializeUserAgents added in v0.9.9

func InitializeUserAgents() error

InitializeUserAgents ensures ~/.weave-cli/agents/ exists and contains built-in agents. This is called on first run of the deployed CLI.

func IsAgentNotFoundError added in v0.9.0

func IsAgentNotFoundError(err error) bool

IsAgentNotFoundError checks if an error is an AgentNotFoundError

func IsDevelopmentMode added in v0.9.9

func IsDevelopmentMode() bool

IsDevelopmentMode checks if we're running in development mode (i.e., running from the source repository)

func ParseFileList

func ParseFileList(output string) []string

ParseFileList parses output from ls command into file list

func ParseJSONResponse

func ParseJSONResponse(response string, target interface{}) error

ParseJSONResponse is a helper to parse JSON responses

func ValidateAgentByName added in v0.9.0

func ValidateAgentByName(name string) error

ValidateAgentByName is a convenience function that uses the default registry

Types

type Agent

type Agent interface {
	// Name returns the agent's name
	Name() string

	// Execute processes input and returns output
	Execute(ctx context.Context, input interface{}) (interface{}, error)
}

Agent is the base interface for all agents

type AgentConfig added in v0.8.4

type AgentConfig struct {
	LLM           LLMConfig           `yaml:"llm"`
	SchemaAgent   SchemaAgentConfig   `yaml:"schema_agent"`
	ChunkingAgent ChunkingAgentConfig `yaml:"chunking_agent"`
	QueryAgent    QueryAgentConfig    `yaml:"query_agent"`
	PlanningAgent PlanningAgentConfig `yaml:"planning_agent"`
	ReportAgent   ReportAgentConfig   `yaml:"report_agent"`
	EvalAgent     EvalAgentConfig     `yaml:"eval_agent"`
	Output        AgentOutputConfig   `yaml:"output"`
	Cache         CacheConfig         `yaml:"cache"`
	Performance   PerformanceConfig   `yaml:"performance"`
	Features      FeaturesConfig      `yaml:"features"`
}

AgentConfig represents the configuration for AI agents

func LoadAgentConfig added in v0.8.4

func LoadAgentConfig() (*AgentConfig, error)

LoadAgentConfig loads agent configuration from file or returns defaults

func (*AgentConfig) GetMaxTokens added in v0.8.4

func (c *AgentConfig) GetMaxTokens(agentType string) int

GetMaxTokens returns the max tokens to use for an agent

func (*AgentConfig) GetModel added in v0.8.4

func (c *AgentConfig) GetModel(agentType string) string

GetModel returns the model to use for an agent, falling back to defaults

func (*AgentConfig) GetTemperature added in v0.8.4

func (c *AgentConfig) GetTemperature(agentType string) float64

GetTemperature returns the temperature to use for an agent

type AgentInfo added in v0.9.0

type AgentInfo struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Version     string `json:"version"`
	FilePath    string `json:"file_path"`
}

AgentInfo represents metadata about an available agent

func ListAvailableAgents added in v0.9.0

func ListAvailableAgents() ([]AgentInfo, error)

ListAvailableAgents is a convenience function that uses the default registry

type AgentLoader added in v0.9.0

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

AgentLoader handles loading and caching custom agents

func GetDefaultAgentLoader added in v0.9.0

func GetDefaultAgentLoader() *AgentLoader

GetDefaultAgentLoader returns the default global agent loader

func NewAgentLoader added in v0.9.0

func NewAgentLoader() *AgentLoader

NewAgentLoader creates a new agent loader with standard search paths

func (*AgentLoader) AddSearchPath added in v0.9.0

func (l *AgentLoader) AddSearchPath(path string)

AddSearchPath adds a directory to the agent search paths

func (*AgentLoader) AddStandardSearchPaths added in v0.9.0

func (l *AgentLoader) AddStandardSearchPaths()

AddStandardSearchPaths adds the standard agent search paths

func (*AgentLoader) ClearCache added in v0.9.0

func (l *AgentLoader) ClearCache()

ClearCache clears all cached agents

func (*AgentLoader) FindAgentFile added in v0.9.0

func (l *AgentLoader) FindAgentFile(name string) (string, error)

FindAgentFile searches for an agent YAML file in all search paths

func (*AgentLoader) GetCachedAgent added in v0.9.0

func (l *AgentLoader) GetCachedAgent(name string) (*CustomAgentConfig, bool)

GetCachedAgent returns a cached agent without loading from disk

func (*AgentLoader) GetSearchPaths added in v0.9.0

func (l *AgentLoader) GetSearchPaths() []string

GetSearchPaths returns the current search paths

func (*AgentLoader) LoadAgent added in v0.9.0

func (l *AgentLoader) LoadAgent(name string) (*CustomAgentConfig, error)

LoadAgent loads an agent configuration by name Searches in all configured search paths and caches the result

func (*AgentLoader) ReloadAgent added in v0.9.0

func (l *AgentLoader) ReloadAgent(name string) (*CustomAgentConfig, error)

ReloadAgent reloads an agent from disk, bypassing the cache

type AgentNotFoundError added in v0.9.0

type AgentNotFoundError struct {
	AgentName     string
	SearchedPaths []string
}

AgentNotFoundError represents an error when an agent cannot be found

func (*AgentNotFoundError) Error added in v0.9.0

func (e *AgentNotFoundError) Error() string

type AgentOutputConfig added in v0.8.4

type AgentOutputConfig struct {
	DefaultFormat  string `yaml:"default_format"`
	Verbosity      string `yaml:"verbosity"`
	ShowConfidence bool   `yaml:"show_confidence"`
	ShowReasoning  bool   `yaml:"show_reasoning"`
	ShowWarnings   bool   `yaml:"show_warnings"`
}

AgentOutputConfig represents output settings for AI agents

type AgentRegistry added in v0.9.0

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

AgentRegistry manages discovery and validation of available agents

func GetDefaultAgentRegistry added in v0.9.0

func GetDefaultAgentRegistry() *AgentRegistry

GetDefaultAgentRegistry returns the default global agent registry

func NewAgentRegistry added in v0.9.0

func NewAgentRegistry(loader *AgentLoader) *AgentRegistry

NewAgentRegistry creates a new agent registry

func (*AgentRegistry) AgentExists added in v0.9.0

func (r *AgentRegistry) AgentExists(name string) bool

AgentExists checks if an agent exists in the registry

func (*AgentRegistry) GetAgentInfo added in v0.9.0

func (r *AgentRegistry) GetAgentInfo(name string) (*AgentInfo, error)

GetAgentInfo returns metadata about a specific agent without fully loading it

func (*AgentRegistry) GetAgentsByType added in v0.9.0

func (r *AgentRegistry) GetAgentsByType(agentType string) ([]AgentInfo, error)

GetAgentsByType returns all agents of a specific type

func (*AgentRegistry) ListAgents added in v0.9.0

func (r *AgentRegistry) ListAgents() ([]AgentInfo, error)

ListAgents discovers and returns all available agents

func (*AgentRegistry) ValidateAgent added in v0.9.0

func (r *AgentRegistry) ValidateAgent(name string) error

ValidateAgent validates an agent configuration

type BashAgent

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

BashAgent executes bash commands safely

func NewBashAgent

func NewBashAgent() *BashAgent

NewBashAgent creates a new BashAgent

func (*BashAgent) CheckToolInstalled

func (a *BashAgent) CheckToolInstalled(ctx context.Context, tool string) (bool, error)

CheckToolInstalled checks if a tool is installed

func (*BashAgent) Execute

func (a *BashAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute executes a bash command

func (*BashAgent) Name

func (a *BashAgent) Name() string

Name returns the agent's name

func (*BashAgent) SetOutputAgent

func (a *BashAgent) SetOutputAgent(outputAgent *OutputAgent)

SetOutputAgent sets the output agent for user interaction

func (*BashAgent) SuggestInstallation

func (a *BashAgent) SuggestInstallation(tool string) string

SuggestInstallation suggests how to install a missing tool

type BashCommand

type BashCommand struct {
	Command     string            `json:"command"`
	Args        []string          `json:"args"`
	WorkingDir  string            `json:"working_dir,omitempty"`
	Timeout     time.Duration     `json:"timeout,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`
}

BashCommand represents a bash command to execute

type BashResult

type BashResult struct {
	Success  bool          `json:"success"`
	Stdout   string        `json:"stdout"`
	Stderr   string        `json:"stderr"`
	ExitCode int           `json:"exit_code"`
	Duration time.Duration `json:"duration"`
}

BashResult represents result of bash command execution

type CacheConfig added in v0.8.4

type CacheConfig struct {
	Enabled    bool `yaml:"enabled"`
	TTLSeconds int  `yaml:"ttl_seconds"`
	MaxSizeMB  int  `yaml:"max_size_mb"`
}

CacheConfig represents cache settings

type ChunkingAgent added in v0.8.4

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

ChunkingAgent analyzes documents and suggests optimal chunking strategies

func NewChunkingAgent added in v0.8.4

func NewChunkingAgent(llmClient *llm.OpenAIClient) *ChunkingAgent

NewChunkingAgent creates a new chunking analysis agent

func (*ChunkingAgent) Execute added in v0.8.4

func (a *ChunkingAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute analyzes documents and suggests chunking strategy

func (*ChunkingAgent) Name added in v0.8.4

func (a *ChunkingAgent) Name() string

Name returns the agent name

type ChunkingAgentConfig added in v0.8.4

type ChunkingAgentConfig struct {
	Enabled               bool    `yaml:"enabled"`
	Model                 string  `yaml:"model"`
	Temperature           float64 `yaml:"temperature"`
	MaxTokens             int     `yaml:"max_tokens"`
	DefaultChunkSize      int     `yaml:"default_chunk_size"`
	MinChunkSize          int     `yaml:"min_chunk_size"`
	MaxChunkSize          int     `yaml:"max_chunk_size"`
	DefaultOverlapPercent int     `yaml:"default_overlap_percent"`
	MinOverlapPercent     int     `yaml:"min_overlap_percent"`
	MaxOverlapPercent     int     `yaml:"max_overlap_percent"`
	TechnicalChunkSize    int     `yaml:"technical_chunk_size"`
	NarrativeChunkSize    int     `yaml:"narrative_chunk_size"`
	MixedChunkSize        int     `yaml:"mixed_chunk_size"`
}

ChunkingAgentConfig represents chunking agent configuration

type ChunkingAnalysisInput added in v0.8.4

type ChunkingAnalysisInput struct {
	SampleFiles    []string // Paths to sample documents
	CollectionName string   // Target collection name
	VDBType        string   // Target VDB type
	Requirements   string   // User requirements (optional)
	MaxSamples     int      // Max files to analyze (default: 50)
}

ChunkingAnalysisInput represents input for chunking analysis

type ChunkingAnalysisOutput added in v0.8.4

type ChunkingAnalysisOutput struct {
	Recommendation ChunkingRecommendation `json:"chunking_advice"`
	Confidence     float64                `json:"confidence"`
	Warnings       []string               `json:"warnings,omitempty"`
	Metrics        ChunkingMetrics        `json:"metrics,omitempty"`
}

ChunkingAnalysisOutput represents AI-generated chunking recommendations

type ChunkingMetrics added in v0.8.4

type ChunkingMetrics struct {
	AvgContentLength int      `json:"avg_content_length" yaml:"avg_content_length"`
	AvgParagraphs    int      `json:"avg_paragraphs" yaml:"avg_paragraphs"`
	AvgSections      int      `json:"avg_sections" yaml:"avg_sections"`
	AvgParagraphLen  int      `json:"avg_paragraph_len" yaml:"avg_paragraph_len"`
	ContentDensity   string   `json:"content_density" yaml:"content_density"`
	FileTypes        []string `json:"file_types" yaml:"file_types"`
}

ChunkingMetrics represents analyzed chunking characteristics

type ChunkingRecommendation added in v0.8.4

type ChunkingRecommendation struct {
	RecommendedSize int      `json:"recommended_size" yaml:"recommended_size"`
	MinSize         int      `json:"min_size" yaml:"min_size"`
	MaxSize         int      `json:"max_size" yaml:"max_size"`
	OverlapSize     int      `json:"overlap_size" yaml:"overlap_size"`
	Reasoning       string   `json:"reasoning" yaml:"reasoning"`
	DocumentType    string   `json:"document_type" yaml:"document_type"`
	Considerations  []string `json:"considerations,omitempty" yaml:"considerations,omitempty"`
}

ChunkingRecommendation represents AI-powered chunking size recommendations

type CommandReport

type CommandReport struct {
	Type     string        `json:"type"` // "bash", "weave"
	Command  string        `json:"command"`
	Success  bool          `json:"success"`
	Output   string        `json:"output"`
	Error    string        `json:"error,omitempty"`
	Duration time.Duration `json:"duration"`
}

CommandReport represents a single command execution report

type ContextBuilder added in v0.9.0

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

ContextBuilder builds agent context from vector database query results

func NewContextBuilder added in v0.9.0

func NewContextBuilder(config *CustomAgentConfig) *ContextBuilder

NewContextBuilder creates a new context builder with the given agent config

func (*ContextBuilder) BuildContext added in v0.9.0

func (cb *ContextBuilder) BuildContext(query string, results []*vectordb.QueryResult) (*QueryContext, error)

BuildContext converts vector database query results into structured agent context

func (*ContextBuilder) FormatContextForPrompt added in v0.9.0

func (cb *ContextBuilder) FormatContextForPrompt(context *QueryContext) string

FormatContextForPrompt formats the context into a string suitable for LLM prompts

func (*ContextBuilder) FormatContextForPromptWithCitations added in v0.9.0

func (cb *ContextBuilder) FormatContextForPromptWithCitations(context *QueryContext) string

FormatContextForPromptWithCitations formats the context with citation instructions

func (*ContextBuilder) GetSourceByIndex added in v0.9.0

func (cb *ContextBuilder) GetSourceByIndex(context *QueryContext, index int) (*SourceContext, error)

GetSourceByIndex retrieves a source by its citation index

func (*ContextBuilder) GetSourceCount added in v0.9.0

func (cb *ContextBuilder) GetSourceCount(context *QueryContext) int

GetSourceCount returns the number of sources in the context

type CustomAgentConfig added in v0.9.0

type CustomAgentConfig struct {
	// Metadata
	Name        string `yaml:"name"`
	Type        string `yaml:"type"` // rag, summarize, qa, custom
	Description string `yaml:"description"`
	Version     string `yaml:"version,omitempty"`
	Author      string `yaml:"author,omitempty"`

	// LLM Configuration
	LLM CustomAgentLLMConfig `yaml:"llm"`

	// Prompts
	SystemPrompt        string `yaml:"system_prompt"`
	UserPromptTemplate  string `yaml:"user_prompt_template,omitempty"`
	AssistantPromptHint string `yaml:"assistant_prompt_hint,omitempty"`

	// Response Configuration
	Response CustomAgentResponseConfig `yaml:"response,omitempty"`

	// Output Configuration
	Output CustomAgentOutputConfig `yaml:"output,omitempty"`

	// Features
	Features CustomAgentFeaturesConfig `yaml:"features,omitempty"`

	// Performance
	Performance CustomAgentPerformanceConfig `yaml:"performance,omitempty"`
}

CustomAgentConfig represents a custom agent loaded from YAML

func GetCustomTemplate added in v0.9.9

func GetCustomTemplate() *CustomAgentConfig

GetCustomTemplate returns a minimal custom agent template

func GetQATemplate added in v0.9.9

func GetQATemplate() *CustomAgentConfig

GetQATemplate returns a QA agent template configuration

func GetRAGTemplate added in v0.9.9

func GetRAGTemplate() *CustomAgentConfig

GetRAGTemplate returns a RAG agent template configuration

func GetSummarizeTemplate added in v0.9.9

func GetSummarizeTemplate() *CustomAgentConfig

GetSummarizeTemplate returns a summarization agent template configuration

func LoadAgent added in v0.9.0

func LoadAgent(name string) (*CustomAgentConfig, error)

LoadAgent is a convenience function that uses the default agent loader

func LoadCustomAgentConfig added in v0.9.0

func LoadCustomAgentConfig(filepath string) (*CustomAgentConfig, error)

LoadCustomAgentConfig loads a custom agent configuration from a YAML file

func (*CustomAgentConfig) GetLLMMaxTokens added in v0.9.0

func (c *CustomAgentConfig) GetLLMMaxTokens() int

GetLLMMaxTokens returns the max tokens setting

func (*CustomAgentConfig) GetLLMModel added in v0.9.0

func (c *CustomAgentConfig) GetLLMModel() string

GetLLMModel returns the LLM model to use

func (*CustomAgentConfig) GetLLMTemperature added in v0.9.0

func (c *CustomAgentConfig) GetLLMTemperature() float64

GetLLMTemperature returns the LLM temperature setting

func (*CustomAgentConfig) GetSystemPrompt added in v0.9.0

func (c *CustomAgentConfig) GetSystemPrompt() string

GetSystemPrompt returns the system prompt

func (*CustomAgentConfig) IsRAGType added in v0.9.0

func (c *CustomAgentConfig) IsRAGType() bool

IsRAGType returns true if this is a RAG-type agent

func (*CustomAgentConfig) Validate added in v0.9.0

func (c *CustomAgentConfig) Validate() error

Validate validates the agent configuration

type CustomAgentFeaturesConfig added in v0.9.0

type CustomAgentFeaturesConfig struct {
	Streaming    bool `yaml:"streaming,omitempty"`
	MultiTurn    bool `yaml:"multi_turn,omitempty"`
	FactChecking bool `yaml:"fact_checking,omitempty"`
}

CustomAgentFeaturesConfig represents feature flags

type CustomAgentLLMConfig added in v0.9.0

type CustomAgentLLMConfig struct {
	Provider         string  `yaml:"provider,omitempty"` // openai, anthropic
	Model            string  `yaml:"model"`
	Temperature      float64 `yaml:"temperature,omitempty"`
	MaxTokens        int     `yaml:"max_tokens,omitempty"`
	TopP             float64 `yaml:"top_p,omitempty"`
	FrequencyPenalty float64 `yaml:"frequency_penalty,omitempty"`
	PresencePenalty  float64 `yaml:"presence_penalty,omitempty"`
}

CustomAgentLLMConfig represents LLM settings for a custom agent

type CustomAgentOutputConfig added in v0.9.0

type CustomAgentOutputConfig struct {
	Format          string `yaml:"format,omitempty"` // markdown, text, json
	IncludeMetadata bool   `yaml:"include_metadata,omitempty"`
	ShowConfidence  bool   `yaml:"show_confidence,omitempty"`
	ShowSources     bool   `yaml:"show_sources,omitempty"`
	TruncateSources int    `yaml:"truncate_sources,omitempty"` // characters
}

CustomAgentOutputConfig represents output formatting configuration

type CustomAgentPerformanceConfig added in v0.9.0

type CustomAgentPerformanceConfig struct {
	TimeoutSeconds int  `yaml:"timeout_seconds,omitempty"`
	MaxRetries     int  `yaml:"max_retries,omitempty"`
	CacheResponses bool `yaml:"cache_responses,omitempty"`
}

CustomAgentPerformanceConfig represents performance settings

type CustomAgentResponseConfig added in v0.9.0

type CustomAgentResponseConfig struct {
	IncludeReferences  bool    `yaml:"include_references,omitempty"`
	CitationFormat     string  `yaml:"citation_format,omitempty"` // numeric, author-year, footnote
	MaxContextChunks   int     `yaml:"max_context_chunks,omitempty"`
	MinRelevanceScore  float64 `yaml:"min_relevance_score,omitempty"`
	DeduplicateSources bool    `yaml:"deduplicate_sources,omitempty"`
	SortByRelevance    bool    `yaml:"sort_by_relevance,omitempty"`
	StrictMode         bool    `yaml:"strict_mode,omitempty"`
}

CustomAgentResponseConfig represents response formatting configuration

type DocumentSample added in v0.8.4

type DocumentSample struct {
	Path    string
	Type    string
	Size    int64
	Fields  map[string]interface{}
	Preview string // First 1000 chars
}

DocumentSample represents a sampled document

type DocumentStructure added in v0.8.4

type DocumentStructure struct {
	Samples        []DocumentSample
	FileTypes      []string
	CommonFields   map[string]int    // field -> frequency
	FieldTypes     map[string]string // field -> inferred type
	ContentLengths []int
	Languages      []string
	// Chunking analysis fields
	ParagraphCounts []int  // paragraph count per document
	SectionCounts   []int  // section count per document
	AvgParagraphLen int    // average paragraph length
	ContentDensity  string // "sparse", "medium", "dense"
}

DocumentStructure represents analyzed document structure

type EvalAgent

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

EvalAgent evaluates query execution and tracks metrics

func NewEvalAgent

func NewEvalAgent(llmClient llm.Client) *EvalAgent

NewEvalAgent creates a new EvalAgent

func (*EvalAgent) Execute

func (a *EvalAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute evaluates the operation report and generates metrics

func (*EvalAgent) Name

func (a *EvalAgent) Name() string

Name returns the agent's name

func (*EvalAgent) TrackMetrics

func (a *EvalAgent) TrackMetrics(metrics *EvaluationMetrics) error

TrackMetrics tracks metrics (placeholder for Opik integration)

type EvalAgentConfig added in v0.8.4

type EvalAgentConfig struct {
	Enabled     bool    `yaml:"enabled"`
	Temperature float64 `yaml:"temperature"`
	MaxTokens   int     `yaml:"max_tokens"`
}

EvalAgentConfig represents eval agent configuration

type EvaluationMetrics

type EvaluationMetrics struct {
	QueryID          string        `json:"query_id"`
	Success          bool          `json:"success"`
	IntentMatched    bool          `json:"intent_matched"`
	LLMInvocations   int           `json:"llm_invocations"`
	TotalTokens      int           `json:"total_tokens"`
	PromptTokens     int           `json:"prompt_tokens"`
	CompletionTokens int           `json:"completion_tokens"`
	TotalCost        float64       `json:"total_cost"`
	Latency          time.Duration `json:"latency"`
	ErrorRate        float64       `json:"error_rate"`
	UserSatisfaction *float64      `json:"user_satisfaction,omitempty"`
}

EvaluationMetrics represents evaluation metrics for a query

type ExecutionPlan

type ExecutionPlan struct {
	Steps       []ExecutionStep `json:"steps"`
	Summary     string          `json:"summary"`
	Warnings    []string        `json:"warnings,omitempty"`
	Estimations struct {
		Duration string `json:"duration"`
		Risk     string `json:"risk"` // "low", "medium", "high"
	} `json:"estimations"`
}

ExecutionPlan represents a complete execution plan

type ExecutionStep

type ExecutionStep struct {
	Type        string                 `json:"type"` // "bash", "weave", "confirm"
	Command     string                 `json:"command"`
	Description string                 `json:"description"`
	Args        []string               `json:"args,omitempty"`
	Params      map[string]interface{} `json:"params,omitempty"`
	DependsOn   []int                  `json:"depends_on,omitempty"` // Step indices
	Optional    bool                   `json:"optional"`
	Destructive bool                   `json:"destructive"`
}

ExecutionStep represents a single step in an execution plan

type FeaturesConfig added in v0.8.4

type FeaturesConfig struct {
	Experimental bool `yaml:"experimental"`
	Debug        bool `yaml:"debug"`
	Telemetry    bool `yaml:"telemetry"`
}

FeaturesConfig represents feature flags

type FieldConfig added in v0.8.4

type FieldConfig struct {
	Name        string `yaml:"name" json:"name"`
	Type        string `yaml:"type" json:"type"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	Indexed     bool   `yaml:"indexed" json:"indexed"`
	Filterable  bool   `yaml:"filterable" json:"filterable"`
	Required    bool   `yaml:"required" json:"required"`
}

FieldConfig represents a field configuration

type FieldSuggestion added in v0.8.4

type FieldSuggestion struct {
	Name        string        `json:"name"`
	Type        string        `json:"type"`
	Indexed     bool          `json:"indexed"`
	Filterable  bool          `json:"filterable"`
	Required    bool          `json:"required"`
	Examples    []interface{} `json:"examples"`
	Frequency   float64       `json:"frequency"`
	Cardinality int           `json:"cardinality"`
	Reasoning   string        `json:"reasoning"`
}

FieldSuggestion represents analysis for a single field

type FilterInfo added in v0.9.0

type FilterInfo struct {
	MinRelevanceScore float64 `json:"min_relevance_score,omitempty"`
	MaxContextChunks  int     `json:"max_context_chunks,omitempty"`
	Deduplicated      bool    `json:"deduplicated,omitempty"`
	SortedByRelevance bool    `json:"sorted_by_relevance,omitempty"`
}

FilterInfo describes what filters were applied

type IndexConfig added in v0.8.4

type IndexConfig struct {
	Name   string   `yaml:"name" json:"name"`
	Fields []string `yaml:"fields" json:"fields"`
	Type   string   `yaml:"type" json:"type"` // "vector", "bm25", "composite"
}

IndexConfig represents an index configuration

type LLMConfig added in v0.8.4

type LLMConfig struct {
	Provider           string  `yaml:"provider"`
	APIKeyEnv          string  `yaml:"api_key_env"`
	DefaultModel       string  `yaml:"default_model"`
	DefaultTemperature float64 `yaml:"default_temperature"`
	DefaultMaxTokens   int     `yaml:"default_max_tokens"`
}

LLMConfig represents LLM provider configuration

type OperationReport

type OperationReport struct {
	QueryIntent     string          `json:"query_intent"`
	ExecutedSteps   int             `json:"executed_steps"`
	SuccessfulSteps int             `json:"successful_steps"`
	FailedSteps     int             `json:"failed_steps"`
	StartTime       time.Time       `json:"start_time"`
	EndTime         time.Time       `json:"end_time"`
	Duration        time.Duration   `json:"duration"`
	Commands        []CommandReport `json:"commands"`
	Summary         string          `json:"summary"`
	Recommendations []string        `json:"recommendations,omitempty"`
	NextSteps       []string        `json:"next_steps,omitempty"`
}

OperationReport represents a complete operation report

func CreateReport

func CreateReport(intent string, startTime time.Time, commands []CommandReport) *OperationReport

CreateReport creates an operation report from execution results

type OutputAgent

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

OutputAgent formats and displays information to users

func NewOutputAgent

func NewOutputAgent(config OutputConfig) *OutputAgent

NewOutputAgent creates a new OutputAgent

func (*OutputAgent) AskConfirmation

func (a *OutputAgent) AskConfirmation(message string) (bool, error)

AskConfirmation asks the user for confirmation

func (*OutputAgent) CreateProgressBar

func (a *OutputAgent) CreateProgressBar(max int, description string) *progressbar.ProgressBar

CreateProgressBar creates a progress bar for tracking operations

func (*OutputAgent) Execute

func (a *OutputAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute formats and displays output (not typically used directly)

func (*OutputAgent) Name

func (a *OutputAgent) Name() string

Name returns the agent's name

func (*OutputAgent) PrintCommandOutput

func (a *OutputAgent) PrintCommandOutput(output string)

PrintCommandOutput prints the output from a command execution

func (*OutputAgent) PrintCommandResult

func (a *OutputAgent) PrintCommandResult(report *CommandReport)

PrintCommandResult prints the result of a command execution

func (*OutputAgent) PrintError

func (a *OutputAgent) PrintError(message string)

PrintError prints an error message

func (*OutputAgent) PrintInfo

func (a *OutputAgent) PrintInfo(message string)

PrintInfo prints an info message

func (*OutputAgent) PrintMetrics

func (a *OutputAgent) PrintMetrics(metrics *EvaluationMetrics)

PrintMetrics prints evaluation metrics

func (*OutputAgent) PrintPlan

func (a *OutputAgent) PrintPlan(plan *ExecutionPlan)

PrintPlan displays the execution plan to the user

func (*OutputAgent) PrintRejectionMessage

func (a *OutputAgent) PrintRejectionMessage(reason string)

PrintRejectionMessage prints a message when query is rejected

func (*OutputAgent) PrintStepCompletion

func (a *OutputAgent) PrintStepCompletion(stepNum int, duration time.Duration)

PrintStepCompletion prints step completion with duration

func (*OutputAgent) PrintStepError

func (a *OutputAgent) PrintStepError(stepNum int, errMsg string)

PrintStepError prints step error

func (*OutputAgent) PrintStepProgress

func (a *OutputAgent) PrintStepProgress(stepNum int, step *ExecutionStep, status string)

PrintStepProgress prints progress for a step

func (*OutputAgent) PrintSuccess

func (a *OutputAgent) PrintSuccess(message string)

PrintSuccess prints a success message

func (*OutputAgent) PrintWarning

func (a *OutputAgent) PrintWarning(message string)

PrintWarning prints a warning message

type OutputConfig

type OutputConfig struct {
	NoColor      bool
	Verbose      bool
	Quiet        bool
	OutputFormat string // "text", "json", "yaml"
}

OutputConfig configures the OutputAgent

type PerformanceConfig added in v0.8.4

type PerformanceConfig struct {
	LLMTimeout         int `yaml:"llm_timeout"`
	MaxConcurrentFiles int `yaml:"max_concurrent_files"`
	MaxRetries         int `yaml:"max_retries"`
	RetryDelayMS       int `yaml:"retry_delay_ms"`
}

PerformanceConfig represents performance settings

type PlanningAgent

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

PlanningAgent creates execution plans for queries

func NewPlanningAgent

func NewPlanningAgent(llmClient llm.Client, mcpTools []string) *PlanningAgent

NewPlanningAgent creates a new PlanningAgent with tool names only

func NewPlanningAgentWithTools

func NewPlanningAgentWithTools(llmClient llm.Client, tools []mcp.Tool) *PlanningAgent

NewPlanningAgentWithTools creates a new PlanningAgent with full tool information

func (*PlanningAgent) Execute

func (a *PlanningAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute creates an execution plan for the query

func (*PlanningAgent) Name

func (a *PlanningAgent) Name() string

Name returns the agent's name

type PlanningAgentConfig added in v0.8.4

type PlanningAgentConfig struct {
	Enabled     bool    `yaml:"enabled"`
	Model       string  `yaml:"model"`
	Temperature float64 `yaml:"temperature"`
	MaxTokens   int     `yaml:"max_tokens"`
}

PlanningAgentConfig represents planning agent configuration

type PlanningAgentInput

type PlanningAgentInput struct {
	FixedQuery string `json:"fixed_query"`
	Intent     string `json:"intent"`
}

PlanningAgentInput is input for PlanningAgent

type QueryAgent

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

QueryAgent validates and normalizes user queries

func NewQueryAgent

func NewQueryAgent(llmClient llm.Client) *QueryAgent

NewQueryAgent creates a new QueryAgent

func (*QueryAgent) Execute

func (a *QueryAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute processes the query and determines if it's weave-related

func (*QueryAgent) Name

func (a *QueryAgent) Name() string

Name returns the agent's name

func (*QueryAgent) SetMCPTools

func (a *QueryAgent) SetMCPTools(tools []string)

SetMCPTools sets the available MCP tools for validation

type QueryAgentConfig added in v0.8.4

type QueryAgentConfig struct {
	Enabled     bool    `yaml:"enabled"`
	Model       string  `yaml:"model"`
	Temperature float64 `yaml:"temperature"`
	MaxTokens   int     `yaml:"max_tokens"`
}

QueryAgentConfig represents query agent configuration

type QueryAgentInput

type QueryAgentInput struct {
	Query string `json:"query"`
}

QueryAgentInput is input for QueryAgent

type QueryAgentOutput

type QueryAgentOutput struct {
	IsWeaveQuery bool    `json:"is_weave_query"`
	FixedQuery   string  `json:"fixed_query"`
	Intent       string  `json:"intent"` // "list", "create", "query", "delete", etc.
	Confidence   float64 `json:"confidence"`
	Reason       string  `json:"reason"`
}

QueryAgentOutput is output from QueryAgent

type QueryContext added in v0.9.0

type QueryContext struct {
	Query        string          `json:"query"`
	Sources      []SourceContext `json:"sources"`
	TotalResults int             `json:"total_results"`
	FilteredBy   FilterInfo      `json:"filtered_by,omitempty"`
}

QueryContext represents context built from query results

func BuildContextFromQueryResults added in v0.9.0

func BuildContextFromQueryResults(query string, results []*vectordb.QueryResult, config *CustomAgentConfig) (*QueryContext, error)

BuildContextFromQueryResults is a convenience function that creates a context builder and builds context

type RAGAgent added in v0.9.0

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

RAGAgent implements RAG (Retrieval-Augmented Generation) pattern

func NewRAGAgent added in v0.9.0

func NewRAGAgent(config *CustomAgentConfig, llmClient llm.Client) (*RAGAgent, error)

NewRAGAgent creates a new RAG agent

func (*RAGAgent) Execute added in v0.9.0

func (a *RAGAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute processes the RAG request

func (*RAGAgent) FormatOutput added in v0.9.0

func (a *RAGAgent) FormatOutput(output *RAGOutput) (string, error)

FormatOutput formats the RAG output based on the configured format

func (*RAGAgent) GetConfig added in v0.9.0

func (a *RAGAgent) GetConfig() *CustomAgentConfig

GetConfig returns the agent configuration

func (*RAGAgent) GetType added in v0.9.0

func (a *RAGAgent) GetType() string

GetType returns the agent type

func (*RAGAgent) IsRAGType added in v0.9.0

func (a *RAGAgent) IsRAGType() bool

IsRAGType returns true if this is a RAG-type agent

func (*RAGAgent) Name added in v0.9.0

func (a *RAGAgent) Name() string

Name returns the agent's name

type RAGInput added in v0.9.0

type RAGInput struct {
	Query   string                  `json:"query"`
	Results []*vectordb.QueryResult `json:"results"`
}

RAGInput is input for RAG agent

type RAGMetadata added in v0.9.0

type RAGMetadata struct {
	TotalSources int     `json:"total_sources"`
	SourcesUsed  int     `json:"sources_used"`
	MinRelevance float64 `json:"min_relevance"`
	MaxRelevance float64 `json:"max_relevance"`
	AvgRelevance float64 `json:"avg_relevance"`
	Model        string  `json:"model"`
	Temperature  float64 `json:"temperature"`
}

RAGMetadata contains metadata about the RAG response

type RAGOutput added in v0.9.0

type RAGOutput struct {
	Answer     string           `json:"answer"`
	Sources    []SourceCitation `json:"sources,omitempty"`
	Confidence float64          `json:"confidence,omitempty"`
	Metadata   *RAGMetadata     `json:"metadata,omitempty"`
}

RAGOutput is output from RAG agent

type ReportAgent

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

ReportAgent creates comprehensive operation reports

func NewReportAgent

func NewReportAgent(outputAgent *OutputAgent, llmClient llm.Client) *ReportAgent

NewReportAgent creates a new ReportAgent

func (*ReportAgent) Execute

func (a *ReportAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute generates a report from the operation results

func (*ReportAgent) Name

func (a *ReportAgent) Name() string

Name returns the agent's name

func (*ReportAgent) PrintReport

func (a *ReportAgent) PrintReport(report *OperationReport)

PrintReport displays the operation report

type ReportAgentConfig added in v0.8.4

type ReportAgentConfig struct {
	Enabled     bool    `yaml:"enabled"`
	Temperature float64 `yaml:"temperature"`
	MaxTokens   int     `yaml:"max_tokens"`
}

ReportAgentConfig represents report agent configuration

type SchemaAgent added in v0.8.4

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

SchemaAgent analyzes documents and suggests collection schemas

func NewSchemaAgent added in v0.8.4

func NewSchemaAgent(llmClient *llm.OpenAIClient) *SchemaAgent

NewSchemaAgent creates a new schema analysis agent

func (*SchemaAgent) Execute added in v0.8.4

func (a *SchemaAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute analyzes documents and suggests a schema

func (*SchemaAgent) Name added in v0.8.4

func (a *SchemaAgent) Name() string

Name returns the agent name

type SchemaAgentConfig added in v0.8.4

type SchemaAgentConfig struct {
	Enabled                 bool    `yaml:"enabled"`
	Model                   string  `yaml:"model"`
	Temperature             float64 `yaml:"temperature"`
	MaxTokens               int     `yaml:"max_tokens"`
	MaxSamples              int     `yaml:"max_samples"`
	DefaultVectorDimensions int     `yaml:"default_vector_dimensions"`
	MinConfidence           float64 `yaml:"min_confidence"`
	WarnBelowConfidence     float64 `yaml:"warn_below_confidence"`
}

SchemaAgentConfig represents schema agent configuration

type SchemaAnalysisInput added in v0.8.4

type SchemaAnalysisInput struct {
	SampleFiles    []string // Paths to sample documents
	CollectionName string   // Target collection name
	Requirements   string   // User requirements (optional)
	VDBType        string   // Target VDB type
	MaxSamples     int      // Max files to analyze (default: 50)
}

SchemaAnalysisInput represents input for schema analysis

type SchemaAnalysisOutput added in v0.8.4

type SchemaAnalysisOutput struct {
	Schema         SchemaConfig            `json:"schema"`
	Reasoning      string                  `json:"reasoning"`
	FieldAnalysis  []FieldSuggestion       `json:"field_analysis"`
	Confidence     float64                 `json:"confidence"`
	Warnings       []string                `json:"warnings"`
	Alternatives   []SchemaConfig          `json:"alternatives,omitempty"`
	ChunkingAdvice *ChunkingRecommendation `json:"chunking_advice,omitempty"`
}

SchemaAnalysisOutput represents AI-generated schema suggestion

type SchemaConfig added in v0.8.4

type SchemaConfig struct {
	CollectionName   string                 `yaml:"collection_name" json:"collection_name"`
	VectorDimensions int                    `yaml:"vector_dimensions" json:"vector_dimensions"`
	SimilarityMetric string                 `yaml:"similarity_metric" json:"similarity_metric"`
	Fields           []FieldConfig          `yaml:"fields" json:"fields"`
	Indexes          []IndexConfig          `yaml:"indexes" json:"indexes"`
	Metadata         map[string]interface{} `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}

SchemaConfig represents a complete schema configuration

type SourceCitation added in v0.9.0

type SourceCitation struct {
	Index    int                    `json:"index"`
	Content  string                 `json:"content,omitempty"`
	Score    float64                `json:"score"`
	DocID    string                 `json:"doc_id"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

SourceCitation represents a cited source

type SourceContext added in v0.9.0

type SourceContext struct {
	Index    int                    `json:"index"`    // Citation index (1-based)
	Content  string                 `json:"content"`  // Document content
	Score    float64                `json:"score"`    // Relevance score
	DocID    string                 `json:"doc_id"`   // Document ID
	Metadata map[string]interface{} `json:"metadata"` // Document metadata
}

SourceContext represents a single source document with relevance

type WeaveAgent

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

WeaveAgent executes weave-cli commands via MCP

func NewWeaveAgent

func NewWeaveAgent(mcpClient *mcp.Client) *WeaveAgent

NewWeaveAgent creates a new WeaveAgent

func (*WeaveAgent) Execute

func (a *WeaveAgent) Execute(ctx context.Context, input interface{}) (interface{}, error)

Execute executes a weave command via MCP

func (*WeaveAgent) InferMissingArguments

func (a *WeaveAgent) InferMissingArguments(tool string, args map[string]interface{}, context map[string]interface{}) map[string]interface{}

InferMissingArguments attempts to infer missing arguments from context

func (*WeaveAgent) Name

func (a *WeaveAgent) Name() string

Name returns the agent's name

func (*WeaveAgent) SetVerbose added in v0.3.1

func (a *WeaveAgent) SetVerbose(verbose bool)

SetVerbose sets verbose mode for debug logging

func (*WeaveAgent) ValidateArguments

func (a *WeaveAgent) ValidateArguments(tool string, args map[string]interface{}) error

ValidateArguments validates that required arguments are present

type WeaveAgentCommand

type WeaveAgentCommand struct {
	Tool      string                 `json:"tool"`
	Arguments map[string]interface{} `json:"arguments"`
	Timeout   time.Duration          `json:"timeout,omitempty"`
}

WeaveAgentCommand represents a weave-cli command to execute

type WeaveAgentResult

type WeaveAgentResult struct {
	Success  bool          `json:"success"`
	Output   interface{}   `json:"output"`
	Error    string        `json:"error,omitempty"`
	Duration time.Duration `json:"duration"`
	Retries  int           `json:"retries"`
}

WeaveAgentResult represents result of weave command execution

Jump to

Keyboard shortcuts

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