types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	MasterAgent   MasterAgentConfig   `json:"master_agent" yaml:"master_agent" mapstructure:"master_agent"`
	DataAgent     DataAgentConfig     `json:"data_agent" yaml:"data_agent" mapstructure:"data_agent"`
	ResearchAgent ResearchAgentConfig `json:"research_agent" yaml:"research_agent" mapstructure:"research_agent"`
	AutoPlanner   AutoPlannerConfig   `json:"auto_planner" yaml:"auto_planner" mapstructure:"auto_planner"`
}

AgentConfig holds the configuration for all intelligent agents.

type AppConfig

type AppConfig struct {
	Name        string `json:"name" yaml:"name" mapstructure:"name"`                      // Application name
	Version     string `json:"version" yaml:"version" mapstructure:"version"`             // Application version
	Environment string `json:"environment" yaml:"environment" mapstructure:"environment"` // Running environment: development/testing/staging/production
	Debug       bool   `json:"debug" yaml:"debug" mapstructure:"debug"`                   // Whether to enable debug mode
}

AppConfig holds the basic application configuration.

type AutoPlannerConfig added in v0.1.2

type AutoPlannerConfig struct {
	Enabled             bool          `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	LLMModel            string        `json:"llm_model" yaml:"llm_model" mapstructure:"llm_model"`
	ConfidenceThreshold float64       `json:"confidence_threshold" yaml:"confidence_threshold" mapstructure:"confidence_threshold"`
	Timeout             time.Duration `json:"timeout" yaml:"timeout" mapstructure:"timeout"`
	MaxRetries          int           `json:"max_retries" yaml:"max_retries" mapstructure:"max_retries"`
}

AutoPlannerConfig holds the configuration for the LLM-based automatic strategy planner.

type Config

type Config struct {

	// Log module configuration.
	Log LogConfig `json:"log" yaml:"log" mapstructure:"log"` // Logging configuration.

	// Web module configuration.
	Web WebConfig `json:"web" yaml:"web" mapstructure:"web"`

	// Basic application configuration.
	App AppConfig `json:"app" yaml:"app" mapstructure:"app"`

	// Search engine configuration.
	Search SearchConfig `json:"search" yaml:"search" mapstructure:"search"`

	// Models configuration.
	Models ModelsConfig `json:"models" yaml:"models" mapstructure:"models"`

	// MCP (Model Context Protocol) global configuration.
	MCP MCPConfig `json:"mcp" yaml:"mcp" mapstructure:"mcp"`

	// Execution engine configuration.
	Execution ExecutionConfig `json:"execution" yaml:"execution" mapstructure:"execution"`

	// Agents configuration.
	Agents AgentConfig `json:"agents" yaml:"agents" mapstructure:"agents"`
}

Config is the main configuration structure, containing settings for all modules.

type DataAgentConfig added in v0.1.2

type DataAgentConfig struct {
	Name            string                 `json:"name" yaml:"name" mapstructure:"name"`
	Domain          string                 `json:"domain" yaml:"domain" mapstructure:"domain"`
	Description     string                 `json:"description" yaml:"description" mapstructure:"description"`
	Enabled         bool                   `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	DefaultStrategy string                 `json:"default_strategy" yaml:"default_strategy" mapstructure:"default_strategy"`
	Capabilities    []string               `json:"capabilities" yaml:"capabilities" mapstructure:"capabilities"` // 新增:Agent能力描述
	MCPServers      map[string]*MCPRef     `json:"mcp_servers" yaml:"mcp_servers" mapstructure:"mcp_servers"`
	Strategies      map[string]interface{} `json:"strategies" yaml:"strategies" mapstructure:"strategies"`
	Options         DataAgentOptions       `json:"options" yaml:"options" mapstructure:"options"`
}

DataAgentConfig holds the configuration for the DataAgent.

func (*DataAgentConfig) GetCapabilities added in v0.1.2

func (c *DataAgentConfig) GetCapabilities() []string

