Documentation
¶
Index ¶
- func ToJSONRPCMessage(msg provider.Message) types.Message
- type AgentFactory
- type AgentRunner
- type Config
- type DAGExecutor
- type DAGExecutorConfig
- type Manager
- func (m *Manager) CancelTask(id string) error
- func (m *Manager) GetResult(id string) *Result
- func (m *Manager) GetStats() map[string]interface{}
- func (m *Manager) GetTask(id string) *Task
- func (m *Manager) KillSubAgent(id string) error
- func (m *Manager) ListSubAgents() []map[string]interface{}
- func (m *Manager) ListTasks(statusFilter TaskStatus) []*Task
- func (m *Manager) SpawnMultiple(tasks []struct{ ... }) ([]Result, error)
- func (m *Manager) SpawnNestedTask(parentTaskID, description, input string, tools []string, ...) (string, error)
- func (m *Manager) SpawnTask(description, input string, tools []string) (string, error)
- func (m *Manager) SpawnTaskWithContext(description, input string, tools []string, ctx map[string]interface{}) (string, error)
- func (m *Manager) Start()
- func (m *Manager) Stop()
- func (m *Manager) SubmitTask(task *Task) error
- func (m *Manager) WaitForResult(taskID string, timeout time.Duration) (*Result, error)
- type Result
- type ResultSynthesizer
- type SubAgent
- type SubTaskNode
- type SubTaskStatus
- type Task
- type TaskDAG
- func (dag *TaskDAG) AddNode(node *SubTaskNode) error
- func (dag *TaskDAG) GenerateDAGSummary() string
- func (dag *TaskDAG) GetAllNodes() []*SubTaskNode
- func (dag *TaskDAG) GetFailedTasks() []*SubTaskNode
- func (dag *TaskDAG) GetNode(id string) *SubTaskNode
- func (dag *TaskDAG) GetProgress() float64
- func (dag *TaskDAG) GetReadyTasks() []*SubTaskNode
- func (dag *TaskDAG) GetResults() map[string]string
- func (dag *TaskDAG) IsComplete() bool
- func (dag *TaskDAG) UpdateStatus(id string, status SubTaskStatus) error
- type TaskStatus
- type Tool
- type ToolRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentFactory ¶ added in v0.3.0
type AgentFactory func(provider provider.Provider, registry ToolRegistry, toolsSchema []map[string]interface{}, systemPrompt string) AgentRunner
AgentFactory is a function type for creating agents
type AgentRunner ¶ added in v0.3.0
AgentRunner is an interface for running agent conversations
type Config ¶
type Config struct {
MaxConcurrent int `json:"max_concurrent"` // Max parallel subagents
MaxDepth int `json:"max_depth"` // Max recursion depth
Timeout time.Duration `json:"timeout"` // Task timeout
EnableNested bool `json:"enable_nested"` // Enable nested subagents
}
Config holds subagent configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns default subagent configuration
type DAGExecutor ¶ added in v0.5.1
type DAGExecutor struct {
// Configuration
MaxConcurrency int
Timeout time.Duration
// contains filtered or unexported fields
}
DAGExecutor executes a task DAG with configurable concurrency
func NewDAGExecutor ¶ added in v0.5.1
func NewDAGExecutor(dag *TaskDAG, prov provider.Provider, cfg DAGExecutorConfig) *DAGExecutor
NewDAGExecutor creates a new DAG executor
type DAGExecutorConfig ¶ added in v0.5.1
DAGExecutorConfig configures the DAG executor
func DefaultDAGExecutorConfig ¶ added in v0.5.1
func DefaultDAGExecutorConfig() DAGExecutorConfig
DefaultDAGExecutorConfig returns default config
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages all subagents
func NewManager ¶
func NewManager(cfg *Config, prov provider.Provider, registry ToolRegistry, factory AgentFactory) *Manager
NewManager creates a new subagent manager
func (*Manager) CancelTask ¶ added in v0.3.0
CancelTask cancels a task by ID
func (*Manager) KillSubAgent ¶
KillSubAgent terminates a subagent
func (*Manager) ListSubAgents ¶
ListSubAgents returns all active subagents
func (*Manager) ListTasks ¶ added in v0.3.0
func (m *Manager) ListTasks(statusFilter TaskStatus) []*Task
ListTasks returns all tasks with optional status filter
func (*Manager) SpawnMultiple ¶
func (m *Manager) SpawnMultiple(tasks []struct { Description string Input string Tools []string }) ([]Result, error)
SpawnMultiple spawns multiple tasks and waits for all results
func (*Manager) SpawnNestedTask ¶ added in v0.3.0
func (m *Manager) SpawnNestedTask(parentTaskID, description, input string, tools []string, ctx map[string]interface{}) (string, error)
SpawnNestedTask spawns a nested subagent task from a parent task
func (*Manager) SpawnTaskWithContext ¶
func (m *Manager) SpawnTaskWithContext(description, input string, tools []string, ctx map[string]interface{}) (string, error)
SpawnTaskWithContext spawns a task with additional context
func (*Manager) SubmitTask ¶
SubmitTask submits a task to the queue
type Result ¶
type Result struct {
TaskID string `json:"task_id"`
Success bool `json:"success"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
Duration time.Duration `json:"duration"`
SubResults []Result `json:"sub_results,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Result represents the result of a subagent task
type ResultSynthesizer ¶ added in v0.5.1
type ResultSynthesizer struct {
// contains filtered or unexported fields
}
ResultSynthesizer synthesizes results from multiple sub-agents
func NewResultSynthesizer ¶ added in v0.5.1
func NewResultSynthesizer(prov provider.Provider) *ResultSynthesizer
NewResultSynthesizer creates a new result synthesizer
func (*ResultSynthesizer) SynthesizeResults ¶ added in v0.5.1
func (rs *ResultSynthesizer) SynthesizeResults(ctx context.Context, goal string, results map[string]string, failedTasks []*SubTaskNode) (string, error)
SynthesizeResults combines results from multiple sub-tasks into a coherent final result
type SubAgent ¶
type SubAgent struct {
// contains filtered or unexported fields
}
SubAgent represents a subagent that can execute tasks
type SubTaskNode ¶ added in v0.5.1
type SubTaskNode struct {
ID string
Description string
Role string // researcher, coder, reviewer, planner, etc.
Tools []string // Tools available to this sub-agent
Priority int
Dependencies []string // IDs of tasks that must complete first
Status SubTaskStatus
Result string
Error string
Agent *SubAgent
StartTime time.Time
EndTime time.Time
Duration time.Duration
Retries int
MaxRetries int
}
SubTaskNode represents a node in the task dependency graph
type SubTaskStatus ¶ added in v0.5.1
type SubTaskStatus string
SubTaskStatus represents the status of a sub-task
const ( SubTaskPending SubTaskStatus = "pending" SubTaskReady SubTaskStatus = "ready" SubTaskRunning SubTaskStatus = "running" SubTaskCompleted SubTaskStatus = "completed" SubTaskFailed SubTaskStatus = "failed" SubTaskSkipped SubTaskStatus = "skipped" )
type Task ¶
type Task struct {
ID string `json:"id"`
Description string `json:"description"`
Input string `json:"input"`
Tools []string `json:"tools,omitempty"` // Tools to enable for this task
Context map[string]interface{} `json:"context,omitempty"`
ParentID string `json:"parent_id,omitempty"`
Depth int `json:"depth"`
Status TaskStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Cancelled bool `json:"cancelled"`
// contains filtered or unexported fields
}
Task represents a task to be executed by a subagent
func (*Task) GetStatus ¶ added in v0.3.0
func (t *Task) GetStatus() TaskStatus
GetStatus gets the task status thread-safely
func (*Task) IsCancelled ¶ added in v0.3.0
IsCancelled checks if the task is cancelled
func (*Task) SetStatus ¶ added in v0.3.0
func (t *Task) SetStatus(status TaskStatus)
SetStatus sets the task status thread-safely
type TaskDAG ¶ added in v0.5.1
type TaskDAG struct {
// contains filtered or unexported fields
}
TaskDAG manages a directed acyclic graph of sub-tasks
func BuildDAGFromPlan ¶ added in v0.5.1
func BuildDAGFromPlan(planDescription string, tasks []struct { ID string Description string Role string Tools []string Deps []string Priority int }) (*TaskDAG, error)
BuildDAGFromPlan builds a task DAG from a plan description
func (*TaskDAG) AddNode ¶ added in v0.5.1
func (dag *TaskDAG) AddNode(node *SubTaskNode) error
AddNode adds a task node to the DAG
func (*TaskDAG) GenerateDAGSummary ¶ added in v0.5.1
GenerateDAGSummary generates a text summary of the DAG status
func (*TaskDAG) GetAllNodes ¶ added in v0.5.1
func (dag *TaskDAG) GetAllNodes() []*SubTaskNode
GetAllNodes returns all nodes in topological order
func (*TaskDAG) GetFailedTasks ¶ added in v0.5.1
func (dag *TaskDAG) GetFailedTasks() []*SubTaskNode
GetFailedTasks returns all failed tasks
func (*TaskDAG) GetNode ¶ added in v0.5.1
func (dag *TaskDAG) GetNode(id string) *SubTaskNode
GetNode gets a task node by ID
func (*TaskDAG) GetProgress ¶ added in v0.5.1
GetProgress returns the overall progress (0.0 - 1.0)
func (*TaskDAG) GetReadyTasks ¶ added in v0.5.1
func (dag *TaskDAG) GetReadyTasks() []*SubTaskNode
GetReadyTasks returns tasks whose dependencies are all satisfied
func (*TaskDAG) GetResults ¶ added in v0.5.1
GetResults returns all completed results in topological order
func (*TaskDAG) IsComplete ¶ added in v0.5.1
IsComplete returns whether all tasks are done (completed or failed)
func (*TaskDAG) UpdateStatus ¶ added in v0.5.1
func (dag *TaskDAG) UpdateStatus(id string, status SubTaskStatus) error
UpdateStatus updates the status of a task node
type TaskStatus ¶ added in v0.3.0
type TaskStatus string
TaskStatus represents the status of a task
const ( TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusFailed TaskStatus = "failed" TaskStatusCancelled TaskStatus = "cancelled" )