Documentation
¶
Index ¶
- Variables
- func GetAgentToolSpec() tool.Tool
- func LoadRolesFromIncludePaths(includePaths []string, configDir string) (map[string]*RoleConfig, error)
- func WithContext(ctx context.Context, t Caller) context.Context
- type Agent
- type Caller
- type CoordinationEvent
- type Message
- type PortRange
- type RoleConfig
- type Task
- type Team
- func (t *Team) Add(name string, ag *core.Agent)
- func (t *Team) AddAgent(name string) (*core.Agent, string)
- func (t *Team) AddExistingAgent(name string, agent *core.Agent) error
- func (t *Team) AddRole(role *RoleConfig)
- func (t *Team) AssignTask(ctx context.Context, agentID, taskType, input string) (*Task, error)
- func (t *Team) AvailableRoleNames() []string
- func (t *Team) BroadcastToAllAgents(ctx context.Context, fromAgentID, message string) error
- func (t *Team) Call(ctx context.Context, agentID, input string) (string, error)
- func (t *Team) CallParallel(ctx context.Context, tasks []interface{}) (string, error)
- func (t *Team) CoordinateTask(ctx context.Context, description string) (*Task, error)
- func (t *Team) CoordinationHistoryStrings(limit int) []string
- func (t *Team) DelegateTask(ctx context.Context, role, task string) (string, error)
- func (t *Team) GetAgent(id string) *Agent
- func (t *Team) GetAgentInbox(agentID string) []map[string]interface{}
- func (t *Team) GetAgents() []string
- func (t *Team) GetAllSharedData() map[string]interface{}
- func (t *Team) GetCoordinationHistory(limit int) []string
- func (t *Team) GetCoordinationSummary() string
- func (t *Team) GetInbox(agentID string) []map[string]interface{}
- func (t *Team) GetMaxTurns() int
- func (t *Team) GetMessages(agentID string) []Message
- func (t *Team) GetName() string
- func (t *Team) GetParent() interface{}
- func (t *Team) GetRole(name string) *RoleConfig
- func (t *Team) GetRoles() map[string]*RoleConfig
- func (t *Team) GetSharedData(key string) (interface{}, bool)
- func (t *Team) GetTask(taskID string) *Task
- func (t *Team) GetTeamAgents() []*Agent
- func (t *Team) GetWorkspaceEvents(limit int) []WorkspaceEvent
- func (t *Team) ListAgents() []*Agent
- func (t *Team) ListRoleNames() []string
- func (t *Team) ListRoles() []*RoleConfig
- func (t *Team) ListTasks() []*Task
- func (t *Team) LogCoordinationEvent(eventType, from, to, content string, metadata map[string]interface{})
- func (t *Team) MarkInboxRead(agentID string)
- func (t *Team) MarkMessagesAsRead(agentID string)
- func (t *Team) Names() []string
- func (t *Team) ProposeCollaboration(ctx context.Context, proposerID, targetAgentID, proposal string) error
- func (t *Team) PublishWorkspaceEvent(agentID, eventType, description string, data map[string]interface{})
- func (t *Team) RegisterAgentTool(registry tool.Registry)
- func (t *Team) RequestHelp(ctx context.Context, agentID, helpDescription string, preferredHelper string) error
- func (t *Team) SendMessage(ctx context.Context, from, to, content string) error
- func (t *Team) SendMessageToAgent(ctx context.Context, fromAgentID, toAgentID, message string) error
- func (t *Team) SetMaxTurns(maxTurns int)
- func (t *Team) SetSharedData(key string, value interface{})
- func (t *Team) SpawnAgent(ctx context.Context, name, role string) (*Agent, error)
- func (t *Team) SpawnedAgentNames() []string
- func (t *Team) StopAgent(ctx context.Context, agentID string) error
- func (t *Team) WaitForTask(ctx context.Context, taskID string, timeout time.Duration) (*Task, error)
- type Timer
- type WorkspaceEvent
Constants ¶
This section is empty.
Variables ¶
var ErrNoTeam = errors.New("no team in context")
ErrNoTeam indicates the context is missing a team value.
var ErrUnknownAgent = errors.New("unknown agent")
ErrUnknownAgent is returned when the named agent does not exist.
Functions ¶
func GetAgentToolSpec ¶
GetAgentToolSpec returns the tool specification for the agent tool This can be used to register the tool without creating a team instance
func LoadRolesFromIncludePaths ¶
func LoadRolesFromIncludePaths(includePaths []string, configDir string) (map[string]*RoleConfig, error)
LoadRolesFromIncludePaths loads roles from the include paths in the config
Types ¶
type Agent ¶
type Agent struct {
ID string `json:"id"`
Name string `json:"name"`
Role string `json:"role,omitempty"`
Agent *core.Agent `json:"-"`
Port int `json:"port,omitempty"`
Status string `json:"status"`
StartedAt time.Time `json:"started_at"`
LastSeen time.Time `json:"last_seen"`
Metadata map[string]string `json:"metadata"`
// contains filtered or unexported fields
}
Agent represents a team agent with metadata
type CoordinationEvent ¶
type CoordinationEvent struct {
ID string `json:"id"`
Type string `json:"type"` // "delegation", "message", "task_assign", "status_update"
From string `json:"from"`
To string `json:"to"`
Content string `json:"content"`
Timestamp time.Time `json:"timestamp"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
CoordinationEvent represents an event in agent coordination
type Message ¶
type Message struct {
ID string `json:"id"`
From string `json:"from"`
To string `json:"to"`
Content string `json:"content"`
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
Read bool `json:"read"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Message represents a message between agents
type RoleConfig ¶
type RoleConfig struct {
Name string `json:"name" yaml:"name"`
Model *config.ModelManifest `json:"model,omitempty" yaml:"model,omitempty"`
Prompt string `json:"prompt" yaml:"prompt"`
Tools []string `json:"tools,omitempty" yaml:"tools,omitempty"`
RestrictedTools []string `json:"restricted_tools,omitempty" yaml:"restricted_tools,omitempty"`
Capabilities []string `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
RoleConfig represents configuration for an agent role
func LoadRoleFromFile ¶
func LoadRoleFromFile(path string) (*RoleConfig, error)
LoadRoleFromFile loads a role configuration from a YAML file
type Task ¶
type Task struct {
ID string `json:"id"`
Type string `json:"type"`
AgentID string `json:"agent_id"`
Input string `json:"input"`
Result string `json:"result,omitempty"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Task represents a task assigned to an agent
type Team ¶
type Team struct {
// contains filtered or unexported fields
}
Team manages a multi-agent conversation step by step. This is a simplified version that consolidates the functionality from converse.Team and maintains compatibility.
func NewTeamWithRoles ¶
func NewTeamWithRoles(parent *core.Agent, maxTurns int, name string, includePaths []string, configDir string) (*Team, error)
NewTeamWithRoles creates a new team with the given parent agent and loads role configurations.
func TeamFromContext ¶
TeamFromContext extracts a Team pointer if present. This provides compatibility with legacy converse.TeamFromContext usage.
func (*Team) AddAgent ¶
AddAgent creates a new agent and adds it to the team. Returns the core agent and its assigned name.
func (*Team) AddExistingAgent ¶
AddExistingAgent adds an existing agent to the team
func (*Team) AddRole ¶
func (t *Team) AddRole(role *RoleConfig)
AddRole adds a role configuration to the team
func (*Team) AssignTask ¶
AssignTask assigns a task to a specific agent
func (*Team) AvailableRoleNames ¶
AvailableRoleNames returns role names from configuration files
func (*Team) BroadcastToAllAgents ¶
BroadcastToAllAgents sends a message to all agents
func (*Team) CallParallel ¶
CallParallel executes multiple agent tasks in parallel for improved efficiency
func (*Team) CoordinateTask ¶
CoordinateTask coordinates a complex task across multiple agents
func (*Team) CoordinationHistoryStrings ¶
CoordinationHistoryStrings returns formatted lines of coordination events. If limit <= 0, returns all events; otherwise returns the last 'limit' events.
func (*Team) DelegateTask ¶
DelegateTask delegates a task to a role (spawning if needed)
func (*Team) GetAgentInbox ¶
GetAgentInbox returns unread messages for an agent (as generic maps for tool consumption)
func (*Team) GetAllSharedData ¶
GetAllSharedData returns all shared memory data
func (*Team) GetCoordinationHistory ¶
GetCoordinationHistory returns coordination event history
func (*Team) GetCoordinationSummary ¶
GetCoordinationSummary returns a summary of recent coordination events
func (*Team) GetMaxTurns ¶
GetMaxTurns returns the maximum number of turns
func (*Team) GetMessages ¶
GetMessages returns messages with optional filtering
func (*Team) GetRole ¶
func (t *Team) GetRole(name string) *RoleConfig
GetRole returns a role configuration by name
func (*Team) GetRoles ¶
func (t *Team) GetRoles() map[string]*RoleConfig
GetRoles returns the loaded role configurations by name.
func (*Team) GetSharedData ¶
GetSharedData retrieves data from shared memory
func (*Team) GetTeamAgents ¶
GetTeamAgents returns a list of all team agents with role information.
func (*Team) GetWorkspaceEvents ¶
func (t *Team) GetWorkspaceEvents(limit int) []WorkspaceEvent
GetWorkspaceEvents returns recent workspace events
func (*Team) ListAgents ¶
ListAgents returns all agents in the team
func (*Team) ListRoleNames ¶
ListRoleNames returns all available role names
func (*Team) ListRoles ¶
func (t *Team) ListRoles() []*RoleConfig
ListRoles returns all available roles
func (*Team) LogCoordinationEvent ¶
func (t *Team) LogCoordinationEvent(eventType, from, to, content string, metadata map[string]interface{})
LogCoordinationEvent adds a coordination event to the log and persists it.
func (*Team) MarkInboxRead ¶
MarkInboxRead marks an agent's messages as read
func (*Team) MarkMessagesAsRead ¶
MarkMessagesAsRead marks messages in an agent's inbox as read
func (*Team) ProposeCollaboration ¶
func (t *Team) ProposeCollaboration(ctx context.Context, proposerID, targetAgentID, proposal string) error
ProposeCollaboration allows agents to propose working together
func (*Team) PublishWorkspaceEvent ¶
func (t *Team) PublishWorkspaceEvent(agentID, eventType, description string, data map[string]interface{})
PublishWorkspaceEvent publishes an event that all agents can see
func (*Team) RegisterAgentTool ¶
RegisterAgentTool registers the "agent" tool with the given tool registry. This must be called after creating the team to avoid import cycles.
func (*Team) RequestHelp ¶
func (t *Team) RequestHelp(ctx context.Context, agentID, helpDescription string, preferredHelper string) error
RequestHelp allows an agent to request help from other agents
func (*Team) SendMessage ¶
SendMessage sends a message from one agent to another
func (*Team) SendMessageToAgent ¶
func (t *Team) SendMessageToAgent(ctx context.Context, fromAgentID, toAgentID, message string) error
SendMessageToAgent enables direct communication between agents
func (*Team) SetMaxTurns ¶
SetMaxTurns sets the maximum number of turns for conversations
func (*Team) SetSharedData ¶
SetSharedData stores data in shared memory accessible to all agents
func (*Team) SpawnAgent ¶
SpawnAgent creates a new agent with the given configuration
func (*Team) SpawnedAgentNames ¶
SpawnedAgentNames returns currently running agent instances
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer utility for performance debugging
func StartTimer ¶
type WorkspaceEvent ¶
type WorkspaceEvent struct {
ID string `json:"id"`
Type string `json:"type"` // "file_created", "task_started", "task_completed", "question", "help_request"
AgentID string `json:"agent_id"`
Description string `json:"description"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data"`
}
WorkspaceEvent represents an event in the shared workspace