func (*DataAgentConfig) GetDefaultStrategy added in v0.1.2

func (c *DataAgentConfig) GetDefaultStrategy() string

func (*DataAgentConfig) GetDescription added in v0.1.2

func (c *DataAgentConfig) GetDescription() string

func (*DataAgentConfig) GetDomain added in v0.1.2

func (c *DataAgentConfig) GetDomain() string

func (*DataAgentConfig) GetMCPServers added in v0.1.2

func (c *DataAgentConfig) GetMCPServers() map[string]*MCPRef

func (*DataAgentConfig) GetName added in v0.1.2

func (c *DataAgentConfig) GetName() string

func (*DataAgentConfig) GetStrategies added in v0.1.2

func (c *DataAgentConfig) GetStrategies() map[string]interface{}

type DataAgentOptions added in v0.1.2

type DataAgentOptions struct {
	ConcurrentExecution bool `json:"concurrent_execution" yaml:"concurrent_execution" mapstructure:"concurrent_execution"`
	MaxParallelMCPs     int  `json:"max_parallel_mcps" yaml:"max_parallel_mcps" mapstructure:"max_parallel_mcps"`
	ResultStreaming     bool `json:"result_streaming" yaml:"result_streaming" mapstructure:"result_streaming"`
}

DataAgentOptions holds runtime options for the DataAgent.

type EngineConfig

type EngineConfig struct {
	// Whether this engine is enabled.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// API configuration.
	APIKey    string `json:"api_key" yaml:"api_key" mapstructure:"api_key"`
	SecretKey string `json:"secret_key" yaml:"secret_key" mapstructure:"secret_key"`
	BaseURL   string `json:"base_url" yaml:"base_url" mapstructure:"base_url"`

	// Engine-specific parameters.
	Config map[string]interface{} `json:"config" yaml:"config" mapstructure:"config"`

	// Rate limit configuration.
	RateLimit RateLimitConfig `json:"rate_limit" yaml:"rate_limit" mapstructure:"rate_limit"`
}

EngineConfig holds the configuration for a single search engine.

type ExecutionConfig added in v0.1.2

type ExecutionConfig struct {
	// Global execution settings
	Global GlobalExecutionConfig `json:"global" yaml:"global" mapstructure:"global"`

	// Plan execution settings
	Plan PlanExecutionConfig `json:"plan" yaml:"plan" mapstructure:"plan"`

	// Step execution settings
	Step StepExecutionConfig `json:"step" yaml:"step" mapstructure:"step"`
}

ExecutionConfig holds configuration for task execution.

type GlobalExecutionConfig added in v0.1.2

type GlobalExecutionConfig struct {
	DefaultTimeout     time.Duration `json:"default_timeout" yaml:"default_timeout" mapstructure:"default_timeout"`
	MaxConcurrentTasks int           `json:"max_concurrent_tasks" yaml:"max_concurrent_tasks" mapstructure:"max_concurrent_tasks"`
	EnableRetry        bool          `json:"enable_retry" yaml:"enable_retry" mapstructure:"enable_retry"`
	MaxRetries         int           `json:"max_retries" yaml:"max_retries" mapstructure:"max_retries"`
	RetryDelay         time.Duration `json:"retry_delay" yaml:"retry_delay" mapstructure:"retry_delay"`
}

GlobalExecutionConfig holds global execution configuration.

type GlobalMCPConfig added in v0.1.2

type GlobalMCPConfig struct {
	DefaultTimeout     time.Duration `json:"default_timeout" yaml:"default_timeout" mapstructure:"default_timeout"`
	MaxRetries         int           `json:"max_retries" yaml:"max_retries" mapstructure:"max_retries"`
	RetryDelay         time.Duration `json:"retry_delay" yaml:"retry_delay" mapstructure:"retry_delay"`
	HealthCheckEnabled bool          `json:"health_check_enabled" yaml:"health_check_enabled" mapstructure:"health_check_enabled"`
}

