config

package
v4.0.19 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config defines product-neutral Agent, provider, reasoning, and context-policy configuration for Floret.

Configuration describes how a host asks Floret to run an Agent. It does not own execution identity, durable conversation state, credential persistence, or host authorization. A resolved Config may carry provider credentials for one composition; the host remains responsible for secret selection, storage, and lifecycle. Runtime identities and capabilities are defined by package runtime.

Index

Constants

View Source
const (
	MinSupportedContextWindowTokens     int64 = 256000
	DefaultContextWindowTokens          int64 = MinSupportedContextWindowTokens
	DefaultMaxOutputTokens              int64 = 0
	DefaultReservedOutputTokens         int64 = 64000
	DefaultAutoCompactRatioPercent      int64 = 90
	DefaultCompactedContextTargetTokens int64 = 50000
	DefaultReservedSummaryTokens        int64 = 20000
	DefaultRecentTailTokens             int64 = 12000
	DefaultRecentUserTokens             int64 = 15000
	DefaultCheckpointOverheadTokens     int64 = 2000
	DefaultEstimatorSource                    = "generic_conservative"
	DefaultEstimatorMethod                    = EstimateMethodMessageContext
)
View Source
const (
	ReasoningKindNone         = "none"
	ReasoningKindEffort       = "effort"
	ReasoningKindToggle       = "toggle"
	ReasoningKindBudget       = "budget"
	ReasoningKindToggleBudget = "toggle_budget"
	ReasoningKindEffortBudget = "effort_budget"
	ReasoningKindAlwaysOn     = "always_on"
	ReasoningKindDynamic      = "provider_dynamic"
)

Variables

This section is empty.

Functions

func ValidateReasoningLevel

func ValidateReasoningLevel(level ReasoningLevel) bool

Types

type AgentConfig

type AgentConfig struct {
	Profile      AgentProfile       `json:"profile"`
	SystemPrompt string             `json:"system_prompt"`
	Context      ContextPolicy      `json:"context"`
	Reasoning    ReasoningSelection `json:"reasoning,omitempty"`
}

AgentConfig contains only the provider-neutral persona and model-behavior policy of an Agent. Transport credentials and provider selection do not belong in this contract.

func (AgentConfig) Validate

func (configuration AgentConfig) Validate() error

Validate verifies that persona and prompt identity are explicit and that the provider-neutral policies are internally coherent.

type AgentProfile

type AgentProfile struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

AgentProfile is immutable persona metadata. The canonical prompt belongs to AgentConfig.SystemPrompt and is never duplicated here.

type ContextPolicy

type ContextPolicy struct {
	ContextWindowTokens          int64          `json:"context_window_tokens,omitempty"`
	MaxOutputTokens              int64          `json:"max_output_tokens,omitempty"`
	ReservedOutputTokens         int64          `json:"reserved_output_tokens,omitempty"`
	ReservedSummaryTokens        int64          `json:"reserved_summary_tokens,omitempty"`
	RecentTailTokens             int64          `json:"recent_tail_tokens,omitempty"`
	RecentUserTokens             int64          `json:"recent_user_tokens,omitempty"`
	CompactedContextTargetTokens int64          `json:"compacted_context_target_tokens,omitempty"`
	EstimatorSource              string         `json:"estimator_source,omitempty"`
	EstimatorMethod              EstimateMethod `json:"estimator_method,omitempty"`
	MaxCompactionFailures        int            `json:"max_compaction_failures,omitempty"`
}

type ContextPressure

type ContextPressure struct {
	WindowInputTokens    int64              `json:"window_input_tokens,omitempty"`
	ProjectedInputTokens int64              `json:"projected_input_tokens,omitempty"`
	ContextWindowTokens  int64              `json:"context_window_tokens,omitempty"`
	ThresholdTokens      int64              `json:"threshold_tokens,omitempty"`
	RequestSafeLimit     int64              `json:"request_safe_limit_tokens,omitempty"`
	OutputHeadroomTokens int64              `json:"output_headroom_tokens,omitempty"`
	Signal               PressureSignal     `json:"pressure_signal,omitempty"`
	Source               PressureSource     `json:"pressure_source,omitempty"`
	EstimateMethod       EstimateMethod     `json:"estimate_method,omitempty"`
	Confidence           EstimateConfidence `json:"confidence,omitempty"`
	CompactionNeeded     bool               `json:"compaction_needed,omitempty"`
	HardLimitExceeded    bool               `json:"hard_limit_exceeded,omitempty"`
}

type ContextUsage

