agents

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package agents implements declarative agent profiles. An agent is a reusable bundle of (system-prompt addition, tool restrictions, sampler overrides, max-turns) that can replace the default top-level configuration for a session.

Specs come from two places:

  1. Built-ins compiled into the binary (currently `default` and `plan`).
  2. Markdown files at `~/.enso/agents/<name>.md` (user) and `<cwd>/.enso/agents/<name>.md` (project). Project shadows user; user shadows built-in on name collision.

Switching at runtime is currently startup-only: pass `--agent <name>` on the CLI. The TUI's `/agents` slash lists what's available.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Applied

type Applied struct {
	Provider     *llm.Provider
	Registry     *tools.Registry
	PromptAppend string
	MaxTurns     int // 0 = leave caller default in place
}

Applied is the trio of runtime values a Spec produces: a possibly-cloned provider with sampler overrides, a possibly-filtered registry, and a few agent.Config-bound fields the caller threads in directly. Returning a struct (rather than mutating provider/registry in place) keeps the Apply call non-destructive — the caller's defaults survive untouched if no Spec is in play.

func Apply

func Apply(spec *Spec, provider *llm.Provider, registry *tools.Registry) Applied

Apply layers the spec's overrides onto the given baseline. A nil spec is a no-op — caller gets back the same provider/registry it passed in. Sampler overrides clone the provider so two agents in the same process don't share mutated sampler state; the LLM Pool is shared because the endpoint is the same.

type Spec

type Spec struct {
	Name        string
	Description string
	// PromptAppend is appended to the base system prompt with a separating
	// blank line. It does not replace the base prompt — the agent still
	// inherits the binary's default operating instructions.
	PromptAppend string
	// AllowedTools, if non-empty, restricts the registry to this set
	// (intersected with the registry's contents).
	AllowedTools []string
	// DeniedTools, if non-empty, removes these tools from the registry.
	// Applied after AllowedTools.
	DeniedTools []string
	// Sampler overrides. nil = unchanged.
	Temperature *float64
	TopP        *float64
	TopK        *int
	// MaxTurns overrides the default per-user-message turn cap. 0 = unchanged.
	MaxTurns int
}

Spec is a declarative agent profile. Zero values mean "leave the host's default in place" — `nil` for sampler-override pointers, empty slices for tool lists.

func Builtins

func Builtins() []*Spec

Builtins returns the agent specs compiled into the binary. They are shadowed by user and project agents on name collision so a project can retune the prompt or tool set without forking the source.

func Find

func Find(projectCwd, name string) (*Spec, error)

Find returns the Spec named `name`. Lookup order: project agents → user agents → built-ins. Returns nil, nil when the name is empty or "default" (the absence of an agent is itself the default — no overrides).

func LoadAll

func LoadAll(projectCwd string) ([]*Spec, error)

LoadAll returns every agent visible from `projectCwd`: built-ins, plus any `*.md` files in the user / project agents directories. Project shadows user; user shadows built-in.

Jump to

Keyboard shortcuts

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