GlobalMCPConfig holds global MCP configuration settings.

type LogConfig

type LogConfig struct {
	Level         string `json:"level" yaml:"level" mapstructure:"level"`                            // Log level: debug/info/warn/error
	FilePath      string `json:"file_path" yaml:"file_path" mapstructure:"file_path"`                // Log file path
	MaxSize       int    `json:"max_size" yaml:"max_size" mapstructure:"max_size"`                   // Maximum size of a single log file in MB
	MaxBackups    int    `json:"max_backups" yaml:"max_backups" mapstructure:"max_backups"`          // Number of old log files to keep
	MaxAge        int    `json:"max_age" yaml:"max_age" mapstructure:"max_age"`                      // Days to retain old log files
	Compress      bool   `json:"compress" yaml:"compress" mapstructure:"compress"`                   // Whether to compress old log files
	Env           string `json:"env" yaml:"env" mapstructure:"env"`                                  // Environment: development/production
	EnableConsole bool   `json:"enable_console" yaml:"enable_console" mapstructure:"enable_console"` // Whether to output logs to the console
}

LogConfig holds the configuration for logging.

type MCPAgentConfig added in v0.1.2

type MCPAgentConfig interface {
	GetName() string
	GetDomain() string
	GetDescription() string
	GetDefaultStrategy() string
	GetMCPServers() map[string]*MCPRef
	GetStrategies() map[string]interface{}
	GetCapabilities() []string
}

MCPAgentConfig defines the interface for configurations of agents that use the MCPAgentBase.

type MCPConfig added in v0.1.2

type MCPConfig struct {
	// Global MCP settings
	Global GlobalMCPConfig `json:"global" yaml:"global" mapstructure:"global"`

	// MCP servers definitions (centralized)
	Servers map[string]MCPServerDefinition `json:"servers" yaml:"servers" mapstructure:"servers"`
}

MCPConfig holds the global MCP configuration.

type MCPRef added in v0.1.2

type MCPRef struct {
	Enabled   bool   `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	ServerRef string `json:"server_ref" yaml:"server_ref" mapstructure:"server_ref"`
	Strategy  string `json:"strategy,omitempty" yaml:"strategy,omitempty" mapstructure:"strategy,omitempty"`
}

MCPRef holds a reference to a globally defined MCP server and an optional strategy override.

type MCPServerDefinition added in v0.1.2

type MCPServerDefinition struct {
	// Required fields
	Type        string   `json:"type" yaml:"type" mapstructure:"type"`                      // Server name (e.g., "postgresql", "mongodb", "filesystem")
	Description string   `json:"description" yaml:"description" mapstructure:"description"` // Human-readable description
	Command     []string `json:"command" yaml:"command" mapstructure:"command"`             // Command to start the server

	// Common optional fields (strongly typed)
	Args           []string          `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args"`
	Env            map[string]string `json:"env,omitempty" yaml:"env,omitempty" mapstructure:"env"`
	Timeout        time.Duration     `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout"`
	MaxConnections int               `json:"max_connections,omitempty" yaml:"max_connections,omitempty" mapstructure:"max_connections"`
}

MCPServerDefinition holds the complete definition of an MCP server. This is the centralized configuration for MCP servers that can be referenced by agents.

type MasterAgentConfig added in v0.1.2

type MasterAgentConfig struct {
	Name         string             `json:"name" yaml:"name" mapstructure:"name"`
	Description  string             `json:"description" yaml:"description" mapstructure:"description"`
	TaskAnalyzer TaskAnalyzerConfig `json:"task_analyzer" yaml:"task_analyzer" mapstructure:"task_analyzer"`
	ResultMerger ResultMergerConfig `json:"result_merger" yaml:"result_merger" mapstructure:"result_merger"`
	StreamMerger StreamMergerConfig `json:"stream_merger" yaml:"stream_merger" mapstructure:"stream_merger"`
}

