teamloader

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, agentSource config.Source, runConfig *config.RuntimeConfig, opts ...Opt) (*team.Team, error)

Load loads an agent team from the given source

func ToolsetIdentity added in v1.54.0

func ToolsetIdentity(t latest.Toolset) string

ToolsetIdentity returns a stable string that identifies a toolset across reloads. Named toolsets (the common case for MCP/LSP) are keyed by Type+Name. Toolsets without a name fall back to a key derived from their type and connection target.

The function is deterministic and total: every Toolset has a unique non-empty identity even when several share the same config (the fallback includes the JSON signature to break ties).

func ToolsetSignature added in v1.54.0

func ToolsetSignature(t latest.Toolset) string

ToolsetSignature returns a hex-encoded SHA-256 of the canonical JSON representation of t. Two toolsets with byte-identical signatures are considered configuration-identical for hot-reload purposes.

Any field present in latest.Toolset participates in the signature, so adding new fields automatically participates in change detection without further wiring.

func WithInstructions

func WithInstructions(inner tools.ToolSet, instruction string) tools.ToolSet

func WithModelOverride added in v1.30.1

func WithModelOverride(inner tools.ToolSet, model string) tools.ToolSet

WithModelOverride wraps a toolset so that every tool it produces carries the given model in its ModelOverride field, enabling per-toolset model routing.

func WithToolsExcludeFilter

func WithToolsExcludeFilter(inner tools.ToolSet, toolNames ...string) tools.ToolSet

WithToolsExcludeFilter creates a toolset that excludes the specified tools. If no tool names are provided, all tools are included.

func WithToolsFilter

func WithToolsFilter(inner tools.ToolSet, toolNames ...string) tools.ToolSet

WithToolsFilter creates a toolset that only includes the specified tools. If no tool names are provided, all tools are included.

func WithToon

func WithToon(inner tools.ToolSet, toon string) tools.ToolSet

Types

type LoadResult

type LoadResult struct {
	Team      *team.Team
	Models    map[string]latest.ModelConfig
	Providers map[string]latest.ProviderConfig
	// AgentDefaultModels maps agent names to their configured default model references
	AgentDefaultModels map[string]string
}

LoadResult contains the result of loading an agent team, including the team and configuration needed for runtime model switching.

func LoadWithConfig

func LoadWithConfig(ctx context.Context, agentSource config.Source, runConfig *config.RuntimeConfig, opts ...Opt) (*LoadResult, error)

LoadWithConfig loads an agent team and returns both the team and config info needed for runtime model switching.

type Opt

type Opt func(*loadOptions) error

func WithModelOverrides

func WithModelOverrides(overrides []string) Opt

func WithPromptFiles

func WithPromptFiles(files []string) Opt

WithPromptFiles adds additional prompt files to all agents. These are merged with any prompt files defined in the agent config.

func WithToolsetRegistry

func WithToolsetRegistry(registry *ToolsetRegistry) Opt

WithToolsetRegistry allows using a custom toolset registry instead of the default

type ToolsetChange added in v1.54.0

type ToolsetChange struct {
	Old latest.Toolset
	New latest.Toolset
}

ToolsetChange records a Toolset whose identity is unchanged but whose configuration signature differs.

type ToolsetCreator

type ToolsetCreator func(ctx context.Context, toolset latest.Toolset, parentDir string, runConfig *config.RuntimeConfig, configName string) (tools.ToolSet, error)

ToolsetCreator is a function that creates a toolset based on the provided configuration. configName identifies the agent config file (e.g. "memory_agent" from "memory_agent.yaml").

type ToolsetDiff added in v1.54.0

type ToolsetDiff struct {
	Added     []latest.Toolset
	Removed   []latest.Toolset
	Changed   []ToolsetChange
	Unchanged []latest.Toolset
}

ToolsetDiff is the result of comparing two slices of latest.Toolset (typically the currently-running set and a freshly-loaded set from disk). It is a building block for hot-reload: the runtime can stop Removed toolsets, start Added ones, and stop+start Changed ones, while leaving Unchanged toolsets running.

Identity is established by ToolsetIdentity (name+type for named toolsets, falling back to type+command/url for the rare unnamed case). "Changed" is defined as identity-equal but Signature-different.

func DiffToolsets added in v1.54.0

func DiffToolsets(oldList, newList []latest.Toolset) ToolsetDiff

DiffToolsets compares two slices of toolset configs and returns a classification of which toolsets were added, removed, changed, or are unchanged.

The result preserves the order of the new slice for Added/Changed/ Unchanged, and the order of the old slice for Removed; this is a helpful invariant for status messages.

func (ToolsetDiff) HasChanges added in v1.54.0

func (d ToolsetDiff) HasChanges() bool

HasChanges reports whether the diff requires any runtime action. It is useful as a fast-path for the hot-reload trigger: if HasChanges is false, the runtime can skip the diff entirely.

type ToolsetRegistry

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

ToolsetRegistry manages the registration of toolset creators by type

func NewDefaultToolsetRegistry

func NewDefaultToolsetRegistry() *ToolsetRegistry

func NewToolsetRegistry

func NewToolsetRegistry() *ToolsetRegistry

NewToolsetRegistry creates a new empty toolset registry

func (*ToolsetRegistry) CreateTool

func (r *ToolsetRegistry) CreateTool(ctx context.Context, toolset latest.Toolset, parentDir string, runConfig *config.RuntimeConfig, agentName string) (tools.ToolSet, error)

CreateTool creates a toolset using the registered creator for the given type.

Every successful toolset is decorated with tools.WithName so status surfaces (the /tools dialog, error messages, …) always have a stable user-facing label. The decoration is a no-op for toolsets that already advertise a non-empty Name(): it only fills the gap left by built-in toolsets that don't take a `name:` field in YAML, replacing the previous fallback to fmt.Sprintf("%T", ts).

func (*ToolsetRegistry) Get

func (r *ToolsetRegistry) Get(toolsetType string) (ToolsetCreator, bool)

Get retrieves a toolset creator for the given type

func (*ToolsetRegistry) Register

func (r *ToolsetRegistry) Register(toolsetType string, creator ToolsetCreator)

Register adds a new toolset creator for the given type

Jump to

Keyboard shortcuts

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