supervisor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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 Message

type Message struct {
	Role    string
	Content string
	Agent   string
}

Message represents a message in the conversation

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

func (*Supervisor) Run

func (s *Supervisor) Run(ctx context.Context, input string) (string, error)

Run executes the orchestration loop for a given input

func (*Supervisor) Start

func (s *Supervisor) Start(ctx context.Context) error

Start initializes the supervisor

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"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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