MasterAgentConfig holds the configuration for the Master Agent.

type ModelConfig

type ModelConfig struct {
	// Model type (e.g., openai, claude, gemini, qwen, deepseek, ollama, ark, qianfan).
	Type string `json:"type" yaml:"type" mapstructure:"type"`

	// Whether this model is enabled.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// API configuration.
	APIKey  string `json:"api_key" yaml:"api_key" mapstructure:"api_key"`
	BaseURL string `json:"base_url" yaml:"base_url" mapstructure:"base_url"`

	// Model name.
	Model string `json:"model" yaml:"model" mapstructure:"model"`

	// Model parameters.
	Temperature      float32 `json:"temperature" yaml:"temperature" mapstructure:"temperature"`
	MaxTokens        int     `json:"max_tokens" yaml:"max_tokens" mapstructure:"max_tokens"`
	TopP             float32 `json:"top_p" yaml:"top_p" mapstructure:"top_p"`
	FrequencyPenalty float32 `json:"frequency_penalty" yaml:"frequency_penalty" mapstructure:"frequency_penalty"`
	PresencePenalty  float32 `json:"presence_penalty" yaml:"presence_penalty" mapstructure:"presence_penalty"`

	// Timeout configuration in seconds.
	TimeoutSeconds int `json:"timeout_seconds" yaml:"timeout_seconds" mapstructure:"timeout_seconds"`

	// Model-specific configuration.
	Config map[string]interface{} `json:"config" yaml:"config" mapstructure:"config"`
}

ModelConfig holds the configuration for a single model.

type ModelsConfig

type ModelsConfig struct {
	// Default model to use.
	DefaultModel string `json:"default_model" yaml:"default_model" mapstructure:"default_model"`

	// Configuration for all available models.
	Models map[string]ModelConfig `json:"models" yaml:"models" mapstructure:"models"`
}

ModelsConfig holds the configuration related to models.

type PlanExecutionConfig added in v0.1.2

type PlanExecutionConfig struct {
	MaxSteps           int           `json:"max_steps" yaml:"max_steps" mapstructure:"max_steps"`
	StepTimeout        time.Duration `json:"step_timeout" yaml:"step_timeout" mapstructure:"step_timeout"`
	EnableParallel     bool          `json:"enable_parallel" yaml:"enable_parallel" mapstructure:"enable_parallel"`
	FailFast           bool          `json:"fail_fast" yaml:"fail_fast" mapstructure:"fail_fast"`
	ContextPropagation bool          `json:"context_propagation" yaml:"context_propagation" mapstructure:"context_propagation"`
}

PlanExecutionConfig holds plan execution configuration.

type RateLimitConfig

type RateLimitConfig struct {
	// Whether to enable rate limiting.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// Maximum requests per second.
	RequestsPerSecond int `json:"requests_per_second" yaml:"requests_per_second" mapstructure:"requests_per_second"`

	// Burst size for requests.
	BurstSize int `json:"burst_size" yaml:"burst_size" mapstructure:"burst_size"`
}

RateLimitConfig holds the rate limiting configuration.

type ResearchAgentConfig added in v0.1.2

