Help us shape the future of Go! Take the 2026 Go Developer Survey

agent

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentDefinition

func AgentDefinition(presets *PresetRegistry) tools.Definition

AgentDefinition returns the tool definition without requiring a live config. presets is optional — when provided, the preset enum is included in the schema.

Types

type AgentConfig

type AgentConfig struct {
	Providers     providers.ProviderGetter
	Registry      *tools.Registry
	Model         ai.Model
	APIKey        string
	BaseURL       string
	System        string
	Emit          func(agent.LoopEvent) // optional event emitter for observability
	Presets       *PresetRegistry       // loaded agent presets (nil = no presets)
	Hooks         *hooks.HookSet        // inherited by subagents (nil = no hooks)
	ToolLifecycle *agent.ToolLifecycle

	// Configurable limits (zero = use defaults).
	MaxConcurrency int           // max parallel subagent goroutines
	DefaultTimeout time.Duration // default subagent wall-clock timeout (0 = 15m)
}

AgentConfig holds the dependencies needed to spawn subagent loops.

type AgentPreset

type AgentPreset struct {
	Name        string        // unique identifier
	Description string        // human-readable description
	System      string        // markdown body = system prompt for the subagent
	Tools       []string      // nil = all tools; empty slice = no tools
	HasTools    bool          // true when tools is explicitly set (even if empty)
	Timeout     time.Duration // wall-clock timeout override; 0 = use global default
	Model       string        // empty = inherit parent model
	FilePath    string        // absolute path to the source .md file
	Source      string        // "project", "agent", "common", or "builtin"
}

AgentPreset defines a reusable subagent configuration loaded from a markdown file.

func LoadAgentPresets

func LoadAgentPresets(cfg LoadAgentPresetsConfig) []AgentPreset

LoadAgentPresets discovers agent presets in increasing priority order: STELLA_HOME -> agent root -> user root -> project root.

type AgentTool

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

AgentTool spawns child agent loops for bounded subtasks.

func NewAgentTool

func NewAgentTool(cfg AgentConfig) *AgentTool

NewAgentTool creates an agent tool with the given configuration.

func (*AgentTool) Definition

func (t *AgentTool) Definition() tools.Definition

func (*AgentTool) Execute

func (t *AgentTool) Execute(ctx context.Context, args map[string]any) (string, error)

type LoadAgentPresetsConfig

type LoadAgentPresetsConfig struct {
	StellaHome  string // stella home dir (e.g. ~/.stella)
	AgentRoot   string // agent root dir (e.g. ~/.stella/workspaces/{agentID})
	UserRoot    string // user root dir (e.g. ~/.stella/workspaces/{agentID}/users/{userID})
	ProjectRoot string // optional project root for local/project-attached runs
}

LoadAgentPresetsConfig configures the agent preset discovery paths.

type PresetRegistry

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

PresetRegistry holds loaded agent presets with O(1) lookup.

func NewPresetRegistry

func NewPresetRegistry(presets []AgentPreset) *PresetRegistry

NewPresetRegistry creates a registry from a slice of presets.

func (*PresetRegistry) All

func (r *PresetRegistry) All() []AgentPreset

All returns all loaded presets.

func (*PresetRegistry) Lookup

func (r *PresetRegistry) Lookup(name string) (AgentPreset, bool)

Lookup returns a preset by name and whether it exists.

func (*PresetRegistry) Names

func (r *PresetRegistry) Names() []string

Names returns all available preset names in load order.

type SubAgentFinished

type SubAgentFinished struct {
	TaskID   string        `json:"taskId"`
	Duration time.Duration `json:"duration"`
	Error    string        `json:"error,omitempty"`
}

SubAgentFinished is emitted when a subagent task completes.

func (SubAgentFinished) Kind

func (SubAgentFinished) Kind() string

type SubAgentStarted

type SubAgentStarted struct {
	TaskID string `json:"taskId"`
	Preset string `json:"preset,omitempty"`
}

SubAgentStarted is emitted when a subagent task begins execution.

func (SubAgentStarted) Kind

func (SubAgentStarted) Kind() string

Jump to

Keyboard shortcuts

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