Documentation
¶
Overview ¶
Package host implements the host pattern for multi-agent system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAgentCallbacks ¶
func WithAgentCallbacks(agentCallbacks ...MultiAgentCallback) agent.AgentOption
Types ¶
type AgentMeta ¶
type AgentMeta struct { Name string // the name of the agent, should be unique within multi-agent system IntendedUse string // the intended use-case of the agent, used as the reason for the multi-agent system to hand over control to this agent }
AgentMeta is the meta information of an agent within a multi-agent system.
type HandOffInfo ¶
HandOffInfo is the info which will be passed to MultiAgentCallback.OnHandOff, representing a hand off event.
type Host ¶
Host is the host agent within a multi-agent system. Currently, it can only be a model.ChatModel.
type MultiAgent ¶
type MultiAgent struct {
// contains filtered or unexported fields
}
MultiAgent is a host multi-agent system. A host agent is responsible for deciding which specialist to 'hand off' the task to. One or more specialist agents are responsible for completing the task.
func NewMultiAgent ¶
func NewMultiAgent(ctx context.Context, config *MultiAgentConfig) (*MultiAgent, error)
NewMultiAgent creates a new host multi-agent system.
func (*MultiAgent) Generate ¶
func (ma *MultiAgent) Generate(ctx context.Context, input []*schema.Message, opts ...agent.AgentOption) (*schema.Message, error)
func (*MultiAgent) Stream ¶
func (ma *MultiAgent) Stream(ctx context.Context, input []*schema.Message, opts ...agent.AgentOption) (*schema.StreamReader[*schema.Message], error)
type MultiAgentCallback ¶
type MultiAgentCallback interface {
OnHandOff(ctx context.Context, info *HandOffInfo) context.Context
}
MultiAgentCallback is the callback interface for host multi-agent.
type MultiAgentConfig ¶
type MultiAgentConfig struct { Host Host Specialists []*Specialist Name string // the name of the host multi agent }
MultiAgentConfig is the config for host multi-agent system.
type Specialist ¶
type Specialist struct { AgentMeta ChatModel model.ChatModel SystemPrompt string Invokable compose.Invoke[[]*schema.Message, *schema.Message, agent.AgentOption] Streamable compose.Stream[[]*schema.Message, *schema.Message, agent.AgentOption] }
Specialist is a specialist agent within a host multi-agent system. It can be a model.ChatModel or any Invokable and/or Streamable, such as react.Agent. ChatModel and (Invokable / Streamable) are mutually exclusive, only one should be provided. If Invokable is provided but not Streamable, then the Specialist will be compose.InvokableLambda. If Streamable is provided but not Invokable, then the Specialist will be compose.StreamableLambda. if Both Invokable and Streamable is provided, then the Specialist will be compose.AnyLambda.