Documentation
¶
Index ¶
- func WithConversationAnalyzer(handler MessageHandler) base.AgentOption
- func WithDirectAnswerHandler(handler MessageHandler) base.AgentOption
- func WithFeedbackProcessorHandler(handler MessageHandler) base.AgentOption
- func WithFinalAnswerHandler(handler MessageHandler) base.AgentOption
- func WithPlanCreationHandler(handler MessageHandler) base.AgentOption
- func WithPlanHandler(handler PlanHandler) base.AgentOption
- func WithPlanUpdateHandler(handler MessageHandler) base.AgentOption
- func WithSpecialistHandler(specialistName string, handler MessageHandler) base.AgentOption
- type ActionType
- type ComplexityBranchHandler
- type ConversationAnalyzerHandler
- type ConversationContext
- type ExecutionRecord
- type ExecutionStatus
- type Feedback
- type FeedbackProcessorHandler
- type FinalAnswerHandler
- type Host
- type MessageHandler
- type MultiAgent
- func (ema *MultiAgent) ExportGraph() (compose.AnyGraph, []compose.GraphAddNodeOpt)
- func (ema *MultiAgent) Generate(ctx context.Context, input []*schema.Message, opts ...base.AgentOption) (*schema.Message, error)
- func (ema *MultiAgent) GetConfig() *MultiAgentConfig
- func (ema *MultiAgent) Stream(ctx context.Context, input []*schema.Message, opts ...base.AgentOption) (*schema.StreamReader[*schema.Message], error)
- type MultiAgentConfig
- type MultiAgentState
- func (es *MultiAgentState) AddCollectedResult(result *schema.Message)
- func (es *MultiAgentState) AddExecutionRecord(record *ExecutionRecord)
- func (es *MultiAgentState) AddFeedback(feedback *Feedback)
- func (es *MultiAgentState) AddPlanToHistory(plan *TaskPlan)
- func (es *MultiAgentState) ClearSpecialistResults()
- func (es *MultiAgentState) Clone() (*MultiAgentState, error)
- func (es *MultiAgentState) FromJSON(data []byte) error
- func (es *MultiAgentState) GetMetadata(key string) (any, bool)
- func (es *MultiAgentState) IncrementReflection()
- func (es *MultiAgentState) IncrementRound()
- func (es *MultiAgentState) SetCompleted(completed bool)
- func (es *MultiAgentState) SetCurrentPlan(plan *TaskPlan)
- func (es *MultiAgentState) SetCurrentStep(stepID string)
- func (es *MultiAgentState) SetExecutionStatus(status ExecutionStatus)
- func (es *MultiAgentState) SetFinalAnswer(answer *schema.Message)
- func (es *MultiAgentState) SetMaxRounds(max int)
- func (es *MultiAgentState) SetMetadata(key string, value any)
- func (es *MultiAgentState) SetOriginalMessages(messages []*schema.Message)
- func (es *MultiAgentState) SetRoundNumber(round int)
- func (es *MultiAgentState) SetShouldContinue(should bool)
- func (es *MultiAgentState) SetStartTime(t time.Time)
- func (es *MultiAgentState) ToJSON() ([]byte, error)
- func (es *MultiAgentState) UpdateConversationContext(ctx *ConversationContext)
- func (es *MultiAgentState) UpdateSpecialistResult(specialist string, result *StepResult)
- type OperationData
- type PlanCreationHandler
- type PlanExecutionHandler
- type PlanHandler
- type PlanStep
- type PlanUpdate
- type PlanUpdateHandler
- type PlanUpdateType
- type PlanningConfig
- type ReflectionBranchHandler
- type ResultCollectorHandler
- type SessionConfig
- type Specialist
- type SpecialistBranchHandler
- type SpecialistHandler
- type StatePostHandler
- type StatePreHandler
- type StepData
- type StepResult
- type StepStatus
- type TaskComplexity
- type TaskPlan
- type ThinkingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithConversationAnalyzer ¶
func WithConversationAnalyzer(handler MessageHandler) base.AgentOption
WithConversationAnalyzer 为对话分析节点添加消息处理器
func WithDirectAnswerHandler ¶
func WithDirectAnswerHandler(handler MessageHandler) base.AgentOption
WithDirectAnswerHandler 为直接回答节点添加消息处理器
func WithFeedbackProcessorHandler ¶
func WithFeedbackProcessorHandler(handler MessageHandler) base.AgentOption
WithFeedbackProcessorHandler 为反馈处理节点添加消息处理器
func WithFinalAnswerHandler ¶
func WithFinalAnswerHandler(handler MessageHandler) base.AgentOption
WithFinalAnswerHandler 为最终回答节点添加消息处理器
func WithPlanCreationHandler ¶
func WithPlanCreationHandler(handler MessageHandler) base.AgentOption
WithPlanCreationHandler 为计划创建节点添加消息处理器
func WithPlanHandler ¶
func WithPlanHandler(handler PlanHandler) base.AgentOption
func WithPlanUpdateHandler ¶
func WithPlanUpdateHandler(handler MessageHandler) base.AgentOption
WithPlanUpdateHandler 为计划更新节点添加消息处理器
func WithSpecialistHandler ¶
func WithSpecialistHandler(specialistName string, handler MessageHandler) base.AgentOption
WithSpecialistHandler 为指定专家节点添加消息处理器
Types ¶
type ActionType ¶
type ActionType string
ActionType represents the type of action an agent can take
const ( ActionTypeUnknown ActionType = "unknown" ActionTypeThink ActionType = "think" ActionTypePlan ActionType = "plan" ActionTypeExecute ActionType = "execute" ActionTypeReflect ActionType = "reflect" ActionTypeAnswer ActionType = "answer" )
type ComplexityBranchHandler ¶
type ComplexityBranchHandler struct {
// contains filtered or unexported fields
}
ComplexityBranchHandler handles complexity-based branching
func NewComplexityBranchHandler ¶
func NewComplexityBranchHandler(config *MultiAgentConfig) *ComplexityBranchHandler
NewComplexityBranchHandler creates a new complexity branch handler
func (*ComplexityBranchHandler) Evaluate ¶
func (h *ComplexityBranchHandler) Evaluate(ctx context.Context, state *MultiAgentState) (string, error)
Evaluate determines the branch based on task complexity
type ConversationAnalyzerHandler ¶
type ConversationAnalyzerHandler struct {
// contains filtered or unexported fields
}
ConversationAnalyzerHandler analyzes conversation context
func NewConversationAnalyzerHandler ¶
func NewConversationAnalyzerHandler(config *MultiAgentConfig) *ConversationAnalyzerHandler
NewConversationAnalyzerHandler creates a new conversation analyzer handler
func (*ConversationAnalyzerHandler) PostHandler ¶
func (h *ConversationAnalyzerHandler) PostHandler(ctx context.Context, output *schema.Message, state *MultiAgentState) (*schema.Message, error)
PostHandler processes conversation analysis results
func (*ConversationAnalyzerHandler) PreHandler ¶
func (h *ConversationAnalyzerHandler) PreHandler(ctx context.Context, input []*schema.Message, state *MultiAgentState) ([]*schema.Message, error)
PreHandler prepares input for conversation analysis
type ConversationContext ¶
type ConversationContext struct {
IsIndependentTopic bool `json:"isIndependentTopic"`
UserIntent string `json:"userIntent"`
RelevantHistory []*schema.Message `json:"relevantHistory"`
KeyTopics []string `json:"keyTopics"`
ContextSummary string `json:"contextSummary"`
Complexity TaskComplexity `json:"complexity"`
Metadata map[string]any `json:"metadata,omitempty"`
}
ConversationContext contains conversation analysis results
type ExecutionRecord ¶
type ExecutionRecord struct {
StepID string `json:"stepID"`
Action ActionType `json:"action"`
Input []*schema.Message `json:"input"`
Output *schema.Message `json:"output"`
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
Duration time.Duration `json:"duration"`
Status ExecutionStatus `json:"status"`
Error string `json:"error,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
ExecutionRecord represents a single execution step record
type ExecutionStatus ¶
type ExecutionStatus string
ExecutionStatus represents the overall execution status
const ( ExecutionStatusUnknown ExecutionStatus = "unknown" ExecutionStatusPending ExecutionStatus = "pending" ExecutionStatusAnalyzing ExecutionStatus = "analyzing" ExecutionStatusPlanning ExecutionStatus = "planning" ExecutionStatusStarted ExecutionStatus = "started" ExecutionStatusRunning ExecutionStatus = "running" ExecutionStatusExecuting ExecutionStatus = "executing" ExecutionStatusCollecting ExecutionStatus = "collecting" ExecutionStatusCompleted ExecutionStatus = "completed" ExecutionStatusSuccess ExecutionStatus = "success" ExecutionStatusFailed ExecutionStatus = "failed" ExecutionStatusTimeout ExecutionStatus = "timeout" ExecutionStatusCancelled ExecutionStatus = "cancelled" )
type Feedback ¶
type Feedback struct {
ExecutionCompleted bool `json:"execution_completed"`
OverallQuality float64 `json:"overall_quality"`
PlanNeedsUpdate bool `json:"plan_needs_update"`
Issues []string `json:"issues"`
Suggestions []string `json:"suggestions"`
Confidence float64 `json:"confidence"`
NextActionReason string `json:"next_action_reason"`
}
Feedback represents the feedback received from the user
type FeedbackProcessorHandler ¶
type FeedbackProcessorHandler struct {
// contains filtered or unexported fields
}
func NewFeedbackProcessorHandler ¶
func NewFeedbackProcessorHandler(config *MultiAgentConfig) *FeedbackProcessorHandler
func (*FeedbackProcessorHandler) PostHandler ¶
func (h *FeedbackProcessorHandler) PostHandler(ctx context.Context, output *schema.Message, state *MultiAgentState) (*schema.Message, error)
func (*FeedbackProcessorHandler) PreHandler ¶
func (h *FeedbackProcessorHandler) PreHandler(ctx context.Context, input []*schema.Message, state *MultiAgentState) ([]*schema.Message, error)
type FinalAnswerHandler ¶
type FinalAnswerHandler struct {
// contains filtered or unexported fields
}
func NewFinalAnswerHandler ¶
func NewFinalAnswerHandler(config *MultiAgentConfig) *FinalAnswerHandler
func (*FinalAnswerHandler) PostHandler ¶
func (h *FinalAnswerHandler) PostHandler(ctx context.Context, output *schema.Message, state *MultiAgentState) (*schema.Message, error)
func (*FinalAnswerHandler) PreHandler ¶
func (h *FinalAnswerHandler) PreHandler(ctx context.Context, input []*schema.Message, state *MultiAgentState) ([]*schema.Message, error)
type Host ¶
type Host struct {
Model model.ToolCallingChatModel `yaml:"model" json:"model"`
ReactAgent *react.ReactAgent `yaml:"react_agent" json:"react_agent"`
SystemPrompt string `yaml:"system_prompt" json:"system_prompt"`
Prompts map[string]string `yaml:"prompts,omitempty" json:"prompts,omitempty"`
Thinking ThinkingConfig `yaml:"thinking" json:"thinking"`
Planning PlanningConfig `yaml:"planning" json:"planning"`
}
Host represents the host agent configuration
type MessageHandler ¶
type MessageHandler interface {
OnMessage(ctx context.Context, message *schema.Message) (context.Context, error)
OnStreamMessage(ctx context.Context, message *schema.StreamReader[*schema.Message]) (context.Context, error)
}
MessageHandler 通用消息处理器接口
type MultiAgent ¶
type MultiAgent struct {
Runnable compose.Runnable[[]*schema.Message, *schema.Message]
Graph *compose.Graph[[]*schema.Message, *schema.Message]
GraphAddNodeOpts []compose.GraphAddNodeOpt
AgentOptions []base.AgentOption
Config *MultiAgentConfig
}
MultiAgent represents the enhanced multi-agent system
func NewMultiAgent ¶
func NewMultiAgent(ctx context.Context, config *MultiAgentConfig, agentOptions ...base.AgentOption) (*MultiAgent, error)
NewMultiAgent creates a new multi-agent system
func (*MultiAgent) ExportGraph ¶
func (ema *MultiAgent) ExportGraph() (compose.AnyGraph, []compose.GraphAddNodeOpt)
ExportGraph exports the underlying graph
func (*MultiAgent) Generate ¶
func (ema *MultiAgent) Generate(ctx context.Context, input []*schema.Message, opts ...base.AgentOption) (*schema.Message, error)
Generate executes the enhanced multi-agent system
func (*MultiAgent) GetConfig ¶
func (ema *MultiAgent) GetConfig() *MultiAgentConfig
GetConfig returns the configuration
func (*MultiAgent) Stream ¶
func (ema *MultiAgent) Stream(ctx context.Context, input []*schema.Message, opts ...base.AgentOption) (*schema.StreamReader[*schema.Message], error)
Stream executes the enhanced multi-agent system in streaming mode
type MultiAgentConfig ¶
type MultiAgentConfig struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Host Host `yaml:"host" json:"host"`
Specialists []*Specialist `yaml:"specialists" json:"specialists"`
PromptTemplates map[string]string `yaml:"prompt_templates,omitempty" json:"prompt_templates,omitempty"`
Session SessionConfig `yaml:"session" json:"session"`
MaxRounds int `yaml:"max_rounds" json:"max_rounds"`
}
MultiAgentConfig represents the complete configuration for the multi-agent system
func GetDefaultConfig ¶
func GetDefaultConfig(chatModel model.ToolCallingChatModel) *MultiAgentConfig
GetDefaultConfig returns a default configuration
func (*MultiAgentConfig) Validate ¶
func (config *MultiAgentConfig) Validate() error
Validate validates the configuration
type MultiAgentState ¶
type MultiAgentState struct {
RoundNumber int `json:"round_number"`
StartTime time.Time `json:"start_time"`
// Conversation Context
ConversationContext *ConversationContext `json:"conversation_context,omitempty"`
OriginalMessages []*schema.Message `json:"original_messages"`
// Task Planning
CurrentPlan *TaskPlan `json:"current_plan,omitempty"`
PlanHistory []*TaskPlan `json:"plan_history,omitempty"`
// Execution Status
ExecutionStatus ExecutionStatus `json:"execution_status"`
CurrentStep string `json:"current_step,omitempty"`
ExecutionHistory []*ExecutionRecord `json:"execution_history,omitempty"`
// Specialist Results
SpecialistResults map[string]*StepResult `json:"specialist_results,omitempty"`
// Collected Results
CollectedResults []*schema.Message `json:"collected_results,omitempty"`
// Feedback and Reflection
FeedbackHistory []*Feedback `json:"feedback_history,omitempty"`
ReflectionCount int `json:"reflection_count"`
// Execution Control
MaxRounds int `json:"max_rounds"`
ShouldContinue bool `json:"should_continue"`
IsCompleted bool `json:"is_completed"`
// Final Answer
FinalAnswer *schema.Message `json:"final_answer,omitempty"`
// Metadata
Metadata map[string]any `json:"metadata,omitempty"`
}
MultiAgentState represents the complete state of the enhanced multi-agent system
func (*MultiAgentState) AddCollectedResult ¶
func (es *MultiAgentState) AddCollectedResult(result *schema.Message)
结果收集管理方法
func (*MultiAgentState) AddExecutionRecord ¶
func (es *MultiAgentState) AddExecutionRecord(record *ExecutionRecord)
func (*MultiAgentState) AddFeedback ¶
func (es *MultiAgentState) AddFeedback(feedback *Feedback)
反馈管理方法
func (*MultiAgentState) AddPlanToHistory ¶
func (es *MultiAgentState) AddPlanToHistory(plan *TaskPlan)
func (*MultiAgentState) ClearSpecialistResults ¶
func (es *MultiAgentState) ClearSpecialistResults()
func (*MultiAgentState) Clone ¶
func (es *MultiAgentState) Clone() (*MultiAgentState, error)
Clone creates a deep copy of the state
func (*MultiAgentState) FromJSON ¶
func (es *MultiAgentState) FromJSON(data []byte) error
FromJSON deserializes the state from JSON
func (*MultiAgentState) GetMetadata ¶
func (es *MultiAgentState) GetMetadata(key string) (any, bool)
func (*MultiAgentState) IncrementReflection ¶
func (es *MultiAgentState) IncrementReflection()
func (*MultiAgentState) IncrementRound ¶
func (es *MultiAgentState) IncrementRound()
func (*MultiAgentState) SetCompleted ¶
func (es *MultiAgentState) SetCompleted(completed bool)
func (*MultiAgentState) SetCurrentPlan ¶
func (es *MultiAgentState) SetCurrentPlan(plan *TaskPlan)
计划管理方法
func (*MultiAgentState) SetCurrentStep ¶
func (es *MultiAgentState) SetCurrentStep(stepID string)
func (*MultiAgentState) SetExecutionStatus ¶
func (es *MultiAgentState) SetExecutionStatus(status ExecutionStatus)
执行记录管理方法
func (*MultiAgentState) SetFinalAnswer ¶
func (es *MultiAgentState) SetFinalAnswer(answer *schema.Message)
func (*MultiAgentState) SetMetadata ¶
func (es *MultiAgentState) SetMetadata(key string, value any)
func (*MultiAgentState) SetOriginalMessages ¶
func (es *MultiAgentState) SetOriginalMessages(messages []*schema.Message)
func (*MultiAgentState) SetRoundNumber ¶
func (es *MultiAgentState) SetRoundNumber(round int)
基础字段管理方法
func (*MultiAgentState) SetShouldContinue ¶
func (es *MultiAgentState) SetShouldContinue(should bool)
func (*MultiAgentState) SetStartTime ¶
func (es *MultiAgentState) SetStartTime(t time.Time)
func (*MultiAgentState) ToJSON ¶
func (es *MultiAgentState) ToJSON() ([]byte, error)
ToJSON serializes the state to JSON
func (*MultiAgentState) UpdateConversationContext ¶
func (es *MultiAgentState) UpdateConversationContext(ctx *ConversationContext)
对话上下文管理方法
func (*MultiAgentState) UpdateSpecialistResult ¶
func (es *MultiAgentState) UpdateSpecialistResult(specialist string, result *StepResult)
专家结果管理方法
type OperationData ¶
type OperationData struct {
Type string `json:"type"`
StepID string `json:"stepID"`
StepData *StepData `json:"step_data,omitempty"`
Position string `json:"position,omitempty"`
Reason string `json:"reason,omitempty"`
}
OperationData defines the structure for plan update operations
type PlanCreationHandler ¶
type PlanCreationHandler struct {
// contains filtered or unexported fields
}
PlanCreationHandler handles task plan creation
func NewPlanCreationHandler ¶
func NewPlanCreationHandler(config *MultiAgentConfig) *PlanCreationHandler
NewPlanCreationHandler creates a new plan creation handler
func (*PlanCreationHandler) PostHandler ¶
func (h *PlanCreationHandler) PostHandler(ctx context.Context, output *schema.Message, state *MultiAgentState) (*schema.Message, error)
PostHandler processes plan creation results
func (*PlanCreationHandler) PreHandler ¶
func (h *PlanCreationHandler) PreHandler(ctx context.Context, input []*schema.Message, state *MultiAgentState) ([]*schema.Message, error)
PreHandler prepares input for plan creation
type PlanExecutionHandler ¶
type PlanExecutionHandler struct {
// contains filtered or unexported fields
}
PlanExecutionHandler handles plan execution coordination
func NewPlanExecutionHandler ¶
func NewPlanExecutionHandler(config *MultiAgentConfig) *PlanExecutionHandler
NewPlanExecutionHandler creates a new plan execution handler
type PlanHandler ¶
type PlanHandler interface {
OnPlanStepCreate(ctx context.Context, plan *TaskPlan, step *PlanStep) (context.Context, error)
OnPlanStepUpdate(ctx context.Context, plan *TaskPlan, step *PlanStep) (context.Context, error)
OnPlanStepStatusUpdate(ctx context.Context, plan *TaskPlan, step *PlanStep) (context.Context, error)
OnPlanStepDelete(ctx context.Context, plan *TaskPlan, step *PlanStep) (context.Context, error)
OnPlanOpEnd(ctx context.Context, plan *TaskPlan) (context.Context, error)
}
type PlanStep ¶
type PlanStep struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
AssignedSpecialist string `json:"assignedSpecialist"`
Priority int `json:"priority"`
Status StepStatus `json:"status"`
Dependencies []string `json:"dependencies,omitempty"`
Parameters map[string]any `json:"parameters,omitempty"`
Result *StepResult `json:"result,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
PlanStep represents a single step in a task plan
type PlanUpdate ¶
type PlanUpdate struct {
UpdateReason string `json:"update_reason"`
Operations []*OperationData `json:"operations"`
PlanMetadata *struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
} `json:"plan_metadata,omitempty"`
}
PlanUpdateData represents the data for a plan update
type PlanUpdateHandler ¶
type PlanUpdateHandler struct {
// contains filtered or unexported fields
}
PlanUpdateHandler handles the plan update process
func NewPlanUpdateHandler ¶
func NewPlanUpdateHandler(config *MultiAgentConfig) *PlanUpdateHandler
func (*PlanUpdateHandler) PostHandler ¶
func (h *PlanUpdateHandler) PostHandler(ctx context.Context, output *schema.Message, state *MultiAgentState) (*schema.Message, error)
func (*PlanUpdateHandler) PreHandler ¶
func (h *PlanUpdateHandler) PreHandler(ctx context.Context, input []*schema.Message, state *MultiAgentState) ([]*schema.Message, error)
type PlanUpdateType ¶
type PlanUpdateType string
PlanUpdateType represents the type of plan update
const ( PlanUpdateTypeUnknown PlanUpdateType = "unknown" PlanUpdateTypeStepAdd PlanUpdateType = "step_add" PlanUpdateTypeStepModify PlanUpdateType = "step_modify" PlanUpdateTypeStepRemove PlanUpdateType = "step_remove" PlanUpdateTypeStepReorder PlanUpdateType = "step_reorder" PlanUpdateTypePriorityChange PlanUpdateType = "priority_change" PlanUpdateTypeDependencyChange PlanUpdateType = "dependency_change" PlanUpdateTypeResourceChange PlanUpdateType = "resource_change" PlanUpdateTypeStrategyChange PlanUpdateType = "strategy_change" )
type PlanningConfig ¶
type PlanningConfig struct {
PlanningPrompt string `yaml:"planning_prompt" json:"planning_prompt"`
}
PlanningConfig represents planning configuration
type ReflectionBranchHandler ¶
type ReflectionBranchHandler struct {
// contains filtered or unexported fields
}
ReflectionBranchHandler handles the decision logic for reflection branches
func NewReflectionBranchHandler ¶
func NewReflectionBranchHandler(config *MultiAgentConfig) *ReflectionBranchHandler
type ResultCollectorHandler ¶
type ResultCollectorHandler struct {
// contains filtered or unexported fields
}
ResultCollectorHandler handles result collection and summarization
func NewResultCollectorHandler ¶
func NewResultCollectorHandler(config *MultiAgentConfig) *ResultCollectorHandler
NewResultCollectorHandler creates a new result collector handler
func (*ResultCollectorHandler) ResultCollector ¶
func (h *ResultCollectorHandler) ResultCollector(ctx context.Context, input []*schema.Message, state *MultiAgentState) (*schema.Message, error)
ResultCollectorLambda collects and summarizes specialist results
type SessionConfig ¶
type SessionConfig struct {
HistoryLength int `yaml:"history_length" json:"history_length"`
ContextWindow int `yaml:"context_window" json:"context_window"`
ContextProcessing map[string]any `yaml:"context_processing,omitempty" json:"context_processing,omitempty"`
IntentAnalysis map[string]any `yaml:"intent_analysis,omitempty" json:"intent_analysis,omitempty"`
Persistence map[string]any `yaml:"persistence,omitempty" json:"persistence,omitempty"`
}
SessionConfig represents session management configuration
type Specialist ¶
type Specialist struct {
Name string `yaml:"name" json:"name"`
IntendedUse string `yaml:"intended_use" json:"intended_use"`
ChatModel model.BaseChatModel
SystemPrompt string `yaml:"system_prompt" json:"system_prompt"`
Invokable compose.Invoke[[]*schema.Message, *schema.Message, base.AgentOption]
Streamable compose.Stream[[]*schema.Message, *schema.Message, base.AgentOption]
ReactAgent *react.ReactAgent
}
Specialist represents a specialist agent configuration
type SpecialistBranchHandler ¶
type SpecialistBranchHandler struct {
// contains filtered or unexported fields
}
SpecialistBranchHandler handles specialist selection and branching
func NewSpecialistBranchHandler ¶
func NewSpecialistBranchHandler(config *MultiAgentConfig) *SpecialistBranchHandler
NewSpecialistBranchHandler creates a new specialist branch handler
func (*SpecialistBranchHandler) Evaluate ¶
func (h *SpecialistBranchHandler) Evaluate(ctx context.Context, state *MultiAgentState) (string, error)
Evaluate determines which specialist should handle the current step
type SpecialistHandler ¶
type SpecialistHandler struct {
// contains filtered or unexported fields
}
SpecialistHandler handles specialist execution
func NewSpecialistHandler ¶
func NewSpecialistHandler(specialist *Specialist) *SpecialistHandler
NewSpecialistHandler creates a new specialist handler
func (*SpecialistHandler) PostHandler ¶
func (h *SpecialistHandler) PostHandler(ctx context.Context, output *schema.Message, state *MultiAgentState) (*schema.Message, error)
PostHandler processes specialist execution results
func (*SpecialistHandler) PreHandler ¶
func (h *SpecialistHandler) PreHandler(ctx context.Context, input []*schema.Message, state *MultiAgentState) ([]*schema.Message, error)
PreHandler prepares input for specialist execution
type StatePostHandler ¶
type StatePostHandler[O any] func(ctx context.Context, output O, state *MultiAgentState) (O, error)
StatePostHandler handles state updates after node execution
type StatePreHandler ¶
type StatePreHandler[I any] func(ctx context.Context, input I, state *MultiAgentState) (I, error)
StatePreHandler handles state preparation before node execution
type StepData ¶
type StepData struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
AssignedSpecialist string `json:"assignedSpecialist"`
Priority int `json:"priority"`
Dependencies []string `json:"dependencies,omitempty"`
Parameters map[string]any `json:"parameters,omitempty"`
}
type StepResult ¶
type StepResult struct {
Success bool `json:"success"`
Target string `json:"target,omitempty"`
Output *schema.Message `json:"output"`
Error string `json:"error,omitempty"`
Confidence float64 `json:"confidence"`
QualityScore float64 `json:"qualityScore"`
Metadata map[string]any `json:"metadata,omitempty"`
}
StepResult represents the result of executing a plan step
type StepStatus ¶
type StepStatus string
StepStatus represents the status of a plan step
const ( StepStatusUnknown StepStatus = "unknown" StepStatusPending StepStatus = "pending" StepStatusRunning StepStatus = "running" StepStatusCompleted StepStatus = "completed" StepStatusFailed StepStatus = "failed" StepStatusSkipped StepStatus = "skipped" )
type TaskComplexity ¶
type TaskComplexity string
TaskComplexity represents the complexity level of a task
const ( TaskComplexityUnknown TaskComplexity = "unknown" TaskComplexitySimple TaskComplexity = "simple" TaskComplexityModerate TaskComplexity = "moderate" TaskComplexityComplex TaskComplexity = "complex" TaskComplexityVeryComplex TaskComplexity = "very_complex" )
type TaskPlan ¶
type TaskPlan struct {
ID string `json:"id"`
Version int `json:"version"`
Name string `json:"name"`
Description string `json:"description"`
Status ExecutionStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Steps []*PlanStep `json:"steps"`
PlanUpdate *PlanUpdate `json:"plan_update,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
TaskPlan represents a complete task execution plan
type ThinkingConfig ¶
type ThinkingConfig struct {
MaxSteps int `yaml:"max_steps" json:"max_steps"`
ThinkingPrompt string `yaml:"thinking_prompt" json:"thinking_prompt"`
}
ThinkingConfig represents thinking configuration