type ResearchAgentConfig struct {
	Name             string   `json:"name" yaml:"name" mapstructure:"name"`
	Domain           string   `json:"domain" yaml:"domain" mapstructure:"domain"`
	Description      string   `json:"description" yaml:"description" mapstructure:"description"`
	Enabled          bool     `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	Capabilities     []string `json:"capabilities" yaml:"capabilities" mapstructure:"capabilities"` // 新增:Agent能力描述
	MaxIterations    int      `json:"max_iterations" yaml:"max_iterations" mapstructure:"max_iterations"`
	MaxSteps         int      `json:"max_steps" yaml:"max_steps" mapstructure:"max_steps"`
	MinQuestions     int      `json:"min_questions" yaml:"min_questions" mapstructure:"min_questions"`
	MaxContentLength int      `json:"max_content_length" yaml:"max_content_length" mapstructure:"max_content_length"`
	MaxSingleContent int      `json:"max_single_content" yaml:"max_single_content" mapstructure:"max_single_content"`
	ChannelBuffer    int      `json:"channel_buffer" yaml:"channel_buffer" mapstructure:"channel_buffer"`
}

ResearchAgentConfig holds the configuration for the ResearchAgent.

func (*ResearchAgentConfig) GetCapabilities added in v0.1.2

func (c *ResearchAgentConfig) GetCapabilities() []string

func (*ResearchAgentConfig) GetDefaultStrategy added in v0.1.2

func (c *ResearchAgentConfig) GetDefaultStrategy() string

func (*ResearchAgentConfig) GetDescription added in v0.1.2

func (c *ResearchAgentConfig) GetDescription() string

func (*ResearchAgentConfig) GetDomain added in v0.1.2

func (c *ResearchAgentConfig) GetDomain() string

func (*ResearchAgentConfig) GetMCPServers added in v0.1.2

func (c *ResearchAgentConfig) GetMCPServers() map[string]*MCPRef

func (*ResearchAgentConfig) GetName added in v0.1.2

func (c *ResearchAgentConfig) GetName() string

func (*ResearchAgentConfig) GetStrategies added in v0.1.2

func (c *ResearchAgentConfig) GetStrategies() map[string]interface{}

type ResultMergerConfig added in v0.1.2

type ResultMergerConfig struct {
	EnableSmartMerge  bool          `json:"enable_smart_merge" yaml:"enable_smart_merge" mapstructure:"enable_smart_merge"`
	Timeout           time.Duration `json:"timeout" yaml:"timeout" mapstructure:"timeout"`
	MaxParallelAgents int           `json:"max_parallel_agents" yaml:"max_parallel_agents" mapstructure:"max_parallel_agents"`
	MergeStrategy     string        `json:"merge_strategy" yaml:"merge_strategy" mapstructure:"merge_strategy"`
}

ResultMergerConfig holds the configuration for result merging.

type SearchConfig

type SearchConfig struct {
	// Search strategy configuration.
	Strategy SearchStrategyConfig `json:"strategy" yaml:"strategy" mapstructure:"strategy"`

	// Specific configurations for each search engine.
	Engines map[string]EngineConfig `json:"engines" yaml:"engines" mapstructure:"engines"`
}

SearchConfig holds the configuration related to search functionalities.

type SearchStrategyConfig

type SearchStrategyConfig struct {
	// Search breadth - the number of results to take from each search engine.
	Breadth int `json:"breadth" yaml:"breadth" mapstructure:"breadth"`

	// List of search engines to use for mixed search.
	MixedEngines []string `json:"mixed_engines" yaml:"mixed_engines" mapstructure:"mixed_engines"`

	// Default engine to use if no engine list is specified.
	DefaultEngine string `json:"default_engine" yaml:"default_engine" mapstructure:"default_engine"`

	// Default fallback order if no engine list is specified.
	DefaultFallbackOrder []string `json:"default_fallback_order" yaml:"default_fallback_order" mapstructure:"default_fallback_order"`

	// Whether to enable fallback.
	EnableFallback bool `json:"enable_fallback" yaml:"enable_fallback" mapstructure:"enable_fallback"`

	// Whether to fall back immediately if a single engine fails.
	FailFast bool `json:"fail_fast" yaml:"fail_fast" mapstructure:"fail_fast"`

	// Maximum number of retries.
	MaxRetries int `json:"max_retries" yaml:"max_retries" mapstructure:"max_retries"`

	// Timeout in seconds.
	TimeoutSeconds int `json:"timeout_seconds" yaml:"timeout_seconds" mapstructure:"timeout_seconds"`
}

SearchStrategyConfig holds the configuration for the search strategy.

type StepExecutionConfig added in v0.1.2

type StepExecutionConfig struct {
	MCPTimeout    time.Duration `json:"mcp_timeout" yaml:"mcp_timeout" mapstructure:"mcp_timeout"`
	LLMTimeout    time.Duration `json:"llm_timeout" yaml:"llm_timeout" mapstructure:"llm_timeout"`
	EnableLogging bool          `json:"enable_logging" yaml:"enable_logging" mapstructure:"enable_logging"`
	EnableCaching bool          `json:"enable_caching" yaml:"enable_caching" mapstructure:"enable_caching"`
	CacheTTL      time.Duration `json:"cache_ttl" yaml:"cache_ttl" mapstructure:"cache_ttl"`
	MaxOutputSize int           `json:"max_output_size" yaml:"max_output_size" mapstructure:"max_output_size"`
}

StepExecutionConfig holds step execution configuration.

type StreamMergerConfig added in v0.1.2

type StreamMergerConfig struct {
	BufferSize             int           `json:"buffer_size" yaml:"buffer_size" mapstructure:"buffer_size"`
	OrderByTimestamp       bool          `json:"order_by_timestamp" yaml:"order_by_timestamp" mapstructure:"order_by_timestamp"`
	MergeTimeout           time.Duration `json:"merge_timeout" yaml:"merge_timeout" mapstructure:"merge_timeout"`
	EnableProgressTracking bool          `json:"enable_progress_tracking" yaml:"enable_progress_tracking" mapstructure:"enable_progress_tracking"`
}

StreamMergerConfig holds the configuration for stream merging.

type TaskAnalyzerConfig added in v0.1.2

type TaskAnalyzerConfig struct {
	LLMModel            string        `json:"llm_model" yaml:"llm_model" mapstructure:"llm_model"`
	ConfidenceThreshold float64       `json:"confidence_threshold" yaml:"confidence_threshold" mapstructure:"confidence_threshold"`
	CacheTTL            time.Duration `json:"cache_ttl" yaml:"cache_ttl" mapstructure:"cache_ttl"`
	EnableCache         bool          `json:"enable_cache" yaml:"enable_cache" mapstructure:"enable_cache"`
}

TaskAnalyzerConfig holds the configuration for task analysis.

type WebConfig

type WebConfig struct {
	// Strategy configuration.
	Strategy WebStrategyConfig `json:"strategy" yaml:"strategy" mapstructure:"strategy"`

	// Scrapers is a map of web scraper configurations.
	Scrapers map[string]WebScraperConfig `json:"scrapers" yaml:"scrapers" mapstructure:"scrapers"`
}

WebConfig holds the configuration for the Web module. It includes all settings related to web scraping.

type WebScraperConfig

type WebScraperConfig struct {
	// Enabled indicates whether this scraper is enabled.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// API configuration.
	APIKey  string `json:"api_key" yaml:"api_key" mapstructure:"api_key"`
	BaseURL string `json:"base_url" yaml:"base_url" mapstructure:"base_url"`

	// Scraper-specific parameters.
	Config map[string]interface{} `json:"config" yaml:"config" mapstructure:"config"`
}

WebScraperConfig holds the configuration for a single web scraper (simplified).

type WebStrategyConfig

type WebStrategyConfig struct {
	// DefaultScraper is the default engine to use.
	DefaultScraper string `json:"default_scraper" yaml:"default_scraper" mapstructure:"default_scraper"`

	// DefaultFallbackOrder is the default fallback order.
	DefaultFallbackOrder []string `json:"default_fallback_order" yaml:"default_fallback_order" mapstructure:"default_fallback_order"`

	// EnableFallback determines whether to enable fallback.
	EnableFallback bool `json:"enable_fallback" yaml:"enable_fallback" mapstructure:"enable_fallback"`

	// FailFast determines whether to fall back immediately if a single engine fails.
	FailFast bool `json:"fail_fast" yaml:"fail_fast" mapstructure:"fail_fast"`
}

WebStrategyConfig holds the configuration for the web scraping strategy.

Jump to

Keyboard shortcuts

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