config

package
v7.62.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 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 ContextBreakdown added in v7.44.0

type ContextBreakdown struct {
	// AttributionCoverage describes token attribution, independently of preparation coverage.
	AttributionCoverage string `json:"attribution_coverage,omitempty"`
	Limitation          string `json:"limitation,omitempty"`
	// OpaqueBytes is transport diagnostics, never a token category.
	OpaqueBytes int64 `json:"opaque_bytes,omitempty"`
	// Tokenizer identifies the vocabulary; Quality is token_estimate or relative_weight.
	Tokenizer     string `json:"tokenizer,omitempty"`
	Quality       string `json:"quality,omitempty"`
	FramingTokens int64  `json:"framing_tokens,omitempty"`
	// Diagnostic is a bounded non-content reason when attribution is unavailable.
	Diagnostic string `json:"diagnostic,omitempty"`
	// Details refines the existing totals; its weights must not be added again.
	Details              *ContextBreakdownDetails `json:"details,omitempty"`
	Source               string                   `json:"source,omitempty"`
	SystemTokens         int64                    `json:"system_tokens,omitempty"`
	UserTokens           int64                    `json:"user_tokens,omitempty"`
	AssistantTokens      int64                    `json:"assistant_tokens,omitempty"`
	ToolDefinitionTokens int64                    `json:"tool_definition_tokens,omitempty"`
	ToolCallTokens       int64                    `json:"tool_call_tokens,omitempty"`
	ToolResultTokens     int64                    `json:"tool_result_tokens,omitempty"`
	ModelContextTokens   int64                    `json:"model_context_tokens,omitempty"`
	CompactionTokens     int64                    `json:"compaction_tokens,omitempty"`
	ReasoningTokens      int64                    `json:"reasoning_tokens,omitempty"`
	AttachmentTokens     int64                    `json:"attachment_tokens,omitempty"`
}

ContextBreakdown contains approximate, disjoint model-input token weights. It describes the prepared request, never cumulative billing usage or original tool output discarded before model input. Empty Source means unavailable.

type ContextBreakdownDetails added in v7.45.0

type ContextBreakdownDetails = contextpolicy.ContextBreakdownDetails

type ContextCharacterBreakdown added in v7.60.0

type ContextCharacterBreakdown = contextpolicy.ContextCharacterBreakdown

ContextCharacterBreakdown counts visible input; it is never a token estimate.

type ContextCharacterCategory added in v7.60.0

type ContextCharacterCategory = contextpolicy.ContextCharacterCategory

type ContextCharacterDetail added in v7.60.0

type ContextCharacterDetail = contextpolicy.ContextCharacterDetail

type ContextPolicy

type ContextPolicy struct {
	// ModelMaxOutputTokens enables request-fitted budgeting when positive.
	ModelMaxOutputTokens         int64          `json:"model_max_output_tokens,omitempty"`
	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 {
	RequestOutputTokens  int64              `json:"request_output_tokens,omitempty"`
	OutputControl        string             `json:"output_control,omitempty"`
	SafetyMarginTokens   int64              `json:"safety_margin_tokens,omitempty"`
	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 ContextTokenDetail added in v7.45.0

type ContextTokenDetail = contextpolicy.ContextTokenDetail

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"
	ReasoningLevelOn      ReasoningLevel = "on"
	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 {
	Characters           *ContextCharacterBreakdown `json:"characters,omitempty"`
	Breakdown            ContextBreakdown           `json:"breakdown,omitzero"`
	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