agentconfig

package
v0.2.75 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MergeStrategyRemotePriority is retained for source compatibility.
	//
	// Deprecated: remote configuration loading was removed; there is no remote
	// config to prioritise. Use MergeStrategyPrimaryPriority.
	MergeStrategyRemotePriority = MergeStrategyPrimaryPriority

	// MergeStrategyLocalPriority is retained for source compatibility.
	//
	// Deprecated: remote configuration loading was removed; both inputs to
	// MergeAgentConfig are now local. Use MergeStrategyBasePriority.
	MergeStrategyLocalPriority = MergeStrategyBasePriority
)

Variables

This section is empty.

Functions

func CleanupExpiredEntries added in v0.2.10

func CleanupExpiredEntries()

CleanupExpiredEntries removes expired cache entries

func ClearCache added in v0.2.10

func ClearCache()

ClearCache clears all cached configurations

func ClearCacheEntry added in v0.2.10

func ClearCacheEntry(key string)

ClearCacheEntry removes a specific cache entry

func ExampleAdvancedOptions added in v0.2.10

func ExampleAdvancedOptions()

ExampleAdvancedOptions shows advanced configuration options

func ExampleBasicUsage added in v0.2.10

func ExampleBasicUsage()

ExampleBasicUsage shows the simplest way to load an agent with automatic source detection

func ExampleConfigurationPreview added in v0.2.10

func ExampleConfigurationPreview()

ExampleConfigurationPreview shows how to preview configurations without creating agents

func ExampleErrorHandling added in v0.2.10

func ExampleErrorHandling()

ExampleErrorHandling shows proper error handling patterns

func ExampleExplicitSources added in v0.2.10

func ExampleExplicitSources()

ExampleExplicitSources shows how to load from a specific configuration file

func ExampleMigrationFromOldAPI added in v0.2.10

func ExampleMigrationFromOldAPI()

ExampleMigrationFromOldAPI shows how to migrate from old file-based loading

func ExampleWithVariables added in v0.2.10

func ExampleWithVariables()

ExampleWithVariables shows how to pass custom variables

func GetCacheStats added in v0.2.10

func GetCacheStats() map[string]int

GetCacheStats returns cache statistics for monitoring

func LoadAgentAuto deprecated added in v0.2.10

func LoadAgentAuto(ctx context.Context, agentName, environment string, options ...agent.Option) (*agent.Agent, error)

LoadAgentAuto loads and creates an agent from local configuration.

Deprecated: this previously tried a remote config service before falling back to local. Remote configuration loading has been removed, so this is now identical to LoadAgentFromLocal. Use that instead.

func LoadAgentConfig added in v0.2.10

func LoadAgentConfig(_ context.Context, agentName, environment string, options ...LoadOption) (*agent.AgentConfig, error)

LoadAgentConfig is the main entry point for loading agent configurations.

Configuration is loaded from a local YAML file. Remote configuration loading was removed: it fetched YAML over HTTP and unmarshalled it straight into an AgentConfig whose MCP section names a local executable to run, which handed the config server arbitrary command execution inside the agent process.

func LoadAgentFromLocal added in v0.2.10

func LoadAgentFromLocal(ctx context.Context, agentName, environment string, options ...agent.Option) (*agent.Agent, error)

LoadAgentFromLocal is a convenience function that loads and creates an agent from local file

func LoadAgentWithOptions added in v0.2.10

func LoadAgentWithOptions(ctx context.Context, agentName, environment string, loadOptions []LoadOption, agentOptions ...agent.Option) (*agent.Agent, error)

LoadAgentWithOptions provides full control over loading options

func LoadAgentWithVariables added in v0.2.10

func LoadAgentWithVariables(ctx context.Context, agentName, environment string, variables map[string]string, options ...agent.Option) (*agent.Agent, error)

LoadAgentWithVariables loads an agent and applies variable substitutions

func MergeAgentConfig added in v0.2.11

func MergeAgentConfig(primary, base *agent.AgentConfig, strategy MergeStrategy) *agent.AgentConfig

MergeAgentConfig merges two AgentConfig structs based on the specified strategy For RemotePriority: primary values override base values (remote overrides local) For LocalPriority: base values override primary values (local overrides remote)

func PreviewAgentConfig added in v0.2.10

func PreviewAgentConfig(ctx context.Context, agentName, environment string) (*agent.AgentConfig, error)

PreviewAgentConfig returns the resolved configuration without creating an agent

Types

type ConfigSource added in v0.2.10

type ConfigSource string

ConfigSource indicates where the configuration came from

const (
	ConfigSourceLocal ConfigSource = "local"
	ConfigSourceCache ConfigSource = "cache"

	// ConfigSourceMerged marks a config produced by MergeAgentConfig.
	ConfigSourceMerged ConfigSource = "merged"
)

type LoadOption added in v0.2.10

type LoadOption func(*LoadOptions)

LoadOption is a functional option

func WithCache added in v0.2.10

func WithCache(timeout time.Duration) LoadOption

WithCache enables caching with specified timeout

func WithEnvOverrides added in v0.2.10

func WithEnvOverrides() LoadOption

WithEnvOverrides enables environment variable overrides

func WithLocalFallback deprecated added in v0.2.10

func WithLocalFallback(path string) LoadOption

WithLocalFallback sets an explicit config file path.

Deprecated: configuration is always loaded locally; there is no remote source to fall back from. Use WithLocalPath.

func WithLocalOnly deprecated added in v0.2.10

func WithLocalOnly() LoadOption

WithLocalOnly is a no-op.

Deprecated: configuration is always loaded locally. This option has no effect.

func WithLocalPath added in v0.2.71

func WithLocalPath(path string) LoadOption

WithLocalPath sets an explicit config file path.

func WithVerbose added in v0.2.10

func WithVerbose() LoadOption

WithVerbose enables verbose logging

func WithoutCache added in v0.2.10

func WithoutCache() LoadOption

WithoutCache disables caching

type LoadOptions added in v0.2.10

type LoadOptions struct {
	// LocalPath is a specific config file path. When empty, a set of
	// conventional locations is searched.
	LocalPath string

	// Caching
	EnableCache  bool
	CacheTimeout time.Duration

	// Behavior
	EnableEnvOverrides bool
	Verbose            bool // Log loading steps
}

LoadOptions configures how agent configurations are loaded

func DefaultLoadOptions added in v0.2.10

func DefaultLoadOptions() *LoadOptions

DefaultLoadOptions returns sensible defaults

type MergeStrategy added in v0.2.11

type MergeStrategy string

MergeStrategy determines which of two configs wins when MergeAgentConfig combines them.

const (
	// MergeStrategyNone - no merging.
	MergeStrategyNone MergeStrategy = "none"

	// MergeStrategyPrimaryPriority - the primary config wins; base fills gaps.
	MergeStrategyPrimaryPriority MergeStrategy = "primary_priority"

	// MergeStrategyBasePriority - the base config wins; primary fills gaps.
	MergeStrategyBasePriority MergeStrategy = "base_priority"
)

Jump to

Keyboard shortcuts

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