mnesis.models.config¶
config
¶
Configuration models for Mnesis sessions and components.
CompactionConfig
¶
Bases: BaseModel
Configuration for the compaction engine.
Everyday knobs::
CompactionConfig(
auto=True,
compaction_output_budget=20_000,
compaction_model="anthropic/claude-haiku-4-5-20251001",
)
Advanced tuning¶
The following fields control internal compaction behaviour and should only be changed with a thorough understanding of the compaction loop:
soft_threshold_fraction— when to start early background compactionmax_compaction_rounds— cap on summarise+condense cyclescondensation_enabled— whether to merge accumulated summary nodes
auto
class-attribute
instance-attribute
¶
Whether to automatically trigger compaction when overflow is detected.
prune
class-attribute
instance-attribute
¶
Whether to run tool output pruning before compaction.
level2_enabled
class-attribute
instance-attribute
¶
Whether to attempt Level 2 (aggressive) compaction before falling back to Level 3.
FileConfig
¶
Bases: BaseModel
Configuration for large file handling.
StoreConfig
¶
Bases: BaseModel
Configuration for the SQLite persistence layer.
OperatorConfig
¶
Bases: BaseModel
Configuration for LLMMap and AgenticMap operators.
RetryConfig
¶
Bases: BaseModel
Configuration for automatic retry of transient LLM errors in send().
Retry is opt-in: the default max_retries=0 means send() fails
immediately on any LLM error, preserving the pre-0.3.0 behaviour.
Differences from OperatorConfig.max_retries
OperatorConfig.max_retries handles per-item validation errors inside
LLMMap and AgenticMap operators — a different failure domain.
This RetryConfig handles transient LLM transport errors (rate limits,
server errors, timeouts, connection failures) in the send() call path.
AgenticMap sub-sessions
Each AgenticMap sub-session has its own independent RetryConfig.
The effective maximum LLM calls per sub-agent is
(max_retries + 1) * max_turns. Plan capacity accordingly.
litellm num_retries interaction
Mnesis explicitly passes num_retries=0 to litellm.acompletion() to
disable litellm's built-in retry mechanism and prevent double-retrying.
If you set max_retries > 0 here, all retry logic is owned by Mnesis:
backoff, jitter, event publication, and cancellation via close().
SessionConfig
¶
Bases: BaseModel
Configuration for session-level behaviour.
MnesisConfig
¶
Bases: BaseModel
Top-level configuration for an Mnesis session.
All sub-configs have sensible defaults and can be overridden individually.
Example::
config = MnesisConfig(
compaction=CompactionConfig(
compaction_output_budget=30_000,
compaction_model="anthropic/claude-haiku-4-5-20251001",
),
file=FileConfig(inline_threshold=5_000),
)
To override model context/output limits without constructing ModelInfo
directly, use model_overrides::
config = MnesisConfig(
model_overrides={"context_limit": 128_000, "max_output_tokens": 16_384},
)