Documentation
¶
Index ¶
- type AgentTask
- type DataInsightsInfo
- type IntelligentSummary
- type MasterAgent
- type MergeStrategy
- type ResultMerger
- type StreamMerger
- type StreamMergerConfig
- type StreamingExecutor
- type StreamingExecutorConfig
- type TaskAnalyzer
- func (ta *TaskAnalyzer) Analyze(ctx context.Context, task *sdktypes.Task) (*sdktypes.AgentRequirements, error)
- func (ta *TaskAnalyzer) AnalyzeWithDynamicAgents(ctx context.Context, task *sdktypes.Task, agents map[string]domain.DomainAgent) (*sdktypes.AgentRequirements, error)
- func (ta *TaskAnalyzer) SetDynamicAgents(agents map[string]domain.DomainAgent)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentTask ¶
type AgentTask struct {
Agent domain.DomainAgent
SubTask *sdktypes.Task
}
AgentTask represents an agent and its corresponding sub-task
type DataInsightsInfo ¶
type DataInsightsInfo struct {
KeyDataPoints []string `json:"key_data_points"`
DataRelationships string `json:"data_relationships"`
}
DataInsightsInfo 数据洞察信息
type IntelligentSummary ¶
type IntelligentSummary struct {
Summary string `json:"summary"`
KeyFindings []string `json:"key_findings"`
AgentContributions map[string]string `json:"agent_contributions"`
DataInsights DataInsightsInfo `json:"data_insights"`
Recommendations []string `json:"recommendations"`
Confidence float64 `json:"confidence"`
}
IntelligentSummary 智能总结结构
type MasterAgent ¶
type MasterAgent struct {
// contains filtered or unexported fields
}
MasterAgent is the central controlling agent in the Strato SDK. It analyzes tasks using LLM, routes them to the appropriate domain agents, and merges the results.
func NewMasterAgent ¶
func NewMasterAgent(resultMerger *ResultMerger, streamMerger *StreamMerger) *MasterAgent
NewMasterAgent is a constructor for manual dependency injection, primarily for testing.
func NewMasterAgentFromConfig ¶
func NewMasterAgentFromConfig(ctx context.Context, cfg *types.AgentConfig) (*MasterAgent, error)
NewMasterAgentFromConfig creates a new MasterAgent and its sub-components from configuration.
func (*MasterAgent) ProcessTask ¶
func (ma *MasterAgent) ProcessTask(ctx context.Context, task *sdktypes.Task) (*sdktypes.ExecutionHandle, error)
ProcessTask is the main entry point for handling a user task. It uses LLM to analyze the user query, determines which agents to use, and executes them.
func (*MasterAgent) RegisterAgent ¶
func (ma *MasterAgent) RegisterAgent(agent domain.DomainAgent)
RegisterAgent adds a domain agent to the MasterAgent's registry.
type MergeStrategy ¶
type MergeStrategy string
MergeStrategy defines different result merging strategies
const ( MergeStrategySimple MergeStrategy = "simple" MergeStrategyWeighted MergeStrategy = "weighted" MergeStrategyPriority MergeStrategy = "priority" MergeStrategyIntelligent MergeStrategy = "intelligent" // 新增:智能合并策略 )
type ResultMerger ¶
type ResultMerger struct {
// contains filtered or unexported fields
}
ResultMerger is responsible for merging final results from multiple agents into a single, cohesive result with optional LLM-powered intelligent summarization.
func NewResultMerger ¶
func NewResultMerger(strategy MergeStrategy) *ResultMerger
NewResultMerger creates a new ResultMerger with the specified strategy.
func NewResultMergerWithLLM ¶
func NewResultMergerWithLLM(strategy MergeStrategy, llmClient *llm.ChatModelWrapper, enableSmartMerge bool) *ResultMerger
NewResultMergerWithLLM creates a ResultMerger with LLM-powered intelligent summarization.
type StreamMerger ¶
type StreamMerger struct {
// contains filtered or unexported fields
}
StreamMerger is responsible for merging multiple streaming result channels from different agents into a single channel with advanced features.
func NewStreamMerger ¶
func NewStreamMerger(config *StreamMergerConfig) *StreamMerger
NewStreamMerger creates a new StreamMerger with the specified configuration.
func (*StreamMerger) MergeStreams ¶
func (sm *StreamMerger) MergeStreams(handles []*sdktypes.ExecutionHandle) <-chan *sdktypes.StreamingResult
MergeStreams takes a slice of execution handles and merges their stream channels with advanced features like ordering, progress tracking, and error handling.
type StreamMergerConfig ¶
type StreamMergerConfig struct {
BufferSize int `yaml:"buffer_size"` // 缓冲区大小
OrderByTimestamp bool `yaml:"order_by_timestamp"` // 是否按时间戳排序
MergeTimeout time.Duration `yaml:"merge_timeout"` // 合并超时时间
EnableProgressTracking bool `yaml:"enable_progress_tracking"` // 启用进度跟踪
SortBufferSize int `yaml:"sort_buffer_size"` // 排序缓冲区大小
}
StreamMergerConfig holds configuration for the StreamMerger
type StreamingExecutor ¶
type StreamingExecutor struct {
// contains filtered or unexported fields
}
StreamingExecutor 专门处理流式任务执行的执行器
func NewStreamingExecutor ¶
func NewStreamingExecutor(config *StreamingExecutorConfig) *StreamingExecutor
NewStreamingExecutor 创建新的流式执行器
type StreamingExecutorConfig ¶
type StreamingExecutorConfig struct {
StreamMerger *StreamMerger
ResultMerger *ResultMerger
AgentName string
}
StreamingExecutorConfig 流式执行器配置
type TaskAnalyzer ¶
type TaskAnalyzer struct {
// contains filtered or unexported fields
}
TaskAnalyzer is responsible for analyzing a task and determining the requirements for its execution, such as which agents are needed and what sub-tasks they should perform.
func NewTaskAnalyzer ¶
func NewTaskAnalyzer(ctx context.Context, agentCfgs *types.AgentConfig) (*TaskAnalyzer, error)
NewTaskAnalyzer creates a new TaskAnalyzer from configuration.
func (*TaskAnalyzer) Analyze ¶
func (ta *TaskAnalyzer) Analyze(ctx context.Context, task *sdktypes.Task) (*sdktypes.AgentRequirements, error)
Analyze inspects a task and returns the agent requirements. It uses an LLM to intelligently analyze the query and create an execution plan.
func (*TaskAnalyzer) AnalyzeWithDynamicAgents ¶
func (ta *TaskAnalyzer) AnalyzeWithDynamicAgents(ctx context.Context, task *sdktypes.Task, agents map[string]domain.DomainAgent) (*sdktypes.AgentRequirements, error)
AnalyzeWithDynamicAgents performs task analysis using dynamic agent information
func (*TaskAnalyzer) SetDynamicAgents ¶
func (ta *TaskAnalyzer) SetDynamicAgents(agents map[string]domain.DomainAgent)
SetDynamicAgents sets dynamic agent information, supports runtime agent list updates