ollie/agent/runtime.go

37 lines
1.4 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
// toolRegistryRevision tracks the last-seen tool registry revision. When the
// registry revision advances (after tool_load/unload), the next turn
// will detect the mismatch and refetch.
toolRegistryRevision uint64
// 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
}