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
| Name | Type | Description |
|---|---|---|
model | String | Model name for token limits |
max_tokens | usize | Maximum context tokens (0 = auto from model) |
strategy | OptimizerStrategy | Optimization strategy |
monitoring | bool | Enable context monitoring |
output_reserve_pct | f64 | Output reserve percentage |
Methods
new
fn new() -> SelfCreate a new context config
model
fn model(mut self, model: impl Into<String>) -> SelfSet model
Parameters:
| Name | Type |
|---|---|
model | impl Into<String> |
max_tokens
fn max_tokens(mut self, tokens: usize) -> SelfSet max tokens
Parameters:
| Name | Type |
|---|---|
tokens | usize |
strategy
fn strategy(mut self, strategy: OptimizerStrategy) -> SelfSet optimization strategy
Parameters:
| Name | Type |
|---|---|
strategy | OptimizerStrategy |
with_monitoring
fn with_monitoring(mut self) -> SelfEnable monitoring
output_reserve_pct
fn output_reserve_pct(mut self, pct: f64) -> SelfSet output reserve percentage
Parameters:
| Name | Type |
|---|---|
pct | f64 |
Source
View on GitHubpraisonai/src/context/mod.rs at line 194