Context Agent • Rust AI Agent SDK
ContextAgent: Context agent for managing conversation context
ContextAgent
Defined in the specialized module.
Rust AI Agent SDK
Context agent for managing conversation context
Fields
| Name | Type | Description |
|---|---|---|
config | ContextAgentConfig | Configuration |
context | Vec<ContextEntry> | Context window |
max_entries | usize | Maximum entries |
Methods
new
fn new(config: ContextAgentConfig) -> SelfCreate a new context agent
Parameters:
| Name | Type |
|---|---|
config | ContextAgentConfig |
add
fn add(&mut self, role: impl Into<String>, content: impl Into<String>) -> ()Add an entry to context
Parameters:
| Name | Type |
|---|---|
role | impl Into<String> |
content | impl Into<String> |
get_context
fn get_context(&self) -> Vec<&ContextEntry>Get context as messages
clear
fn clear(&mut self) -> ()Clear context
len
fn len(&self) -> usizeGet context length
is_empty
fn is_empty(&self) -> boolCheck if context is empty
Source
View on GitHubpraisonai/src/parity/specialized.rs at line 46