Module session

Module session 

Source
Expand description

Session management and context compaction. LLM session management with automatic context compaction.

Structs§

CompactResult
Result of a manual compaction operation. Used by force_compact() to report what happened during compaction.
CompactionConfig
Configuration for conversation compaction
CompactionResult
Result of a compaction operation.
LLMCompactor
LLM-based compactor that summarizes older conversation using an LLM. It replaces older messages with a single summary message while preserving recent turns.
LLMCompactorConfig
Configuration for LLM-based conversation compaction.
LLMSession
A session that manages communication with an LLM
LLMSessionConfig
Configuration for creating an LLM session
LLMSessionManager
Manages multiple LLM sessions
SessionStatus
Current status of an LLM session
ThresholdCompactor
Compacts when context usage exceeds a threshold. It identifies turns to keep (most recent N) and applies the configured compaction strategy to older tool results.
TokenUsage
Token usage statistics for the session

Enums§

CompactionError
Error type for async compaction operations.
CompactorConfigError
Error type for compactor configuration.
CompactorType
Type of compaction strategy to use.
LLMProvider
LLM provider type
ToolCompaction
Defines how tool results are handled during compaction.

Traits§

AsyncCompactor
Trait for async compaction strategies that require LLM calls. Implementors must also implement Compactor with is_async() -> true.
Compactor
Trait for conversation compaction strategies. Implementations decide when and how to compact conversation history to reduce token usage while preserving important context.