Context Config • Rust AI Agent SDK

ContextConfig: Configuration for context management.

ContextConfig

Defined in the context module.

Rust AI Agent SDK

Configuration for context management.

Fields

NameTypeDescription
modelStringModel name for token limits
max_tokensusizeMaximum context tokens (0 = auto from model)
strategyOptimizerStrategyOptimization strategy
monitoringboolEnable context monitoring
output_reserve_pctf64Output reserve percentage

Methods

new

rust
fn new() -> Self

Create a new context config

model

rust
fn model(mut self, model: impl Into<String>) -> Self

Set model

Parameters:

NameType
modelimpl Into&lt;String&gt;

max_tokens

rust
fn max_tokens(mut self, tokens: usize) -> Self

Set max tokens

Parameters:

NameType
tokensusize

strategy

rust
fn strategy(mut self, strategy: OptimizerStrategy) -> Self

Set optimization strategy

Parameters:

NameType
strategyOptimizerStrategy

with_monitoring

rust
fn with_monitoring(mut self) -> Self

Enable monitoring

output_reserve_pct

rust
fn output_reserve_pct(mut self, pct: f64) -> Self

Set output reserve percentage

Parameters:

NameType
pctf64

Source

View on GitHub

praisonai/src/context/mod.rs at line 194


Related Documentation