type ContextUsage struct {
	PrefixTokens      int64              `json:"prefix_tokens,omitempty"`
	MessageTokens     int64              `json:"message_tokens,omitempty"`
	InputTokens       int64              `json:"input_tokens,omitempty"`
	ContextWindow     int64              `json:"context_window,omitempty"`
	ThresholdTokens   int64              `json:"threshold_tokens,omitempty"`
	RatioLimitTokens  int64              `json:"ratio_limit_tokens,omitempty"`
	RequestSafeLimit  int64              `json:"request_safe_limit_tokens,omitempty"`
	MaxOutputTokens   int64              `json:"max_output_tokens,omitempty"`
	ReservedOutput    int64              `json:"reserved_output,omitempty"`
	ReservedSummary   int64              `json:"reserved_summary,omitempty"`
	OutputHeadroom    int64              `json:"output_headroom_tokens,omitempty"`
	AutoCompactRatio  int64              `json:"auto_compact_ratio_pct,omitempty"`
	RecentTailTokens  int64              `json:"recent_tail_tokens,omitempty"`
	RecentUserTokens  int64              `json:"recent_user_tokens,omitempty"`
	Source            string             `json:"source,omitempty"`
	Method            EstimateMethod     `json:"method,omitempty"`
	Confidence        EstimateConfidence `json:"confidence,omitempty"`
	CompactionNeeded  bool               `json:"compaction_needed,omitempty"`
	HardLimitExceeded bool               `json:"hard_limit_exceeded,omitempty"`
}

type EstimateConfidence

type EstimateConfidence string
const (
	EstimateExact        EstimateConfidence = "exact"
	EstimateApproximate  EstimateConfidence = "approximate"
	EstimateConservative EstimateConfidence = "conservative"
)

type EstimateMethod

type EstimateMethod string
const (
	EstimateMethodGenericPayload          EstimateMethod = "generic_payload_estimate"
	EstimateMethodProviderRenderedPayload EstimateMethod = "provider_rendered_payload_estimate"
	EstimateMethodMessageContext          EstimateMethod = "message_context_estimate"
	EstimateMethodOfficialPreflightCount  EstimateMethod = "official_preflight_count"
	EstimateMethodUnknown                 EstimateMethod = "unknown_estimate_method"
)

type PressureSignal

type PressureSignal string
const (
	PressureSignalNativeUsage PressureSignal = "native_usage"
	PressureSignalProjected   PressureSignal = "projected_request"
	PressureSignalOverflow    PressureSignal = "provider_overflow"
	PressureSignalManual      PressureSignal = "manual"
)

type PressureSource

type PressureSource string
const (
	PressureSourceProviderUsage       PressureSource = "provider_usage"
	PressureSourceUsageAnchoredDelta  PressureSource = "usage_anchored_delta"
	PressureSourceFullRequestEstimate PressureSource = "full_request_estimate"
	PressureSourceMissingNativeUsage  PressureSource = "missing_native_usage_request_estimate"
	PressureSourceManual              PressureSource = "manual"
)

type ReasoningBudget

type ReasoningBudget struct {
	MinTokens int64 `json:"min_tokens,omitempty"`
	MaxTokens int64 `json:"max_tokens,omitempty"`
}

type ReasoningCapability

type ReasoningCapability struct {
	Kind              string           `json:"kind"`
	SupportedLevels   []ReasoningLevel `json:"supported_levels,omitempty"`
	DefaultLevel      ReasoningLevel   `json:"default_level,omitempty"`
	DisableSupported  bool             `json:"disable_supported,omitempty"`
	DefaultEnabled    *bool            `json:"default_enabled,omitempty"`
	Budget            ReasoningBudget  `json:"budget,omitempty"`
	DynamicModelValue bool             `json:"dynamic_model_value,omitempty"`
}

func (ReasoningCapability) IsZero

func (c ReasoningCapability) IsZero() bool

func (ReasoningCapability) Normalize

func (ReasoningCapability) SupportsLevel

func (c ReasoningCapability) SupportsLevel(level ReasoningLevel) bool

func (ReasoningCapability) Validate

func (c ReasoningCapability) Validate() error

type ReasoningLevel

type ReasoningLevel string

ReasoningLevel is a provider-neutral model reasoning intent. Provider adapters translate it into the model-specific wire shape advertised by the selected model capability.

const (
	ReasoningLevelDefault ReasoningLevel = "default"
	ReasoningLevelOff     ReasoningLevel = "off"
	ReasoningLevelMinimal ReasoningLevel = "minimal"
	ReasoningLevelLow     ReasoningLevel = "low"
	ReasoningLevelMedium  ReasoningLevel = "medium"
	ReasoningLevelHigh    ReasoningLevel = "high"
	ReasoningLevelXHigh   ReasoningLevel = "xhigh"
	ReasoningLevelMax     ReasoningLevel = "max"
)

type ReasoningSelection

type ReasoningSelection struct {
	Level        ReasoningLevel `json:"level,omitempty"`
	BudgetTokens int64          `json:"budget_tokens,omitempty"`
}

func NormalizeReasoningSelection

func NormalizeReasoningSelection(s ReasoningSelection) ReasoningSelection

func (ReasoningSelection) IsZero

func (s ReasoningSelection) IsZero() bool

type RequestEstimate

type RequestEstimate struct {
	PrefixTokens         int64              `json:"prefix_tokens,omitempty"`
	MessageTokens        int64              `json:"message_tokens,omitempty"`
	ToolDefinitionTokens int64              `json:"tool_definition_tokens,omitempty"`
	EstimatedInputTokens int64              `json:"estimated_input_tokens,omitempty"`
	Source               string             `json:"source,omitempty"`
	Method               EstimateMethod     `json:"method,omitempty"`
	Confidence           EstimateConfidence `json:"confidence,omitempty"`
}

Jump to

Keyboard shortcuts

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