Documentation
¶
Index ¶
- func AdditionalContextText(values map[string]any) string
- type AgentContextConfig
- type AgentContextManager
- func (m *AgentContextManager) Assemble(ctx context.Context, req *AssembleRequest) (*AssembleResult, error)
- func (m *AgentContextManager) CanAddMessage(messages []types.Message, newMsg types.Message) bool
- func (m *AgentContextManager) EstimateTokens(messages []types.Message) int
- func (m *AgentContextManager) GetRecommendation(messages []types.Message) string
- func (m *AgentContextManager) GetStats() Stats
- func (m *AgentContextManager) GetStatus(messages []types.Message) Status
- func (m *AgentContextManager) PrepareMessages(ctx context.Context, messages []types.Message, currentQuery string) ([]types.Message, error)
- func (m *AgentContextManager) SetSummaryProvider(fn func(context.Context, []types.Message) (string, error))
- func (m *AgentContextManager) ShouldCompress(messages []types.Message) bool
- type AssembleRequest
- type AssembleResult
- type Assembler
- type ContextPlan
- type ContextSegment
- type Level
- type PromptLayer
- type PromptLayerMeta
- type RetrievalItem
- type SegmentType
- type Stats
- type Status
- type Strategy
- type ToolState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdditionalContextText ¶ added in v1.11.0
Types ¶
type AgentContextConfig ¶
type AgentContextConfig struct {
Enabled bool `json:"enabled"`
MaxContextTokens int `json:"max_context_tokens"`
ReserveForOutput int `json:"reserve_for_output"`
SoftLimit float64 `json:"soft_limit"`
WarnLimit float64 `json:"warn_limit"`
HardLimit float64 `json:"hard_limit"`
TargetUsage float64 `json:"target_usage"`
KeepSystem bool `json:"keep_system"`
KeepLastN int `json:"keep_last_n"`
EnableSummarize bool `json:"enable_summarize"`
EnableMetrics bool `json:"enable_metrics"`
MemoryBudgetRatio float64 `json:"memory_budget_ratio"`
RetrievalBudgetRatio float64 `json:"retrieval_budget_ratio"`
ToolStateBudgetRatio float64 `json:"tool_state_budget_ratio"`
Strategy Strategy `json:"strategy"`
}
AgentContextConfig configures the context runtime.
func ConfigFromAgentConfig ¶ added in v1.11.0
func ConfigFromAgentConfig(cfg types.AgentConfig) AgentContextConfig
func DefaultAgentContextConfig ¶
func DefaultAgentContextConfig(modelFamily string) AgentContextConfig
type AgentContextManager ¶
type AgentContextManager struct {
// contains filtered or unexported fields
}
AgentContextManager is the standard context orchestration component used by agents.
func NewAgentContextManager ¶
func NewAgentContextManager(cfg AgentContextConfig, logger *zap.Logger) *AgentContextManager
func (*AgentContextManager) Assemble ¶ added in v1.11.0
func (m *AgentContextManager) Assemble(ctx context.Context, req *AssembleRequest) (*AssembleResult, error)
func (*AgentContextManager) CanAddMessage ¶
func (*AgentContextManager) EstimateTokens ¶
func (m *AgentContextManager) EstimateTokens(messages []types.Message) int
func (*AgentContextManager) GetRecommendation ¶
func (m *AgentContextManager) GetRecommendation(messages []types.Message) string
func (*AgentContextManager) GetStats ¶
func (m *AgentContextManager) GetStats() Stats
func (*AgentContextManager) GetStatus ¶
func (m *AgentContextManager) GetStatus(messages []types.Message) Status
func (*AgentContextManager) PrepareMessages ¶
func (*AgentContextManager) SetSummaryProvider ¶
func (*AgentContextManager) ShouldCompress ¶
func (m *AgentContextManager) ShouldCompress(messages []types.Message) bool
type AssembleRequest ¶ added in v1.11.0
type AssembleResult ¶ added in v1.11.0
type AssembleResult struct {
Messages []types.Message `json:"messages"`
SegmentsKept []ContextSegment `json:"segments_kept,omitempty"`
SegmentsDropped []ContextSegment `json:"segments_dropped,omitempty"`
SegmentsSummarized []ContextSegment `json:"segments_summarized,omitempty"`
TokensBefore int `json:"tokens_before"`
TokensAfter int `json:"tokens_after"`
Plan ContextPlan `json:"plan"`
}
type Assembler ¶ added in v1.11.0
type Assembler struct {
// contains filtered or unexported fields
}
func (*Assembler) Assemble ¶ added in v1.11.0
func (a *Assembler) Assemble(ctx context.Context, req *AssembleRequest) (*AssembleResult, error)
type ContextPlan ¶ added in v1.11.0
type ContextPlan struct {
Budget int `json:"budget"`
Used int `json:"used"`
Strategy string `json:"strategy"`
CompressionReason string `json:"compression_reason,omitempty"`
Breakdown map[SegmentType]int `json:"breakdown,omitempty"`
AppliedLayers []PromptLayerMeta `json:"applied_layers,omitempty"`
}
type ContextSegment ¶ added in v1.11.0
type PromptLayer ¶ added in v1.11.0
type PromptLayerMeta ¶ added in v1.11.0
type RetrievalItem ¶ added in v1.11.0
type SegmentType ¶ added in v1.11.0
type SegmentType string
const ( SegmentSystem SegmentType = "system" SegmentEphemeral SegmentType = "ephemeral" SegmentSkill SegmentType = "skill" SegmentMemory SegmentType = "memory" SegmentConversation SegmentType = "conversation" SegmentRetrieval SegmentType = "retrieval" SegmentToolState SegmentType = "tool_state" SegmentInput SegmentType = "input" SegmentSummary SegmentType = "summary" )
Click to show internal directories.
Click to hide internal directories.