Documentation
¶
Index ¶
- type AgentCapability
- type Handoff
- type HandoffAgent
- type HandoffContext
- type HandoffManager
- func (m *HandoffManager) FindAgent(task Task) (HandoffAgent, error)
- func (m *HandoffManager) GetHandoff(handoffID string) (*Handoff, error)
- func (m *HandoffManager) Handoff(ctx context.Context, opts HandoffOptions) (*Handoff, error)
- func (m *HandoffManager) RegisterAgent(agent HandoffAgent)
- func (m *HandoffManager) UnregisterAgent(agentID string)
- type HandoffOptions
- type HandoffResult
- type HandoffStatus
- type Message
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentCapability ¶
type AgentCapability struct {
Name string `json:"name"`
Description string `json:"description"`
TaskTypes []string `json:"task_types"`
Priority int `json:"priority"`
}
Agent Captainable 描述一个代理能够做什么.
type Handoff ¶
type Handoff struct {
ID string `json:"id"`
FromAgentID string `json:"from_agent_id"`
ToAgentID string `json:"to_agent_id"`
Task Task `json:"task"`
Status HandoffStatus `json:"status"`
Context HandoffContext `json:"context"`
Result *HandoffResult `json:"result,omitempty"`
CreatedAt time.Time `json:"created_at"`
AcceptedAt *time.Time `json:"accepted_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Timeout time.Duration `json:"timeout"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
// contains filtered or unexported fields
}
Handoff代表着从一个代理人到另一个代理人的任务代表团.
type HandoffAgent ¶
type HandoffAgent interface {
ID() string
Capabilities() []AgentCapability
CanHandle(task Task) bool
AcceptHandoff(ctx context.Context, handoff *Handoff) error
ExecuteHandoff(ctx context.Context, handoff *Handoff) (*HandoffResult, error)
}
支持交接的代理商的交接代理接口.
type HandoffContext ¶
type HandoffContext struct {
ConversationID string `json:"conversation_id,omitempty"`
Messages []Message `json:"messages,omitempty"`
Variables map[string]any `json:"variables,omitempty"`
ParentHandoff string `json:"parent_handoff,omitempty"`
}
HandoffContext为交接提供了上下文.
type HandoffManager ¶
type HandoffManager struct {
// contains filtered or unexported fields
}
HandoffManager管理代理人的交割.
func NewHandoffManager ¶
func NewHandoffManager(logger *zap.Logger) *HandoffManager
NewHandoffManager创建了新的交接管理器.
func (*HandoffManager) FindAgent ¶
func (m *HandoffManager) FindAgent(task Task) (HandoffAgent, error)
FindAgent 找到任务的最佳代理 。
func (*HandoffManager) GetHandoff ¶
func (m *HandoffManager) GetHandoff(handoffID string) (*Handoff, error)
找汉多夫拿回身份证
func (*HandoffManager) Handoff ¶
func (m *HandoffManager) Handoff(ctx context.Context, opts HandoffOptions) (*Handoff, error)
Handoff会向另一个特工交接
func (*HandoffManager) RegisterAgent ¶
func (m *HandoffManager) RegisterAgent(agent HandoffAgent)
代理人登记代理人进行交割.
func (*HandoffManager) UnregisterAgent ¶
func (m *HandoffManager) UnregisterAgent(agentID string)
未注册代理删除代理 。
type HandoffOptions ¶
type HandoffOptions struct {
FromAgentID string
ToAgentID string
Task Task
Context HandoffContext
Timeout time.Duration
MaxRetries int
Wait bool
}
交接选项配置交接。
type HandoffResult ¶
type HandoffResult struct {
Output any `json:"output"`
Error string `json:"error,omitempty"`
Duration int64 `json:"duration_ms"`
}
HandoffResult包含完成交接的结果.
type HandoffStatus ¶
type HandoffStatus string
交接状态代表交接状态.
const ( StatusPending HandoffStatus = "pending" StatusAccepted HandoffStatus = "accepted" StatusRejected HandoffStatus = "rejected" StatusInProgress HandoffStatus = "in_progress" StatusCompleted HandoffStatus = "completed" StatusFailed HandoffStatus = "failed" )
Click to show internal directories.
Click to hide internal directories.