Documentation
¶
Index ¶
- type AgentResponse
- type Message
- type RoutingStrategy
- type Supervisor
- func (s *Supervisor) AssignTask(taskID, description, agentName string) error
- func (s *Supervisor) CompleteTask(taskID, result string) error
- func (s *Supervisor) FailTask(taskID, reason string) error
- func (s *Supervisor) GetAgents() map[string]agent.Agent
- func (s *Supervisor) GetCurrentRound() int
- func (s *Supervisor) GetMessages() []Message
- func (s *Supervisor) GetPendingTasks() []*Task
- func (s *Supervisor) GetTask(taskID string) (*Task, bool)
- func (s *Supervisor) Handoff(ctx context.Context, fromAgent, toAgent, message string) (*AgentResponse, error)
- func (s *Supervisor) Run(ctx context.Context, input string) (string, error)
- func (s *Supervisor) Start(ctx context.Context) error
- type SupervisorDef
- type Task
- type TaskStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentResponse ¶
type AgentResponse struct {
AgentName string
Content string
NextAgent string // Suggested next agent for handoff
Complete bool // Whether the task is complete
}
AgentResponse represents a response from an agent
type RoutingStrategy ¶
type RoutingStrategy string
RoutingStrategy defines how the supervisor routes tasks to agents
const ( StrategyRoundRobin RoutingStrategy = "round_robin" StrategyBestMatch RoutingStrategy = "best_match" StrategyManual RoutingStrategy = "manual" )
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
Supervisor orchestrates multiple agents
func New ¶
func New(def SupervisorDef, agents map[string]agent.Agent, rt agent.Runtime) (*Supervisor, error)
New creates a new Supervisor instance
func (*Supervisor) AssignTask ¶
func (s *Supervisor) AssignTask(taskID, description, agentName string) error
AssignTask creates and assigns a task to an agent
func (*Supervisor) CompleteTask ¶
func (s *Supervisor) CompleteTask(taskID, result string) error
CompleteTask marks a task as completed
func (*Supervisor) FailTask ¶
func (s *Supervisor) FailTask(taskID, reason string) error
FailTask marks a task as failed
func (*Supervisor) GetAgents ¶
func (s *Supervisor) GetAgents() map[string]agent.Agent
GetAgents returns the agents map
func (*Supervisor) GetCurrentRound ¶
func (s *Supervisor) GetCurrentRound() int
GetCurrentRound returns the current orchestration round
func (*Supervisor) GetMessages ¶
func (s *Supervisor) GetMessages() []Message
GetMessages returns the conversation history
func (*Supervisor) GetPendingTasks ¶
func (s *Supervisor) GetPendingTasks() []*Task
GetPendingTasks returns all pending tasks
func (*Supervisor) GetTask ¶
func (s *Supervisor) GetTask(taskID string) (*Task, bool)
GetTask returns a task by ID
func (*Supervisor) Handoff ¶
func (s *Supervisor) Handoff(ctx context.Context, fromAgent, toAgent, message string) (*AgentResponse, error)
Handoff transfers control from one agent to another
type SupervisorDef ¶
type SupervisorDef struct {
Name string `yaml:"name"`
Model string `yaml:"model"`
MaxRounds int `yaml:"max_rounds"`
RoutingStrategy RoutingStrategy `yaml:"routing_strategy,omitempty"`
SystemPrompt string `yaml:"system_prompt,omitempty"`
}
SupervisorDef defines the configuration for a supervisor
type Task ¶
type Task struct {
ID string
Description string
AssignedTo string
Status TaskStatus
Result string
Round int
}
Task represents a unit of work assigned to an agent
type TaskStatus ¶
type TaskStatus string
TaskStatus represents the status of a task
const ( TaskPending TaskStatus = "pending" TaskInProgress TaskStatus = "in_progress" TaskCompleted TaskStatus = "completed" TaskFailed TaskStatus = "failed" )