Documentation
¶
Overview ¶
Package agent resolves provider configuration into a weft.Model and assembles the hmm agent: name, system prompt, core tools, loop policy. The agent is a value built per invocation; nothing here talks to the network.
Index ¶
Constants ¶
const ( ProviderAnthropic = "anthropic" ProviderOpenAI = "openai" ProviderGoogle = "google" ProviderZai = "zai" ProviderKimi = "kimi" )
Provider names accepted by --provider / HMM_PROVIDER. The three first-party adapters plus zai and kimi: z.ai's GLM and Moonshot's Kimi, both over their OpenAI-compatible endpoints (weft's openai adapter, BaseURL + key).
const DefaultProvider = ProviderAnthropic
DefaultProvider is what runs when nothing else is configured.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build assembles the agent value: name, instructions, core tools, and loop policy. With a Library, the plugin-admin tools join the static set and weft.ToolSource refreshes the advertised tools each step — a plugin installed mid-run is callable by name in the next step (weft's RawTool/ToolSource seams).
func EnvKey ¶
EnvKey returns the provider's key from the environment, following each provider's own conventions (plus hmm's HMM_* names for the gateway providers; the pre-rename BOBINA_* names still work). Empty when unset.
func Instructions ¶
Instructions is the hmm system prompt — a contract the model sees; changes are deliberate and pinned by tests. extra (--system) is appended verbatim.
func NewModel ¶
NewModel resolves Config into a weft.Model. Provider keys follow the adapters' own env conventions; zai and kimi add their own (HMM_ZAI_KEY or ZAI_API_KEY; HMM_KIMI_KEY, KIMI_API_KEY, or MOONSHOT_API_KEY). A missing key is an early, named error.
func StaticToolNames ¶
func StaticToolNames() []string
StaticToolNames lists the built-in tool names (core + plugin admin) in build order. The CLI reserves them on the library before its startup scan, so a plugin already on disk can never shadow one — providers reject duplicate advertised tool names.
Types ¶
type Config ¶
type Config struct {
Provider string
Model string
SystemAppend string // --system: appended to the default prompt
MaxSteps int // 0 keeps weft's default
Sequential bool
Yolo bool
Confirm func(question string) bool // TTY y/N gate (run_command, install_plugin)
// APIKey is the resolved provider key: env by default (EnvKey),
// overridable from the config file. Empty means "not configured".
APIKey string
}
Config is the resolved agent configuration (flags over env, done by the CLI before it reaches here).