ollie/agent/runtime.go

38 lines
1.3 KiB
Go

package agent
import (
"encoding/json"
"ollie/backend"
"ollie/toolsrv"
)
// Runtime holds the swappable per-agent configuration. It contains everything
// that changes on an /agent switch but is stable across turns within the same
// agent. The agent struct stores a pointer to the active Runtime; switching
// agents replaces it atomically.
type Runtime struct {
Backend backend.Backend
ToolServer toolsrv.Runner // the execute server (tool runtime, env, cwd)
Preamble string // compiled system prompt
Tools []backend.Tool
Exec toolExecutor
ClassifyTool toolClassifier
OutputFormat func(string) string
ClassifyTier func(string, json.RawMessage) ResultTier
ResetsCounter func(string) bool // true if tool resets step counter
GenParams backend.GenerationParams
MaxSteps int
// CfgBackend and CfgModel are the backend/model overrides from the agent
// config JSON. Empty means no override. Applied by the caller after
// BuildRuntime returns.
CfgBackend string
CfgModel string
// CompactionModel overrides the model used for context compaction.
// Resolved from: agent config > OLLIE_COMPACTION_MODEL env > per-backend default.
CompactionModel string
// Messages holds non-fatal warnings from runtime construction
// (e.g. tool listing errors). Surfaced once at session start.
Messages []string
}