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

Diagram

Input Data

Agent: ContextAgent

Output Result

Fields

NameTypeDescription
configContextAgentConfigConfiguration
contextVec<ContextEntry>Context window
max_entriesusizeMaximum entries

Methods

new

rust
fn new(config: ContextAgentConfig) -> Self

Create a new context agent

Parameters:

NameType
configContextAgentConfig

add

rust
fn add(&mut self, role: impl Into<String>, content: impl Into<String>) -> ()

Add an entry to context

Parameters:

NameType
roleimpl Into&lt;String&gt;
contentimpl Into&lt;String&gt;

get_context

rust
fn get_context(&self) -> Vec<&ContextEntry>

Get context as messages

clear

rust
fn clear(&mut self) -> ()

Clear context

len

rust
fn len(&self) -> usize

Get context length

is_empty

rust
fn is_empty(&self) -> bool

Check if context is empty

Source

View on GitHub

praisonai/src/parity/specialized.rs at line 46


Related Documentation