config

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultModels = map[string]string{
	"openai":         "gpt-5-mini",
	"anthropic":      "claude-sonnet-4-5",
	"google":         "gemini-2.5-flash",
	"dmr":            "ai/qwen3:latest",
	"mistral":        "mistral-small-latest",
	"amazon-bedrock": "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
}

Functions

func ApplyModelOverrides

func ApplyModelOverrides(cfg *latest.Config, overrides []string) error

ApplyModelOverrides applies CLI model overrides to the configuration

func AutoEmbeddingModelConfigs

func AutoEmbeddingModelConfigs() []latest.ModelConfig

AutoEmbeddingModelConfigs returns the ordered list of embedding-capable models to try when a RAG strategy uses `model: auto` for embeddings.

The priority is:

  1. OpenAI -> text-embedding-3-small model
  2. DMR -> Google's embeddinggemma model (via Docker Model Runner)

func AutoModelConfig

func AutoModelConfig(ctx context.Context, modelsGateway string, env environment.Provider, defaultModel *latest.ModelConfig) latest.ModelConfig

func AvailableProviders

func AvailableProviders(ctx context.Context, modelsGateway string, env environment.Provider) []string

func BuiltinAgentNames

func BuiltinAgentNames() []string

BuiltinAgentNames returns the names of all built-in agents.

func CheckRequiredEnvVars

func CheckRequiredEnvVars(ctx context.Context, cfg *latest.Config, modelsGateway string, env environment.Provider) error

CheckRequiredEnvVars checks which environment variables are required by the models and tools.

This allows exiting early with a proper error message instead of failing later when trying to use a model or tool.

func GatherEnvVarsForModels

func GatherEnvVarsForModels(cfg *latest.Config) []string

func GatherEnvVarsForTools

func GatherEnvVarsForTools(ctx context.Context, cfg *latest.Config) ([]string, error)

func IsExternalReference

func IsExternalReference(input string) bool

IsExternalReference reports whether the input is an external agent reference (OCI image or URL) rather than a local agent name defined in the same config. Local agent names never contain "/", so the slash check distinguishes them from OCI references like "agentcatalog/pirate" or "docker.io/org/agent:v1".

func IsOCIReference

func IsOCIReference(input string) bool

IsOCIReference checks if the input is a valid OCI reference

func IsURLReference

func IsURLReference(input string) bool

IsURLReference checks if the input is a valid HTTP/HTTPS URL.

func Load

func Load(ctx context.Context, source Source) (*latest.Config, error)

func PreferredMaxTokens

func PreferredMaxTokens(provider string) *int64

func ResolveAlias

func ResolveAlias(agentFilename string) *userconfig.Alias

ResolveAlias resolves an agent reference and returns the alias if it exists and has options. Returns nil if the reference is not an alias or doesn't have options.

func ResolveModelAliases

func ResolveModelAliases(ctx context.Context, cfg *latest.Config, store *modelsdev.Store)

ResolveModelAliases resolves model aliases to their pinned versions in the config. For example, "claude-sonnet-4-5" might resolve to "claude-sonnet-4-5-20250929". This modifies the config in place.

NOTE: Alias resolution is skipped for models with custom base_url configurations, either set directly on the model or inherited from a custom provider definition. This is necessary because external providers (like Azure Foundry) may use the alias names directly as deployment names rather than the pinned version names.

Types

type AutoModelFallbackError

type AutoModelFallbackError struct{}

AutoModelFallbackError is returned when auto model selection fails because no providers are available (no API keys configured and DMR not installed).

func (*AutoModelFallbackError) Error

func (e *AutoModelFallbackError) Error() string

type Config

type Config struct {
	EnvFiles       []string
	ModelsGateway  string
	DefaultModel   *latest.ModelConfig
	GlobalCodeMode bool
	WorkingDir     string
}

type RuntimeConfig

type RuntimeConfig struct {
	Config

	EnvProviderForTests environment.Provider
	// contains filtered or unexported fields
}

func (*RuntimeConfig) Clone

func (runConfig *RuntimeConfig) Clone() *RuntimeConfig

func (*RuntimeConfig) EnvProvider

func (runConfig *RuntimeConfig) EnvProvider() environment.Provider

type Source

type Source interface {
	Name() string
	ParentDir() string
	Read(ctx context.Context) ([]byte, error)
}

func NewBytesSource

func NewBytesSource(name string, data []byte) Source

func NewFileSource

func NewFileSource(path string) Source

func NewOCISource

func NewOCISource(reference string) Source

func NewURLSource

func NewURLSource(rawURL string, envProvider environment.Provider) Source

NewURLSource creates a new URL source. If envProvider is non-nil, it will be used to look up GITHUB_TOKEN for authentication when fetching from GitHub URLs.

func Resolve

func Resolve(agentFilename string, envProvider environment.Provider) (Source, error)

Resolve resolves an agent file reference (local file, URL, or OCI image) to a source. If envProvider is non-nil, it will be used to look up GITHUB_TOKEN for authentication when fetching from GitHub URLs. For OCI references, always checks remote for updates but falls back to local cache if offline.

type Sources

type Sources map[string]Source

func ResolveSources

func ResolveSources(agentsPath string, envProvider environment.Provider) (Sources, error)

ResolveSources resolves an agent file reference (local file, URL, or OCI image) to sources. If envProvider is non-nil, it will be used to look up GITHUB_TOKEN for authentication when fetching from GitHub URLs. For OCI references, always checks remote for updates but falls back to local cache if offline.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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