Documentation
¶
Index ¶
- Variables
- type AgentState
- func (s *AgentState) CompleteTask()
- func (s *AgentState) Get() State
- func (s *AgentState) GetCurrentTask() string
- func (s *AgentState) GetStatus() string
- func (s *AgentState) GetTaskDuration() time.Duration
- func (s *AgentState) IsAvailable() bool
- func (s *AgentState) IsStopRequested() bool
- func (s *AgentState) IsStopped() bool
- func (s *AgentState) IsWorking() bool
- func (s *AgentState) RequestStop()
- func (s *AgentState) Resume()
- func (s *AgentState) StartTask(description string)
- type ChatRequest
- type ChatResponse
- type Pool
- func (p *Pool) Add(w *Worker)
- func (p *Pool) All() []string
- func (p *Pool) Get(name string) (*Worker, bool)
- func (p *Pool) GetStatus() map[string]string
- func (p *Pool) GetStoppedWorkers() []string
- func (p *Pool) Pause(name string) bool
- func (p *Pool) PauseAll()
- func (p *Pool) Resume(name string) bool
- func (p *Pool) ResumeAll()
- func (p *Pool) StartAll()
- func (p *Pool) StopAll()
- type State
- type TaskRequest
- type TaskResponse
- type Worker
- func (w *Worker) IsStopped() bool
- func (w *Worker) Name() string
- func (w *Worker) Pause()
- func (w *Worker) Resume()
- func (w *Worker) SendChat(input string, response chan<- ChatResponse)
- func (w *Worker) SendTask(description, prompt string, response chan<- TaskResponse)
- func (w *Worker) SetPromptBuilder(fn func(agentName, input string) string)
- func (w *Worker) Start()
- func (w *Worker) State() *AgentState
- func (w *Worker) Stop()
Constants ¶
This section is empty.
Variables ¶
var ErrAgentStopped = fmt.Errorf("agent is stopped")
ErrAgentStopped is returned when attempting to send a task to a stopped agent
Functions ¶
This section is empty.
Types ¶
type AgentState ¶
type AgentState struct {
// contains filtered or unexported fields
}
AgentState holds the current state of an agent
func (*AgentState) CompleteTask ¶
func (s *AgentState) CompleteTask()
CompleteTask transitions to available state or stopped state if stop was requested
func (*AgentState) GetCurrentTask ¶
func (s *AgentState) GetCurrentTask() string
GetCurrentTask returns the current task description
func (*AgentState) GetStatus ¶
func (s *AgentState) GetStatus() string
GetStatus returns a human-readable status message
func (*AgentState) GetTaskDuration ¶
func (s *AgentState) GetTaskDuration() time.Duration
GetTaskDuration returns how long the current task has been running
func (*AgentState) IsAvailable ¶
func (s *AgentState) IsAvailable() bool
IsAvailable returns true if the agent is available
func (*AgentState) IsStopRequested ¶ added in v0.9.0
func (s *AgentState) IsStopRequested() bool
IsStopRequested returns true if stop has been requested
func (*AgentState) IsStopped ¶ added in v0.9.0
func (s *AgentState) IsStopped() bool
IsStopped returns true if the agent is stopped
func (*AgentState) IsWorking ¶
func (s *AgentState) IsWorking() bool
IsWorking returns true if the agent is currently working
func (*AgentState) RequestStop ¶ added in v0.9.0
func (s *AgentState) RequestStop()
RequestStop sets the stop flag - agent will stop after current task completes
func (*AgentState) Resume ¶ added in v0.9.0
func (s *AgentState) Resume()
Resume transitions from stopped to available state
func (*AgentState) StartTask ¶
func (s *AgentState) StartTask(description string)
StartTask transitions to working state
type ChatRequest ¶
type ChatRequest struct {
Input string
Response chan<- ChatResponse
}
ChatRequest represents a chat/conversation request
type ChatResponse ¶
ChatResponse is the response to a chat request
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool manages multiple workers
func (*Pool) GetStoppedWorkers ¶ added in v0.9.0
GetStoppedWorkers returns names of stopped workers
type TaskRequest ¶
type TaskRequest struct {
Description string
Prompt string
Response chan<- TaskResponse
}
TaskRequest represents a work task request
type TaskResponse ¶
TaskResponse is the response to a task request
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker manages an agent's chat and task goroutines
func (*Worker) Pause ¶ added in v0.9.0
func (w *Worker) Pause()
Pause requests the worker to stop after completing current task
func (*Worker) SendChat ¶
func (w *Worker) SendChat(input string, response chan<- ChatResponse)
SendChat sends a chat request and returns immediately The response will be sent to the provided channel
func (*Worker) SendTask ¶
func (w *Worker) SendTask(description, prompt string, response chan<- TaskResponse)
SendTask sends a task request and returns immediately
func (*Worker) SetPromptBuilder ¶
SetPromptBuilder sets the callback for building prompts