Documentation
¶
Index ¶
- type Agent
- type AnalyzerConfig
- type DefaultPlanCreator
- type DefaultTaskParser
- type DependencyPlanCreator
- type ErrorCode
- type FlexibleOrchestrator
- func (f *FlexibleOrchestrator) GetProcessor(processorType string) (TaskProcessor, error)
- func (f *FlexibleOrchestrator) Process(ctx context.Context, task string, context map[string]interface{}) (*OrchestratorResult, error)
- func (f *FlexibleOrchestrator) RegisterProcessor(processorType string, processor TaskProcessor)
- type InMemoryStore
- type InterceptableAgent
- type InterceptorAgentAdapter
- func (iaa *InterceptorAgentAdapter) ClearInterceptors()
- func (iaa *InterceptorAgentAdapter) Execute(ctx context.Context, input map[string]interface{}) (map[string]interface{}, error)
- func (iaa *InterceptorAgentAdapter) ExecuteWithInterceptors(ctx context.Context, input map[string]interface{}, ...) (map[string]interface{}, error)
- func (iaa *InterceptorAgentAdapter) GetAgentID() string
- func (iaa *InterceptorAgentAdapter) GetAgentType() string
- func (iaa *InterceptorAgentAdapter) GetCapabilities() []core.Tool
- func (iaa *InterceptorAgentAdapter) GetInterceptors() []core.AgentInterceptor
- func (iaa *InterceptorAgentAdapter) GetMemory() Memory
- func (iaa *InterceptorAgentAdapter) SetInterceptors(interceptors []core.AgentInterceptor)
- type Memory
- type OrchestrationConfig
- type OrchestratorResult
- type PlanCreator
- type RetryConfig
- type Task
- type TaskParser
- type TaskProcessor
- type XMLError
- type XMLMetadata
- type XMLMetadataItem
- type XMLNormalizer
- type XMLTask
- type XMLTaskParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent interface {
// Execute runs the agent's task with given input and returns output
Execute(ctx context.Context, input map[string]interface{}) (map[string]interface{}, error)
// GetCapabilities returns the tools/capabilities available to this agent
GetCapabilities() []core.Tool
// GetMemory returns the agent's memory store
GetMemory() Memory
}
type AnalyzerConfig ¶
type AnalyzerConfig struct {
// The base instruction for task analysis
BaseInstruction string
// Additional formatting instructions specific to the implementation
FormatInstructions string
// Any extra considerations for task analysis
Considerations []string
}
New type to encapsulate analyzer-specific configuration.
type DefaultPlanCreator ¶
type DefaultPlanCreator struct{}
DefaultPlanCreator provides a simple implementation for testing.
func (*DefaultPlanCreator) CreatePlan ¶
func (p *DefaultPlanCreator) CreatePlan(tasks []Task) ([][]Task, error)
type DefaultTaskParser ¶
type DefaultTaskParser struct{}
DefaultTaskParser provides a simple implementation for testing.
type DependencyPlanCreator ¶
type DependencyPlanCreator struct {
// Optional configuration for planning
MaxTasksPerPhase int
}
DependencyPlanCreator creates execution plans based on task dependencies.
func NewDependencyPlanCreator ¶
func NewDependencyPlanCreator(maxTasksPerPhase int) *DependencyPlanCreator
func (*DependencyPlanCreator) CreatePlan ¶
func (p *DependencyPlanCreator) CreatePlan(tasks []Task) ([][]Task, error)
type FlexibleOrchestrator ¶
type FlexibleOrchestrator struct {
// contains filtered or unexported fields
}
FlexibleOrchestrator coordinates intelligent task decomposition and execution.
func NewFlexibleOrchestrator ¶
func NewFlexibleOrchestrator(memory Memory, config OrchestrationConfig) *FlexibleOrchestrator
NewFlexibleOrchestrator creates a new orchestrator instance.
func (*FlexibleOrchestrator) GetProcessor ¶
func (f *FlexibleOrchestrator) GetProcessor(processorType string) (TaskProcessor, error)
getProcessor returns the registered processor for a task type.
func (*FlexibleOrchestrator) Process ¶
func (f *FlexibleOrchestrator) Process(ctx context.Context, task string, context map[string]interface{}) (*OrchestratorResult, error)
Process handles complete orchestration workflow.
func (*FlexibleOrchestrator) RegisterProcessor ¶
func (f *FlexibleOrchestrator) RegisterProcessor(processorType string, processor TaskProcessor)
RegisterProcessor adds a new task processor.
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
Simple in-memory implementation.
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
func (*InMemoryStore) Clear ¶
func (s *InMemoryStore) Clear() error
func (*InMemoryStore) Delete ¶
func (s *InMemoryStore) Delete(key string) error
func (*InMemoryStore) List ¶
func (s *InMemoryStore) List() ([]string, error)
func (*InMemoryStore) Retrieve ¶
func (s *InMemoryStore) Retrieve(key string) (interface{}, error)
func (*InMemoryStore) Store ¶
func (s *InMemoryStore) Store(key string, value interface{}) error
type InterceptableAgent ¶
type InterceptableAgent interface {
Agent
// ExecuteWithInterceptors runs the agent's task with interceptor support
ExecuteWithInterceptors(ctx context.Context, input map[string]interface{}, interceptors []core.AgentInterceptor) (map[string]interface{}, error)
// SetInterceptors sets the default interceptors for this agent instance
SetInterceptors(interceptors []core.AgentInterceptor)
// GetInterceptors returns the current interceptors for this agent
GetInterceptors() []core.AgentInterceptor
// ClearInterceptors removes all interceptors from this agent
ClearInterceptors()
// GetAgentID returns the unique identifier for this agent instance
GetAgentID() string
// GetAgentType returns the category/type of this agent
GetAgentType() string
}
InterceptableAgent extends Agent with interceptor support. This interface provides backward-compatible enhancement for agents that support interceptors.
func WrapAgentWithInterceptors ¶
func WrapAgentWithInterceptors(agent Agent, agentID, agentType string, interceptors ...core.AgentInterceptor) InterceptableAgent
WrapAgentWithInterceptors is a convenience function to wrap any agent with interceptor support.
type InterceptorAgentAdapter ¶
type InterceptorAgentAdapter struct {
// contains filtered or unexported fields
}
InterceptorAgentAdapter wraps an existing Agent to provide interceptor support. This allows any existing agent to be used with interceptors without modifying its implementation.
func NewInterceptorAgentAdapter ¶
func NewInterceptorAgentAdapter(agent Agent, agentID, agentType string) *InterceptorAgentAdapter
NewInterceptorAgentAdapter creates a new adapter that wraps an existing agent with interceptor support.
func (*InterceptorAgentAdapter) ClearInterceptors ¶
func (iaa *InterceptorAgentAdapter) ClearInterceptors()
ClearInterceptors removes all interceptors from this adapter.
func (*InterceptorAgentAdapter) Execute ¶
func (iaa *InterceptorAgentAdapter) Execute(ctx context.Context, input map[string]interface{}) (map[string]interface{}, error)
Execute implements the basic Agent interface by calling the wrapped agent.
func (*InterceptorAgentAdapter) ExecuteWithInterceptors ¶
func (iaa *InterceptorAgentAdapter) ExecuteWithInterceptors(ctx context.Context, input map[string]interface{}, interceptors []core.AgentInterceptor) (map[string]interface{}, error)
ExecuteWithInterceptors runs the agent's task with interceptor support.
func (*InterceptorAgentAdapter) GetAgentID ¶
func (iaa *InterceptorAgentAdapter) GetAgentID() string
GetAgentID returns the unique identifier for this agent instance.
func (*InterceptorAgentAdapter) GetAgentType ¶
func (iaa *InterceptorAgentAdapter) GetAgentType() string
GetAgentType returns the category/type of this agent.
func (*InterceptorAgentAdapter) GetCapabilities ¶
func (iaa *InterceptorAgentAdapter) GetCapabilities() []core.Tool
GetCapabilities returns the tools/capabilities from the wrapped agent.
func (*InterceptorAgentAdapter) GetInterceptors ¶
func (iaa *InterceptorAgentAdapter) GetInterceptors() []core.AgentInterceptor
GetInterceptors returns the current interceptors for this adapter.
func (*InterceptorAgentAdapter) GetMemory ¶
func (iaa *InterceptorAgentAdapter) GetMemory() Memory
GetMemory returns the memory store from the wrapped agent.
func (*InterceptorAgentAdapter) SetInterceptors ¶
func (iaa *InterceptorAgentAdapter) SetInterceptors(interceptors []core.AgentInterceptor)
SetInterceptors sets the default interceptors for this adapter.
type Memory ¶
type Memory interface {
// Store saves a value with a given key
Store(key string, value interface{}) error
// Retrieve gets a value by key
Retrieve(key string) (interface{}, error)
// Delete removes a value by key
Delete(key string) error
// List returns all stored keys
List() ([]string, error)
// Clear removes all stored values
Clear() error
}
Memory provides storage capabilities for agents.
type OrchestrationConfig ¶
type OrchestrationConfig struct {
// MaxConcurrent controls maximum parallel task execution
MaxConcurrent int
// DefaultTimeout for task execution
DefaultTimeout time.Duration
// RetryConfig specifies retry behavior for failed tasks
RetryConfig *RetryConfig
// CustomProcessors maps processor types to implementations
CustomProcessors map[string]TaskProcessor
TaskParser TaskParser
PlanCreator PlanCreator
AnalyzerConfig AnalyzerConfig
Options core.Option
}
OrchestrationConfig allows customizing orchestrator behavior.
type OrchestratorResult ¶
type OrchestratorResult struct {
// CompletedTasks holds results from successful tasks
CompletedTasks map[string]interface{}
// FailedTasks contains tasks that could not be completed
FailedTasks map[string]error
// Analysis contains orchestrator's task breakdown reasoning
Analysis string
// Metadata holds additional orchestration information
Metadata map[string]interface{}
// contains filtered or unexported fields
}
OrchestratorResult contains orchestration outputs.
type PlanCreator ¶
type PlanCreator interface {
// CreatePlan organizes tasks into execution phases
CreatePlan(tasks []Task) ([][]Task, error)
}
PlanCreator defines how to create an execution plan from tasks.
type RetryConfig ¶
RetryConfig specifies retry behavior.
type Task ¶
type Task struct {
// ID uniquely identifies the task
ID string
// Type indicates the kind of task
Type string
// Metadata holds task-specific information
Metadata map[string]interface{}
// Dependencies lists task IDs that must complete before this task
Dependencies []string
// Priority indicates task importance (lower number = higher priority)
Priority int
// ProcessorType indicates which processor should handle this task
ProcessorType string
}
Task represents a unit of work identified by the orchestrator.
type TaskParser ¶
type TaskParser interface {
// Parse converts analyzer output into a slice of tasks
Parse(analyzerOutput map[string]interface{}) ([]Task, error)
}
TaskParser defines how to parse tasks from analyzer output.
type TaskProcessor ¶
type TaskProcessor interface {
// Process handles a single task execution
Process(ctx context.Context, task Task, taskContext map[string]interface{}) (interface{}, error)
}
TaskProcessor defines how to process individual tasks.
type XMLMetadata ¶
type XMLMetadata struct {
Items []XMLMetadataItem `xml:"item"`
}
type XMLMetadataItem ¶
type XMLNormalizer ¶
type XMLNormalizer struct {
// contains filtered or unexported fields
}
XMLNormalizer handles cleaning and standardization of XML content.
func NewXMLNormalizer ¶
func NewXMLNormalizer() *XMLNormalizer
NewXMLNormalizer creates a new normalizer with compiled regex patterns.
func (*XMLNormalizer) NormalizeXML ¶
func (n *XMLNormalizer) NormalizeXML(content string) (string, error)
NormalizeXML cleans and standardizes XML content for parsing.
type XMLTask ¶
type XMLTask struct {
XMLName xml.Name `xml:"task"`
ID string `xml:"id,attr"`
Type string `xml:"type,attr"` // Make sure this maps to the type attribute
ProcessorType string `xml:"processor,attr"` // Make sure this maps to the processor attribute
Priority int `xml:"priority,attr"`
Description string `xml:"description"`
Dependencies []string `xml:"dependencies>dep"` // This maps to the <dependencies><dep>...</dep></dependencies> structure
Metadata XMLMetadata `xml:"metadata"`
}
type XMLTaskParser ¶
type XMLTaskParser struct {
// Configuration for XML parsing
RequiredFields []string
}