team

package
v1.8.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentTeam

type AgentTeam struct {
	// contains filtered or unexported fields
}

AgentTeam implements the agent.Team interface with multiple collaboration modes.

func (*AgentTeam) Execute

func (t *AgentTeam) Execute(ctx context.Context, task string, opts ...agent.TeamOption) (*agent.TeamResult, error)

Execute runs the team on the given task using the configured mode strategy.

func (*AgentTeam) ID

func (t *AgentTeam) ID() string

ID returns the team's unique identifier.

func (*AgentTeam) Members

func (t *AgentTeam) Members() []agent.TeamMember

Members returns the team's members.

type TeamBuilder

type TeamBuilder struct {
	// contains filtered or unexported fields
}

TeamBuilder provides a fluent API for constructing an AgentTeam.

func NewTeamBuilder

func NewTeamBuilder(name string) *TeamBuilder

NewTeamBuilder creates a new TeamBuilder with sensible defaults.

func (*TeamBuilder) AddMember

func (b *TeamBuilder) AddMember(a agent.Agent, role string) *TeamBuilder

AddMember adds an agent as a team member with the given role.

func (*TeamBuilder) Build

func (b *TeamBuilder) Build(logger *zap.Logger) (*AgentTeam, error)

Build constructs the AgentTeam. Returns an error if validation fails.

func (*TeamBuilder) WithMaxRounds

func (b *TeamBuilder) WithMaxRounds(n int) *TeamBuilder

WithMaxRounds sets the maximum number of rounds.

func (*TeamBuilder) WithMode

func (b *TeamBuilder) WithMode(mode TeamMode) *TeamBuilder

WithMode sets the team collaboration mode.

func (*TeamBuilder) WithPlanner

func (b *TeamBuilder) WithPlanner(enabled bool) *TeamBuilder

WithPlanner enables or disables the TaskPlanner integration (supervisor mode only).

func (*TeamBuilder) WithSelectorPrompt

func (b *TeamBuilder) WithSelectorPrompt(prompt string) *TeamBuilder

WithSelectorPrompt sets the prompt prefix for selector mode.

func (*TeamBuilder) WithTerminationFunc

func (b *TeamBuilder) WithTerminationFunc(fn func([]TurnRecord) bool) *TeamBuilder

WithTerminationFunc sets a custom termination function.

func (*TeamBuilder) WithTimeout

func (b *TeamBuilder) WithTimeout(d time.Duration) *TeamBuilder

WithTimeout sets the execution timeout.

type TeamConfig

type TeamConfig struct {
	Mode            TeamMode
	MaxRounds       int
	Timeout         time.Duration
	EnablePlanner   bool
	SelectorPrompt  string
	TerminationFunc func(history []TurnRecord) bool
}

TeamConfig holds configuration for an AgentTeam.

type TeamMode

type TeamMode string

TeamMode defines the collaboration mode for a team.

const (
	ModeSupervisor TeamMode = "supervisor"  // Supervisor 路由分配
	ModeRoundRobin TeamMode = "round_robin" // 轮询发言
	ModeSelector   TeamMode = "selector"    // LLM 选择下一个 agent
	ModeSwarm      TeamMode = "swarm"       // 自主协作 + handoff
)

type TurnRecord

type TurnRecord struct {
	AgentID string
	Content string
	Round   int
}

TurnRecord records a single turn in the team conversation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL